]> gitweb.factorcode.org Git - factor.git/commit
formatting: don't force the presence of ".0" for %f and %e when precision is 0
authorJon Harper <jon.harper87@gmail.com>
Sun, 26 Feb 2017 15:55:49 +0000 (16:55 +0100)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 8 Jun 2017 18:23:38 +0000 (11:23 -0700)
commit552791d1cf959e7f6035f43f58c6caf176ba2bc9
treeea010cd0330c021297a4982a3893bec9cb2e1679
parent762b22e1a8311a3cdb05f25c5447776dae34639a
formatting: don't force the presence of ".0" for %f and %e when precision is 0

It's misleading because you can think you have more precision than you really
do when looking at the output. So instead of "1.0", we can format it as "1" or
"1.".  And instead of "1.0e+00" we can format "1e+00" or "1.e+00".  In C,
printf does not print the radix character, it's prettier. But since the factor
parser accepts both styles, and keeping the radix character gives a stronger sense
that the number is approximate, I prefer to keep the radix character..
basis/formatting/formatting-tests.factor
basis/formatting/formatting.factor