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