summaryrefslogtreecommitdiff
path: root/lib/libc/gdtoa/ulp.c
diff options
context:
space:
mode:
authorMartynas Venckus <martynas@cvs.openbsd.org>2011-07-02 18:03:44 +0000
committerMartynas Venckus <martynas@cvs.openbsd.org>2011-07-02 18:03:44 +0000
commitfafda69fce7f6c746719efdb813b7727c2c836b3 (patch)
tree1442e2124a15c78bc39b17f1b8948e1b2fe4331c /lib/libc/gdtoa/ulp.c
parent5f1fa926488fbe7894ea95be3e160ad69d769a73 (diff)
Rebase on gdtoa-20110428; contains fixes for absurdly long inputs
(among other things). Fixes mozilla crasher for the link i was provided with. With the massive local changes to teach that malloc can fail, fixes for the vax, strlcpy, moving things to library namespaces. Tested on all architectures.
Diffstat (limited to 'lib/libc/gdtoa/ulp.c')
-rw-r--r--lib/libc/gdtoa/ulp.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/libc/gdtoa/ulp.c b/lib/libc/gdtoa/ulp.c
index 7810a5c8e64..17e9f862c44 100644
--- a/lib/libc/gdtoa/ulp.c
+++ b/lib/libc/gdtoa/ulp.c
@@ -34,13 +34,13 @@ THIS SOFTWARE.
double
ulp
#ifdef KR_headers
- (x) double x;
+ (x) U *x;
#else
- (double x)
+ (U *x)
#endif
{
Long L;
- double a;
+ U a;
L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1;
#ifndef Sudden_Underflow
@@ -49,22 +49,22 @@ ulp
#ifdef IBM
L |= Exp_msk1 >> 4;
#endif
- word0(a) = L;
- word1(a) = 0;
+ word0(&a) = L;
+ word1(&a) = 0;
#ifndef Sudden_Underflow
}
else {
L = -L >> Exp_shift;
if (L < Exp_shift) {
- word0(a) = 0x80000 >> L;
- word1(a) = 0;
+ word0(&a) = 0x80000 >> L;
+ word1(&a) = 0;
}
else {
- word0(a) = 0;
+ word0(&a) = 0;
L -= Exp_shift;
- word1(a) = L >= 31 ? 1 : 1 << 31 - L;
+ word1(&a) = L >= 31 ? 1 : 1 << (31 - L);
}
}
#endif
- return a;
+ return dval(&a);
}