Skip to content

Conformance Examples 0.1.0 — Render: number-rendering

over-long-integer-renders-fixed-notation

An integer literal too large for Long (20 nines) falls back to the ECMA-262 double formatter, which renders it in fixed notation.

Template

{{ /n }}

Context

{
    "n": 1.0E20
}

Output

100000000000000000000

exponent-1e20-renders-fixed-notation

1e20 is within ECMA-262's fixed-notation range (n <= 21) and renders without an exponent.

Template

{{ /n }}

Context

{
    "n": 1.0E20
}

Output

100000000000000000000

exponent-1e21-renders-exponential-notation

1e21 is just past ECMA-262's fixed-notation threshold and renders in exponential notation.

Template

{{ /n }}

Context

{
    "n": 1.0E21
}

Output

1e+21

exponent-1e-minus-6-renders-fixed-notation

1e-6 is within ECMA-262's fixed-notation range (n >= -5) and renders with leading zeros, not an exponent.

Template

{{ /n }}

Context

{
    "n": 1.0E-6
}

Output

0.000001

exponent-1e-minus-7-renders-exponential-notation

1e-7 is just past ECMA-262's fixed-notation threshold on the small side and renders in exponential notation.

Template

{{ /n }}

Context

{
    "n": 1.0E-7
}

Output

1e-7

negative-zero-renders-as-zero

Negative zero renders as "0", not "-0", per ECMA-262 Number::toString.

Template

{{ /n }}

Context

{
    "n": -0.0
}

Output

0

float-addition-renders-shortest-round-trip-digits

0.1 + 0.2 via the plus transform renders the shortest round-trip decimal for the resulting double, exposing the classic binary-floating-point artifact rather than hiding it.

Template

{{ /a | plus: /b }}

Context

{
    "a": 0.1,
    "b": 0.2
}

Output

0.30000000000000004

double-max-value-renders-exponential-notation

Double.MAX_VALUE is far past the fixed-notation threshold and renders in exponential notation.

Template

{{ /n }}

Context

{
    "n": 1.7976931348623157E308
}

Output

1.7976931348623157e+308

Source fixture: render/number-rendering.json