1 /* 2 * Copyright (c) 1980 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)d_sign.c 5.3 01/15/91 7 */ 8 9 #ifndef tahoe 10 double d_sign(a,b) 11 double *a, *b; 12 { 13 double x; 14 x = (*a >= 0 ? *a : - *a); 15 return( *b >= 0 ? x : -x); 16 } 17 18 #else 19 20 #include <tahoe/math/FP.h> 21 22 double d_sign(a,b) 23 double *a, *b; 24 { 25 double x; 26 x = *a; 27 if ((*a < 0) || (*b < 0)) 28 *(unsigned long *)&x ^= SIGN_BIT; 29 return(x); 30 } 31 #endif 32