-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_abieos_template fails on arm8 builds #614
Comments
The problem appears to be that when a |
More specifically, the test wants to ensure it can make a round trip between binary, json, and the native types. And it tests at the extremities for some of these types; An example is It's not clear where this "extension" is occurring. I thought it may be due to the #include <iostream>
#include <limits>
int main() {
std::cout << (double)std::numeric_limits<float>::min() << std::endl;
return 0;
} just prints |
Promotion from float to double should be exact. The problem is almost certainly a result of differences in rounding. The conversions from binary to decimal and decimal to binary are both inexact. |
The extra digits definitely appear because of using |
I think the only solution here is to replace |
Yes, fwiw --- a/include/eosio/from_json.hpp
+++ b/include/eosio/from_json.hpp
@@ -485,7 +485,7 @@ void from_json(float& result, S& stream) {
std::string s(sv); // strtof expects a null-terminated string
errno = 0;
char* end;
- result = std::strtof(s.c_str(), &end);
+ result = std::strtod(s.c_str(), &end);
check( !errno && end == s.c_str() + s.size(),
convert_json_error(from_json_error::expected_number) );
} Is passing on both ARM8 & x86. Any downsides to this? |
Double rounding can increase the overall rounding error if the value being parsed was not originally a single-precision float. Also, I suspect that |
The text was updated successfully, but these errors were encountered: