I'd like to create a custom number format for use with ToString
. However if I do the obvious and create a function that calls NumberForm
with modified options:
numberform =
NumberForm[#,
ExponentFunction -> (If[-5 < # < 5, Null, #]&),
NumberFormat -> (If[#3 != "", SequenceForm[#1, "E", #3],#1]&)]&
Slot[1]&
It works fine as a function:
numberform[1234567890.]
1.23457E9
but not with ToString
:
ToString[1234567890., numberform]
ToString[1.23457*10^9, Slot[1]&]
Is there some attribute I have to set to make it behave like the built-in forms? Is that even possible? Is there a workaround?