WeBWorK Problems

Scientific Notation

Re: Scientific Notation

by Davide Cervone -
Number of replies: 0
Do Math Object Reals allow for more control over when scientific notation kicks in?

Yes. You can set a format string in the Context that tells MathObjects how to format its Real numbers. See


for details. It is essentially an sprint() format string, with the default being %g, which uses scientific notation when the magnitude is sufficiently big or sufficiently small, but you can change it to a "%f"-style format instead to prevent scientific notation.

You might also want to consider the contextScientificNotation.pl macro file, which implements a Context designed for requiring student answers in scientific notation. It has some handy controls for the number of digits in input and output.