Skip to content

Commit b334317

Browse files
committed
Minor fixes
1 parent 1b91509 commit b334317

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

include/fast_float/float_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ struct span {
124124
span(const T* _ptr, size_t _length) : ptr(_ptr), length(_length) {}
125125
span() : ptr(nullptr), length(0) {}
126126

127-
constexpr size_t len() noexcept {
127+
constexpr size_t len() const noexcept {
128128
return length;
129129
}
130130

tests/long_exhaustive32_64.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ void all_32bit_values() {
3030
std::cerr << "parsing error ? " << buffer << std::endl;
3131
abort();
3232
}
33-
if(copysign(1,result_value) != copysign(1,v)) {
33+
if (std::isnan(v)) {
34+
if (!std::isnan(result_value)) {
35+
std::cerr << "not nan" << buffer << std::endl;
36+
abort();
37+
}
38+
} else if(copysign(1,result_value) != copysign(1,v)) {
3439
std::cerr << "I got " << std::hexfloat << result_value << " but I was expecting " << v
3540
<< std::endl;
3641
abort();

tests/string_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ bool test() {
5959
const char * end = input.data() + input.size();
6060
for(size_t i = 0; i < answers.size(); i++) {
6161
T result_value;
62+
while((begin < end) && (std::isspace(*begin))) { begin++; }
6263
auto result = fast_float::from_chars(begin, end,
6364
result_value);
6465
if (result.ec != std::errc()) {

0 commit comments

Comments
 (0)