I'm trying to get output with all of my numbers in scientific notation. Mathematica doesn't seem to use scientific notation until the exponent is 6. These are all machine numbers. I thought I could use NumberForm and put a formula in for ExponentFunction using Log[10,x] to force the exponent.

So I did this:

NumberForm[123456., ExponentFunction -> (Floor[Log[10, 123456.]] &)]

correct answer

However, when I try this and reference the number, as follows, it doesn't work.

NumberForm[123456., ExponentFunction -> (Floor[Log[#]] &)]

incorrect answer

What am I doing wrong?

  • 4
    $\begingroup$ For debugging, you could do NumberForm[123456., ExponentFunction -> ((Print[{##}]; Floor[Log[#]]) &)] to see what arguments are fed to the pure function. $\endgroup$
    – Carl Woll
    Apr 13, 2017 at 22:02
  • $\begingroup$ @CarlWoll Thank you for that. Clearly I didn't understand how the pure function worked. I'm still a little confused, but at least I can now use it in this context. $\endgroup$ Apr 14, 2017 at 13:04

1 Answer 1


Use ScientificForm

list = 123.456*10^Range[-6, 6];


enter image description here

There is also EngineeringForm


enter image description here

  • 4
    $\begingroup$ Or, if one really wants to use NumberForm: NumberForm[list, ExponentFunction -> (1 Quotient[#, 1] &)] and NumberForm[list, ExponentFunction -> (3 Quotient[#, 3] &)], respectively. $\endgroup$
    – anderstood
    Apr 13, 2017 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.