In eiffel how do you make it so that the number.
118.1999999999999
prints to:
118.20
In other language is simply a matter of printf but there seems no to be a way to do that easily in Eiffel.
In eiffel how do you make it so that the number.
118.1999999999999
prints to:
118.20
In other language is simply a matter of printf but there seems no to be a way to do that easily in Eiffel.
For example:
class DOBLE
creation
make
feature
make is
local
n: DOUBLE
output: STRING
do
n := 118.1999999999999
output := n.to_string_format(2) -- 2 digits in fractionnal part
std_output.put_string(output + "%N")
end
end