1*47940Sbostic /*- 2*47940Sbostic * Copyright (c) 1980 The Regents of the University of California. 3*47940Sbostic * All rights reserved. 422868Skre * 5*47940Sbostic * %sccs.include.proprietary.c% 610466Sdlw */ 710466Sdlw 8*47940Sbostic #ifndef lint 9*47940Sbostic static char sccsid[] = "@(#)d_sign.c 5.4 (Berkeley) 04/12/91"; 10*47940Sbostic #endif /* not lint */ 11*47940Sbostic 1229964Smckusick #ifndef tahoe d_sign(a,b)1310466Sdlwdouble d_sign(a,b) 1410466Sdlw double *a, *b; 1510466Sdlw { 1610466Sdlw double x; 1710466Sdlw x = (*a >= 0 ? *a : - *a); 1810466Sdlw return( *b >= 0 ? x : -x); 1910466Sdlw } 2029964Smckusick 2145967Sbostic #else 2229964Smckusick 2345967Sbostic #include <tahoe/math/FP.h> 2429964Smckusick d_sign(a,b)2529964Smckusickdouble d_sign(a,b) 2629964Smckusick double *a, *b; 2729964Smckusick { 2829964Smckusick double x; 2929964Smckusick x = *a; 3029964Smckusick if ((*a < 0) || (*b < 0)) 3129964Smckusick *(unsigned long *)&x ^= SIGN_BIT; 3229964Smckusick return(x); 3329964Smckusick } 3445967Sbostic #endif 35