Pike v7.6 release 13 running Hilfe v3.5 (Incremental Pike Frontend)
float a = Math.pi/2, b = 1.570796; a;
(1) Result: 1.570796
b;
(2) Result: 1.570796
(a-b)*1000000;
(3) Result: 0.357628
sprintf("%.7f", a);
(4) Result: "1.5707964"
sprintf("%.7f", b);
(5) Result: "1.5707960"
As you can see, a is larger than b, but the difference is in the seventh decimal so you can't see it in the default print format. More precisely, b < Pi/2 < a. (Pi/2 = 1.5707963..., which can't be represented exactly with any floating point representation.)
Ok. I kind of assumed hilfe displayed the number with full precision. Ignore my previous comment.
What it does in this case is to display the _digits_ with full precision. The seventh decimal only has partial precision, so it is better not to show it. (Of course, this only applies to numbers in the range 1..2-\epsilon for the %f representation.)
Pike v7.6 release 13 running Hilfe v3.5 (Incremental Pike Frontend)
sprintf("%.7f", 1.5707960);
(1) Result: "1.5707960"
sprintf("%.7f", 1.5707961);
(2) Result: "1.5707961"
sprintf("%.7f", 1.5707962);
(3) Result: "1.5707963" <--------
sprintf("%.7f", 1.5707963);
(4) Result: "1.5707963"
Also, most floating point numbers have infinite decimal representations, so printing them with "full precision" in base 10 is a bit impractical. :-)
pike-devel@lists.lysator.liu.se