fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 23: Convert real number to string with 2 decimal places
Idiom # 23: Convert real number to string with 2 decimal places
See
programming-idioms.org
:
Code
Code input
# Multiply by 100, floor it, divide by 100, then convert to String s := ((x * 100).floor / 100).as_string
What are effects?
Runnable Example
Code input
x := 3.14159 s := ((x * 100).floor / 100).as_string say s # Output: 3.14
What are effects?
last changed: 2026-04-29
next: Idiom # 24: Assign to string the japanese word ネコ