-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Fix to avoid a compile error due to float to int truncation with GCCGO #9233
Fix to avoid a compile error due to float to int truncation with GCCGO #9233
Conversation
Signed-off-by: Tatsushi Inagaki <e29253@jp.ibm.com>
I would probably change |
…ith GCCGO" This reverts commit 967a42f. Signed-off-by: Tatsushi Inagaki <e29253@jp.ibm.com> Roll back the change to fix the parameter of HumanSize from int64 to float64
…oat to int truncation Signed-off-by: Tatsushi Inagaki <e29253@jp.ibm.com>
Modified |
@vieux @jfrazelle Do we need additional changes to merge this PR? This problem can occur even with GC depending on the value of floating point constant. |
LGTM |
@crosbymichael ping? |
LGTM |
Fix to avoid a compile error due to float to int truncation with GCCGO
@crosbymichael Unit tests are failing, why did we merge this? |
This wasn't needed any more. A much smaller PR was #9715 and it fixed the same problem. This PR introduced a conflict with master once that was merged. I'm going to send a revert PR for this one. |
FYI, instead of reverting this PR, we fixed the compile errors in the unit tests. |
The unit test
pkg/units/size_test.go
fails with GCCGO due to a compilation error:According to the discussion on GCC Bugzilla, this is due to the difference between GCCGO and GC in the implementations of floating point constant expression. The language specifies that a compiler raises an error when a floating point constant expression is truncated to integer, a precision of the internal representation is implementation-dependent. While my workaround is modifying
size_test.go
as:, is it better to modify the parameter of
HumanSize()
fromint64
tofloat64
likeBytesSize()
?Signed-off-by: Tatsushi Inagaki e29253@jp.ibm.com