xref: /csrg-svn/usr.bin/f77/libF77/d_sign.c (revision 29964)
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*29964Smckusick  *	@(#)d_sign.c	5.2	11/03/86
710466Sdlw  */
810466Sdlw 
9*29964Smckusick #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 }
17*29964Smckusick 
18*29964Smckusick #else tahoe
19*29964Smckusick 
20*29964Smckusick #include <tahoemath/FP.h>
21*29964Smckusick 
22*29964Smckusick double d_sign(a,b)
23*29964Smckusick double *a, *b;
24*29964Smckusick {
25*29964Smckusick double x;
26*29964Smckusick x = *a;
27*29964Smckusick if ((*a < 0) || (*b < 0))
28*29964Smckusick 	*(unsigned long *)&x ^= SIGN_BIT;
29*29964Smckusick return(x);
30*29964Smckusick }
31*29964Smckusick #endif tahoe
32