xref: /csrg-svn/lib/libc/quad/floatunsdidf.c (revision 61160)
153800Sbostic /*-
2*61160Sbostic  * Copyright (c) 1992, 1993
3*61160Sbostic  *	The Regents of the University of California.  All rights reserved.
453800Sbostic  *
553800Sbostic  * This software was developed by the Computer Systems Engineering group
653800Sbostic  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
753800Sbostic  * contributed to Berkeley.
853800Sbostic  *
953800Sbostic  * %sccs.include.redist.c%
1053800Sbostic  */
1153800Sbostic 
1253800Sbostic #if defined(LIBC_SCCS) && !defined(lint)
13*61160Sbostic static char sccsid[] = "@(#)floatunsdidf.c	8.1 (Berkeley) 06/04/93";
1453800Sbostic #endif /* LIBC_SCCS and not lint */
1553800Sbostic 
1653800Sbostic #include "quad.h"
1753800Sbostic 
1853800Sbostic /*
1953800Sbostic  * Convert (unsigned) quad to double.
2053800Sbostic  * This is exactly like floatdidf.c except that negatives never occur.
2153800Sbostic  */
2253800Sbostic double
__floatunsdidf(x)2354431Sbostic __floatunsdidf(x)
2454431Sbostic 	u_quad_t x;
2553800Sbostic {
2653800Sbostic 	double d;
2753800Sbostic 	union uu u;
2853800Sbostic 
2953800Sbostic 	u.uq = x;
3053800Sbostic 	d = (double)u.ul[H] * ((1 << (LONG_BITS - 2)) * 4.0);
3153800Sbostic 	d += u.ul[L];
3253800Sbostic 	return (d);
3353800Sbostic }
34