Rounding a number to a specific significant figure is not working properly. For example, 1.264911064 to 3 sf results in 1.26491. This problem/bug is recent I guess, because in the past I got correct answers of rounding to sf.
Have you tried one of these?
x = 1.264911064;
NumberForm[x, 3]
Round[x, 1/100] // N
ResourceFunction["DecimalRound"][x, 3]
I don’t know of a built-in function for this, but here is a user-defined function:
(*sigfiqs required to be integer>0*)
roundTo[num_, sigfigs_] /; IntegerQ[sigfigs] && sigfigs > 0 :=
Module[{mant, exp, rounded},
(*mantissa and exponent*)
{mant, exp} = MantissaExponent[num];
(*round the mantissa to sigfigs and reconstruct*)
rounded = Round[mant, 10^-sigfigs] 10^exp;
(* return integer for integer*)
If[ IntegerQ[num], rounded, N@rounded]
]
roundTo[123456, 3]
(*123000*)
roundTo[12.3456*^-10, 3]
(*1.23`*^-9*)
Sorry, I had not noticed that you were using Wolfram Alpha. In fact, if I ask WA “round 1.264911064 to three significant digits” the function which gets called is N[1.264911064,3] which gives 1.26491, not what is wanted.
I don’t know if this behaviour is recent or not. I get the correct answer asking this:
round 2 Sqrt[2/5] to three significant digits
And me too! I missed it as well.