I am looking more into output convertion for floats and current
implementation looks somewhat irregular. We have:
- "fixed" convertion which actually has two different behaviours.
With given precision it outputs given number of digits (possibly
0) after dot. With "default" setting (no precision specified)
it first produces up to 'd' significant digits where 'd' is current
precision expressed in digits, but then trims trailing zeros. In
particular, in default setting number of digit printed after dot
is variable,
- "floating" convertion is simplest one, with only irregularity
due to printing or not printing spaces around "E",
- "general" convertion prints either floating form or kind of fixed form.
The fixed form uses different rules than "fixed" convertion and
choice between floating and fixed form is somewhat irregular.
I think about following changes:
- make slightly different rule in "general" convertion: use fixed
form when there are at most 5 leading zeros before most significant
digit (this is current rule) or there are at most 2 trailing
zeros before the dot (this is change compared to current rule),
- with specified precision print given number of digits in
"general" convertion (this is change, current code may skip trailing
zeros in such case)
- with default precision (that is taken from floating point precision)
trim trailng zeros (this is mostly current behaviour, but I would
like to eliminate exceptions).
Note: currently floating point zero is normally printed as "0.0",
and only fixed format with specified number of digits prints
trailing zeros. I think that we should keep this even when it
contradicts literal reading of rules above. Simply, zero is
very special. But I would prefer to get rid of other exceptions.
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/ZrzAb1najE4ldF4A%40fricas.org.