1 /*- 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)d_sign.c 5.4 (Berkeley) 04/12/91"; 10 #endif /* not lint */ 11 12 #ifndef tahoe 13 double d_sign(a,b) 14 double *a, *b; 15 { 16 double x; 17 x = (*a >= 0 ? *a : - *a); 18 return( *b >= 0 ? x : -x); 19 } 20 21 #else 22 23 #include <tahoe/math/FP.h> 24 25 double d_sign(a,b) 26 double *a, *b; 27 { 28 double x; 29 x = *a; 30 if ((*a < 0) || (*b < 0)) 31 *(unsigned long *)&x ^= SIGN_BIT; 32 return(x); 33 } 34 #endif 35