Docs menu

E077: An integer literal can't be represented exactly as a 'double'

What compiler error E077 means, and how to fix it.

Turf allows an integer literal to implicitly become a ‘double’:

Example
mut d: double = 5;   // fine -- 5 converts to 5.0 exactly

But not every integer has an exact ‘double’ representation. A ‘double’ only has 53 bits of precision, so a large-enough integer literal can’t be converted without silently losing its exact value:

Example
mut d: double = 9223372036854775807;// ERROR: this doesn't round-trip exactly as a double

Turf refuses this rather than silently rounding, because the whole point of this check is to stop a number from silently becoming a slightly different number.

The fix is one of:

  • Use ‘int’ instead, if you need the exact integer value.
  • Write it as an explicit float literal (‘9223372036854775807.0’) if
Example
you're fine with the (slightly rounded) double value.

Run turf --explain E077 in a terminal to read this again.

Last updated: Oct 15, 2026Edit this page on GitHub

Esc

Type to search.