aubmoon added the comment:
We will add extending the float class as another possible work around or
part of a work around. Our developers now have a few options to
choose from. I am not sure which approach will be preferred. thanks for all
of the quick replies. this was just an odd case that was
aubmoon added the comment:
That is exactly what I tried first. It turns out in the particular case I
have been working the 8th digit is needed for correct answers. The job is a
port of a punch card FORTRAN system into something more modern. The catch
is the system is a scientific application
aubmoon added the comment:
Neither of those strictly meets the stated format. '0.12345678' is missing
the + which is explicit in the format and '+0.1234567' does not have 8
decimal places. Only '+.12345678' has a length of 10, 8 decimal places, and
the required sign
aubmoon added the comment:
Admittedly maximum is not correct; however, minimum is not right either.
The 10 is the desired (or target) width. Fixed width prints are commonly
used with very legacy systems that die a painful death when fixed width
strings are parsed by index and a field has spilled
New submission from aubmoon:
"{:+10.8}".format(0.12345678)
returns
'+0.12345678' (11 chars)
should return
'+.12345678' (10 chars)
--
messages: 212478
nosy: aubmoon
priority: normal
severity: normal
status: open
title: str.format for fixed width float c