xref: /original-bsd/lib/libc/quad/floatunsdidf.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This software was developed by the Computer Systems Engineering group
6  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7  * contributed to Berkeley.
8  *
9  * %sccs.include.redist.c%
10  */
11 
12 #if defined(LIBC_SCCS) && !defined(lint)
13 static char sccsid[] = "@(#)floatunsdidf.c	8.1 (Berkeley) 06/04/93";
14 #endif /* LIBC_SCCS and not lint */
15 
16 #include "quad.h"
17 
18 /*
19  * Convert (unsigned) quad to double.
20  * This is exactly like floatdidf.c except that negatives never occur.
21  */
22 double
23 __floatunsdidf(x)
24 	u_quad_t x;
25 {
26 	double d;
27 	union uu u;
28 
29 	u.uq = x;
30 	d = (double)u.ul[H] * ((1 << (LONG_BITS - 2)) * 4.0);
31 	d += u.ul[L];
32 	return (d);
33 }
34