Some of my symbolic computations involve many large numbers, e.g.:
37894580188800000000000000000000000000000000000000
As the computation is symbolic, I'd like to leave the numbers in exact form, holding off the numerical conversion until the end.
This, however, makes the presentation of intermediate results unwieldy (especially if the expression contains a lot of large numbers). It would be nice if there were a function that caused an output to display all its over-threshold exact numbers in scientific notation, while keeping them exact internally. For instance in the case of the above, it would be:
3.78945801888 x 10^49
Wolfram's documentation says "The Wolfram Language provides flexible mechanisms for full typeset formatting of numbers of any magnitude and precision", but I've not been able to find a function that does this.
EDIT: Thanks kglr and Carl! Here's how your functions work on one of my test cases (too long to put into the comments):
test = (BesselJ[-(3/4), (307792869430417000000000000000000 Mrest)/
56948374077008069066071] BesselY[-(1/4), (
307792869430417000000000000000000 Mrest)/
56948374077008069066071] +
BesselJ[3/4, (307792869430417000000000000000000 Mrest)/
56948374077008069066071] BesselY[1/4, (
307792869430417000000000000000000 Mrest)/
56948374077008069066071]) (Quantity[-((
2053373 Sqrt[73/18913] Mrest^3 \[Pi]^(3/2))/
218400036542934750122025461419177208453231459616518446904000000000\
00), 1/("Kilograms")^3])
kglr (these approaches give nice compactness, and have the convenience of only needing to be applied once) (the results from the two are identical):
$Post = N
test
$Post=.
(*OR*)
$PrePrint =
If[Precision[#] == \[Infinity], N[#], N[#, Precision[#]]] &;
test
$PrePrint =.
Carl (this function is useful if I want to keep track of the individual numbers):
inexactForm[test]
$Post = N
? (see $Post) $\endgroup$