Is there a quick and easy way to truncate a decimal number, say beyond 4 digits, in MATHEMATICA?
With N[1/6, 4] it rounds to =1.6667.
I want you to cut to 1.6666.
Thanks!
f[x_, n_] := N[IntegerPart[x 10^n]/10^n]
f[1/6, 4]
1.6666
However, note
f[N[531/25], 4]
21.2399
so really some further refinement is required.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With