Gauche icon indicating copy to clipboard operation
Gauche copied to clipboard

~f formatter and exponential notation

Open shirok opened this issue 4 years ago • 0 comments

http://chaton.practical-scheme.net/gauche/a/2019/10/22#entry-5daf1372-ad6dd

Switching to exponential notation (specified by ScmNumberFormat.exp_lo and exp_hi) is done before the precision parameter is considered. We should consider switching after we know how many digits are needed for non-exponential notation.

It isn't obvious, though. We want (format "~10,8f" 0.0001) to be 0.00010000, but making (format "~10,8f" 0.000012345) to be 0.00001235 loses precision---should it be 1.23450000e-4?

A possible solution - we don't use exponential notation for ~f if precision is given, and let the user use ~e or ~g for that purpose.

shirok avatar Oct 23 '19 07:10 shirok