Rev 697 | Rev 804 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 697 | Rev 698 | ||
---|---|---|---|
Line 57... | Line 57... | ||
57 | 57 | ||
58 | while (!(mant & (0x10000000000000ll))) { |
58 | while (!(mant & (0x10000000000000ll))) { |
59 | mant <<= 1; |
59 | mant <<= 1; |
60 | --result.parts.exp; |
60 | --result.parts.exp; |
61 | }; |
61 | }; |
- | 62 | ||
- | 63 | ++result.parts.exp; |
|
62 | result.parts.mantisa = mant; |
64 | result.parts.mantisa = mant; |
63 | }; |
65 | }; |
64 | 66 | ||
65 | return result; |
67 | return result; |
66 | 68 | ||
Line 106... | Line 108... | ||
106 | /* underflow or denormalized */ |
108 | /* underflow or denormalized */ |
107 | 109 | ||
108 | result.parts.exp = 0; |
110 | result.parts.exp = 0; |
109 | 111 | ||
110 | exp *= -1; |
112 | exp *= -1; |
111 | - | ||
112 | if (exp > FLOAT32_MANTISA_SIZE ) { |
113 | if (exp > FLOAT32_MANTISA_SIZE ) { |
113 | /* FIXME: underflow */ |
114 | /* FIXME: underflow */ |
114 | result.parts.mantisa = 0; |
115 | result.parts.mantisa = 0; |
115 | return result; |
116 | return result; |
116 | }; |
117 | }; |
117 | 118 | ||
118 | /* denormalized */ |
119 | /* denormalized */ |
119 | 120 | ||
120 | mant = result.parts.mantisa >> 1; |
121 | mant = a.parts.mantisa; |
121 | mant |= 0x10000000000000ll; /* denormalize and set hidden bit */ |
122 | mant |= 0x10000000000000ll; /* denormalize and set hidden bit */ |
122 | 123 | ||
- | 124 | mant >>= (FLOAT64_MANTISA_SIZE - FLOAT32_MANTISA_SIZE + 1); |
|
- | 125 | ||
123 | while (exp > 0) { |
126 | while (exp > 0) { |
124 | --exp; |
127 | --exp; |
125 | mant >>= 1; |
128 | mant >>= 1; |
126 | }; |
129 | }; |
127 | result.parts.mantisa = mant; |
130 | result.parts.mantisa = mant; |