@@ -159,7 +159,7 @@ TEST_CASE("rounds_to_nearest") {
159
159
#endif
160
160
}
161
161
162
- TEST_CASE (" parse_zero" ) {
162
+ TEST_CASE (" double. parse_zero" ) {
163
163
//
164
164
// If this function fails, we may be left in a non-standard rounding state.
165
165
//
@@ -172,41 +172,45 @@ TEST_CASE("parse_zero") {
172
172
fesetround (FE_UPWARD);
173
173
auto r1 = fast_float::from_chars (zero, zero + 1 , f);
174
174
CHECK (r1.ec == std::errc ());
175
- std::cout << " FE_UPWARD parsed zero as " << iHexAndDec (f) << std::endl;
175
+ std::cout << " FE_UPWARD parsed zero as " << fHexAndDec (f) << std::endl;
176
176
CHECK (f == 0 );
177
177
::memcpy (&float64_parsed, &f, sizeof (f));
178
- std::cout << " double as uint64_t is " << float64_parsed << std::endl;
178
+ std::cout << " double as uint64_t is " << iHexAndDec (float64_parsed)
179
+ << std::endl;
179
180
CHECK (float64_parsed == 0 );
180
181
181
182
fesetround (FE_TOWARDZERO);
182
183
auto r2 = fast_float::from_chars (zero, zero + 1 , f);
183
184
CHECK (r2.ec == std::errc ());
184
- std::cout << " FE_TOWARDZERO parsed zero as " << iHexAndDec (f) << std::endl;
185
+ std::cout << " FE_TOWARDZERO parsed zero as " << fHexAndDec (f) << std::endl;
185
186
CHECK (f == 0 );
186
187
::memcpy (&float64_parsed, &f, sizeof (f));
187
- std::cout << " double as uint64_t is " << float64_parsed << std::endl;
188
+ std::cout << " double as uint64_t is " << iHexAndDec (float64_parsed)
189
+ << std::endl;
188
190
CHECK (float64_parsed == 0 );
189
191
190
192
fesetround (FE_DOWNWARD);
191
193
auto r3 = fast_float::from_chars (zero, zero + 1 , f);
192
194
CHECK (r3.ec == std::errc ());
193
- std::cout << " FE_DOWNWARD parsed zero as " << iHexAndDec (f) << std::endl;
195
+ std::cout << " FE_DOWNWARD parsed zero as " << fHexAndDec (f) << std::endl;
194
196
CHECK (f == 0 );
195
197
::memcpy (&float64_parsed, &f, sizeof (f));
196
- std::cout << " double as uint64_t is " << float64_parsed << std::endl;
198
+ std::cout << " double as uint64_t is " << iHexAndDec (float64_parsed)
199
+ << std::endl;
197
200
CHECK (float64_parsed == 0 );
198
201
199
202
fesetround (FE_TONEAREST);
200
203
auto r4 = fast_float::from_chars (zero, zero + 1 , f);
201
204
CHECK (r4.ec == std::errc ());
202
- std::cout << " FE_TONEAREST parsed zero as " << iHexAndDec (f) << std::endl;
205
+ std::cout << " FE_TONEAREST parsed zero as " << fHexAndDec (f) << std::endl;
203
206
CHECK (f == 0 );
204
207
::memcpy (&float64_parsed, &f, sizeof (f));
205
- std::cout << " double as uint64_t is " << float64_parsed << std::endl;
208
+ std::cout << " double as uint64_t is " << iHexAndDec (float64_parsed)
209
+ << std::endl;
206
210
CHECK (float64_parsed == 0 );
207
211
}
208
212
209
- TEST_CASE (" parse_negative_zero" ) {
213
+ TEST_CASE (" double. parse_negative_zero" ) {
210
214
//
211
215
// If this function fails, we may be left in a non-standard rounding state.
212
216
//
@@ -219,41 +223,45 @@ TEST_CASE("parse_negative_zero") {
219
223
fesetround (FE_UPWARD);
220
224
auto r1 = fast_float::from_chars (negative_zero, negative_zero + 2 , f);
221
225
CHECK (r1.ec == std::errc ());
222
- std::cout << " FE_UPWARD parsed negative zero as " << iHexAndDec (f)
226
+ std::cout << " FE_UPWARD parsed negative zero as " << fHexAndDec (f)
223
227
<< std::endl;
224
228
CHECK (f == 0 );
225
229
::memcpy (&float64_parsed, &f, sizeof (f));
226
- std::cout << " double as uint64_t is " << float64_parsed << std::endl;
230
+ std::cout << " double as uint64_t is " << iHexAndDec (float64_parsed)
231
+ << std::endl;
227
232
CHECK (float64_parsed == 0x8000'0000'0000'0000 );
228
233
229
234
fesetround (FE_TOWARDZERO);
230
235
auto r2 = fast_float::from_chars (negative_zero, negative_zero + 2 , f);
231
236
CHECK (r2.ec == std::errc ());
232
- std::cout << " FE_TOWARDZERO parsed negative zero as " << iHexAndDec (f)
237
+ std::cout << " FE_TOWARDZERO parsed negative zero as " << fHexAndDec (f)
233
238
<< std::endl;
234
239
CHECK (f == 0 );
235
240
::memcpy (&float64_parsed, &f, sizeof (f));
236
- std::cout << " double as uint64_t is " << float64_parsed << std::endl;
241
+ std::cout << " double as uint64_t is " << iHexAndDec (float64_parsed)
242
+ << std::endl;
237
243
CHECK (float64_parsed == 0x8000'0000'0000'0000 );
238
244
239
245
fesetround (FE_DOWNWARD);
240
246
auto r3 = fast_float::from_chars (negative_zero, negative_zero + 2 , f);
241
247
CHECK (r3.ec == std::errc ());
242
- std::cout << " FE_DOWNWARD parsed negative zero as " << iHexAndDec (f)
248
+ std::cout << " FE_DOWNWARD parsed negative zero as " << fHexAndDec (f)
243
249
<< std::endl;
244
250
CHECK (f == 0 );
245
251
::memcpy (&float64_parsed, &f, sizeof (f));
246
- std::cout << " double as uint64_t is " << float64_parsed << std::endl;
252
+ std::cout << " double as uint64_t is " << iHexAndDec (float64_parsed)
253
+ << std::endl;
247
254
CHECK (float64_parsed == 0x8000'0000'0000'0000 );
248
255
249
256
fesetround (FE_TONEAREST);
250
257
auto r4 = fast_float::from_chars (negative_zero, negative_zero + 2 , f);
251
258
CHECK (r4.ec == std::errc ());
252
- std::cout << " FE_TONEAREST parsed negative zero as " << iHexAndDec (f)
259
+ std::cout << " FE_TONEAREST parsed negative zero as " << fHexAndDec (f)
253
260
<< std::endl;
254
261
CHECK (f == 0 );
255
262
::memcpy (&float64_parsed, &f, sizeof (f));
256
- std::cout << " double as uint64_t is " << float64_parsed << std::endl;
263
+ std::cout << " double as uint64_t is " << iHexAndDec (float64_parsed)
264
+ << std::endl;
257
265
CHECK (float64_parsed == 0x8000'0000'0000'0000 );
258
266
}
259
267
0 commit comments