Skip to content

Conversation

@gballet
Copy link
Member

@gballet gballet commented Dec 10, 2020

The previous fix #21960 converted the float to an intermediate signed int, before attempting the uint conversion. Although this works, this doesn't guarantee that other architectures will work the same.

e.Base >>= (integer - e.Exp)
e.Exp = integer
}
if base >= 0 || uint64(-base) <= e.Base {
Copy link
Contributor

@holiman holiman Dec 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simpler:

	if base >= 0{
		e.Base += uint64(base)
	}else if uint64(-base) <= e.base{
		// The conversion from negative float64 to
		// uint64 is undefined in golang, and doesn't
		// work with ARMv8. More details at:
		// https://github.com/golang/go/issues/43047
		e.Base -= uint64(-base)
	}
	return amount

... ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nevermind...

@holiman holiman added this to the 1.10.0 milestone Dec 11, 2020
@holiman holiman merged commit 1a715d7 into ethereum:master Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants