Deleted Added
full compact
ulp.c (165744) ulp.c (219557)
1/****************************************************************
2
3The author of this software is David M. Gay.
4
5Copyright (C) 1998, 1999 by Lucent Technologies
6All Rights Reserved
7
8Permission to use, copy, modify, and distribute this software and

--- 20 unchanged lines hidden (view full) ---

29/* Please send bug reports to David M. Gay (dmg at acm dot org,
30 * with " at " changed at "@" and " dot " changed to "."). */
31
32#include "gdtoaimp.h"
33
34 double
35ulp
36#ifdef KR_headers
1/****************************************************************
2
3The author of this software is David M. Gay.
4
5Copyright (C) 1998, 1999 by Lucent Technologies
6All Rights Reserved
7
8Permission to use, copy, modify, and distribute this software and

--- 20 unchanged lines hidden (view full) ---

29/* Please send bug reports to David M. Gay (dmg at acm dot org,
30 * with " at " changed at "@" and " dot " changed to "."). */
31
32#include "gdtoaimp.h"
33
34 double
35ulp
36#ifdef KR_headers
37 (x) double x;
37 (x) U *x;
38#else
38#else
39 (double x)
39 (U *x)
40#endif
41{
42 Long L;
40#endif
41{
42 Long L;
43 double a;
43 U a;
44
45 L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1;
46#ifndef Sudden_Underflow
47 if (L > 0) {
48#endif
49#ifdef IBM
50 L |= Exp_msk1 >> 4;
51#endif
44
45 L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1;
46#ifndef Sudden_Underflow
47 if (L > 0) {
48#endif
49#ifdef IBM
50 L |= Exp_msk1 >> 4;
51#endif
52 word0(a) = L;
53 word1(a) = 0;
52 word0(&a) = L;
53 word1(&a) = 0;
54#ifndef Sudden_Underflow
55 }
56 else {
57 L = -L >> Exp_shift;
58 if (L < Exp_shift) {
54#ifndef Sudden_Underflow
55 }
56 else {
57 L = -L >> Exp_shift;
58 if (L < Exp_shift) {
59 word0(a) = 0x80000 >> L;
60 word1(a) = 0;
59 word0(&a) = 0x80000 >> L;
60 word1(&a) = 0;
61 }
62 else {
61 }
62 else {
63 word0(a) = 0;
63 word0(&a) = 0;
64 L -= Exp_shift;
64 L -= Exp_shift;
65 word1(a) = L >= 31 ? 1 : 1 << 31 - L;
65 word1(&a) = L >= 31 ? 1 : 1 << (31 - L);
66 }
67 }
68#endif
66 }
67 }
68#endif
69 return a;
69 return dval(&a);
70 }
70 }