mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-03-10 23:20:23 -07:00
printer: print zero after decimal point in exponential notation if there are no other trailing digits
Previously for example (prin1 1.0e-8) would result in 1.e-8. However, the ANSI standard (see CLHS section 22.1.3.1.3) specifies that there has to be at least one digit after the decimal point therefore we now print 1.0e-8.
This commit is contained in:
parent
3d809dab47
commit
3a0d818c0e
1 changed files with 6 additions and 1 deletions
|
|
@ -107,7 +107,12 @@ si_float_to_string_free(cl_object buffer_or_nil, cl_object number,
|
|||
}
|
||||
/* Do we have to print in exponent notation? */
|
||||
if (ecl_lowereq(exp, e_min) || ecl_lowereq(e_max, exp)) {
|
||||
insert_char(buffer, base+1, '.');
|
||||
if (ecl_length(buffer) == base+1) {
|
||||
insert_char(buffer, base+1, '.');
|
||||
insert_char(buffer, base+2, '0');
|
||||
} else {
|
||||
insert_char(buffer, base+1, '.');
|
||||
}
|
||||
print_float_exponent(buffer, number, e-1);
|
||||
} else if (e > 0) {
|
||||
cl_fixnum l = buffer->base_string.fillp - base;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue