|
|
1.1 root 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.2 11/3/86
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 tahoe
19:
20: #include <tahoemath/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 tahoe
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.