Inform 7 Home Page / Documentation
§15.4. Printing real numbers
say "[(real number) to (number) decimal places]"
This text substitution writes out the number to the given number of decimal places. Examples:
"The semicircle is roughly [pi to 3 decimal places] paces around."
produces "The semicircle is roughly 3.142 paces around." The number of places can only usefully be from 1 to 8. Note that, for example, "[1.235 x 10^-7 to 3 decimal places]" produces 0.0; "[1.235678 x 10^8 to 3 decimal places]" produces "1.236 x 10^8".
say "[(real number) in decimal notation]"
This text substitution writes out the number in decimal form, that is, avoiding "x 10^n" even for very large or very small quantities. For example,
produces 123457000.0 rather than 1.23457 x 10^8. This can look pretty extreme: for example, "[1.8983 x 10^27 in decimal notation]", the mass of the planet Jupiter in kilograms, produces 1898296960000000000000000000.0.
say "[(real number) to (number) decimal places in decimal notation]"
This text substitution writes out the number in decimal form, but rounding to the accuracy given.
say "[(real number) in scientific notation]"
This text substitution writes out the number in scientific form, that is, using "x 10^n" even for easy-to-judge quantities. For example,
produces 7.29927 x 10^-3 rather than 0.0073. This can look odd: for example, "[pi in scientific notation]" comes out as 3.14159 x 10^0 rather than 3.14159.
say "[(real number) to (number) decimal places in scientific notation]"
This text substitution writes out the number in scientific form, but rounding to the accuracy given.