I am using wolframscript.exe
to learn mathematica and I would expect the following code to return 0.7071
:
Print[N[Sin[Pi/4],5]];
But instead, when ran using:
wolframscript.exe -file "myfile.wl"
I get the following output instead:
0.7071067811865474617`5.
Am I misunderstanding how N
works?
N[Sin[Pi/4], 5]
indicates that you want the precision tracked and controlled to provide a result with a precision of 5 digits. It does not control the display of the number. The`5
in the result indicates that the result achieved a precision of5
digits; the rest of the digits are what is stored. $\endgroup$wolframscript
but have you triedNumberForm
$\endgroup$