Decimal
The decimal family computes in base ten (IEEE 754-2008 decimal): numbers that are writable exactly in decimal (0.1, 1.10, and the like) are exact here. Use it wherever exact arithmetic matters; graphics and physics use Float.
Three widths
The literal suffixes are d32 / d64 / d128, with 7 / 16 / 34 significant digits. Type annotations use the full names decimal32 / decimal64 / decimal128 (there is no bare decimal name):
print(1.10d32 + 1.10d32);
print(0.1d64 + 0.2d64 == 0.3d64);2.2
TrueConversion and mixing matrix
intto decimal is implicit, but only when lossless (val d: decimal64 = 3;is legal).- Narrow decimal widens to wider decimal implicitly.
- float and decimal forbid implicit conversion and mixed arithmetic in both directions (comparisons included); convert explicitly with
float64(x)/decimal64(x)(see Type Conversions). - Within one family, different widths compute together and the result takes after the wider side:
1.5f32 + 2.0f64gives3.5(same for the float family).
Display and equality
Printing uses the shortest representation: trailing zeros are not kept (1.10d64 prints as 1.1), and interpolation behaves the same. Equality is purely numeric; trailing zeros and precision tier take no part, so 1.10d64 == 1.1d64 is True. Decimal exactness makes 0.1d64 + 0.2d64 == 0.3d64 hold exactly.
Notes
- Division by zero is a hard runtime error:
mush: MS6000: Runtime error: decimal division by zero.; magnitude overflow also raises the runtime MS6000; decimal has noInf/NaN. - Bitwise operations, shifts, and bitwise negation are unavailable (MS3155).
- The
**power operator only takes integer exponents. - decimal does not take part in the numeric
ToString(format)formatting surface; for fixed-digit output, convert withfloat64(x)first, or use the interpolation alignment slot.
Last updated on October 11, 2026
