formatting

This commit is contained in:
Daniel Lemire 2024-08-31 18:27:44 -04:00
parent c8abf94560
commit 9117ec4f69

View File

@ -81,9 +81,15 @@ bool small() {
double result = -1;
std::string str = "3e-1000";
auto r = fast_float::from_chars(str.data(), str.data() + str.size(), result);
if(r.ec != std::errc::result_out_of_range) { return false; }
if(r.ptr != str.data() + 7) { return false; }
if(result != 0) { return false; }
if (r.ec != std::errc::result_out_of_range) {
return false;
}
if (r.ptr != str.data() + 7) {
return false;
}
if (result != 0) {
return false;
}
printf("small values go to zero\n");
return true;
}
@ -92,9 +98,15 @@ bool large() {
double result = -1;
std::string str = "3e1000";
auto r = fast_float::from_chars(str.data(), str.data() + str.size(), result);
if(r.ec != std::errc::result_out_of_range) { return false; }
if(r.ptr != str.data() + 6) { return false; }
if(result != std::numeric_limits<double>::infinity()) { return false; }
if (r.ec != std::errc::result_out_of_range) {
return false;
}
if (r.ptr != str.data() + 6) {
return false;
}
if (result != std::numeric_limits<double>::infinity()) {
return false;
}
printf("large values go to infinity\n");
return true;
}