gno icon indicating copy to clipboard operation
gno copied to clipboard

Overflow Occurs When Converting `math.MaxUint64` to Floating-Point Types

Open notJoon opened this issue 1 year ago • 0 comments

Description

When converting math.MaxUint64 to float32 or float64 types, an overflow occurs. I think precision loss has occured during the type conversion (not sure). Note that, It works fine with math.MaxUint32

package main

import (
  "math"
)

func main() {
  println(float64(math.MaxUint32))         // 4.294967295e+09
  println(float64(math.MaxUint64))         // error
}

// panic: bigint overflows target kind [recovered]
        panic: main/gnovm/tests/files/a0.gno:9: bigint overflows target kind:

Expected Output:

4.294967e+09
5.421011e-02

notJoon avatar Apr 30 '24 09:04 notJoon