OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 return (d64 & kExponentMask) == 0; | 123 return (d64 & kExponentMask) == 0; |
124 } | 124 } |
125 | 125 |
126 // We consider denormals not to be special. | 126 // We consider denormals not to be special. |
127 // Hence only Infinity and NaN are special. | 127 // Hence only Infinity and NaN are special. |
128 bool IsSpecial() const { | 128 bool IsSpecial() const { |
129 uint64_t d64 = AsUint64(); | 129 uint64_t d64 = AsUint64(); |
130 return (d64 & kExponentMask) == kExponentMask; | 130 return (d64 & kExponentMask) == kExponentMask; |
131 } | 131 } |
132 | 132 |
133 bool IsNan() const { | |
134 uint64_t d64 = AsUint64(); | |
135 return ((d64 & kExponentMask) == kExponentMask) && | |
136 ((d64 & kSignificandMask) != 0); | |
137 } | |
138 | |
139 bool IsInfinite() const { | 133 bool IsInfinite() const { |
140 uint64_t d64 = AsUint64(); | 134 uint64_t d64 = AsUint64(); |
141 return ((d64 & kExponentMask) == kExponentMask) && | 135 return ((d64 & kExponentMask) == kExponentMask) && |
142 ((d64 & kSignificandMask) == 0); | 136 ((d64 & kSignificandMask) == 0); |
143 } | 137 } |
144 | 138 |
145 int Sign() const { | 139 int Sign() const { |
146 uint64_t d64 = AsUint64(); | 140 uint64_t d64 = AsUint64(); |
147 return (d64 & kSignMask) == 0? 1: -1; | 141 return (d64 & kSignMask) == 0? 1: -1; |
148 } | 142 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 biased_exponent = static_cast<uint64_t>(exponent + kExponentBias); | 223 biased_exponent = static_cast<uint64_t>(exponent + kExponentBias); |
230 } | 224 } |
231 return (significand & kSignificandMask) | | 225 return (significand & kSignificandMask) | |
232 (biased_exponent << kPhysicalSignificandSize); | 226 (biased_exponent << kPhysicalSignificandSize); |
233 } | 227 } |
234 }; | 228 }; |
235 | 229 |
236 } } // namespace v8::internal | 230 } } // namespace v8::internal |
237 | 231 |
238 #endif // V8_DOUBLE_H_ | 232 #endif // V8_DOUBLE_H_ |
OLD | NEW |