This has to do with untyped constants. An untyped floating point constant can hold a value with a much higher precission than a typed float64
constant.
So on the second line, in your typed constant expression the multiplication yields a float with a precision much smaller than the multiplication in the untyped constant expression on line one.
Implementation restriction: Although numeric constants have arbitrary
precision in the language, a compiler may implement them using an
internal representation with limited precision. That said, every
implementation must:
- Represent integer constants with at least 256 bits.
- Represent floating-point constants, including the parts of a complex constant, with a mantissa of at least 256 bits and a signed binary exponent of at least 16 bits.
- Give an error if unable to represent an integer constant precisely.
- Give an error if unable to represent a floating-point or complex constant due to overflow.
Round to the nearest representable constant if unable to represent a floating-point or complex constant due to limits on precision.
See related: https://stackoverflow.com/a/57512022/965900