xref: /csrg-svn/usr.bin/f77/libF77/d_sign.c (revision 45967)
110466Sdlw /*
222868Skre  * Copyright (c) 1980 Regents of the University of California.
322868Skre  * All rights reserved.  The Berkeley software License Agreement
422868Skre  * specifies the terms and conditions for redistribution.
522868Skre  *
6*45967Sbostic  *	@(#)d_sign.c	5.3	01/15/91
710466Sdlw  */
810466Sdlw 
929964Smckusick #ifndef tahoe
1010466Sdlw double d_sign(a,b)
1110466Sdlw double *a, *b;
1210466Sdlw {
1310466Sdlw double x;
1410466Sdlw x = (*a >= 0 ? *a : - *a);
1510466Sdlw return( *b >= 0 ? x : -x);
1610466Sdlw }
1729964Smckusick 
18*45967Sbostic #else
1929964Smckusick 
20*45967Sbostic #include <tahoe/math/FP.h>
2129964Smckusick 
2229964Smckusick double d_sign(a,b)
2329964Smckusick double *a, *b;
2429964Smckusick {
2529964Smckusick double x;
2629964Smckusick x = *a;
2729964Smckusick if ((*a < 0) || (*b < 0))
2829964Smckusick 	*(unsigned long *)&x ^= SIGN_BIT;
2929964Smckusick return(x);
3029964Smckusick }
31*45967Sbostic #endif
32