Message212526
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 that protects life, limb, and
treasure. The new system must inter-operate with the legacy system until
the entire system can be replaced with VV&A software under configuration
control. In my particular case the sign must be printed, the decimal must
be printed, and all eight digits. The number is always strictly -1 < x < 1
and has eight significant digits. The number is the included in a larger
string of data. What I have done to address the issue is format the x
string separately from the rest of the data and then slice and join
out the undesired
leading 0. Then include the value as a %s format in the larger context.
On Saturday, March 1, 2014, Stefan Krah <report@bugs.python.org> wrote:
>
> Stefan Krah added the comment:
>
> aubmoon: Would it be a possibility just to use 'f' instead?
>
> >>> "{:+10.7f}".format(1.12345678)
> '+1.1234568'
> >>> "{:+10.7f}".format(0.12345678)
> '+0.1234568'
>
> ----------
> nosy: +skrah
>
> _______________________________________
> Python tracker <report@bugs.python.org <javascript:;>>
> <http://bugs.python.org/issue20811>
> _______________________________________
> |
|
Date |
User |
Action |
Args |
2014-03-01 23:04:35 | aubmoon | set | recipients:
+ aubmoon, mark.dickinson, eric.smith, ned.deily, skrah, BreamoreBoy |
2014-03-01 23:04:35 | aubmoon | link | issue20811 messages |
2014-03-01 23:04:34 | aubmoon | create | |
|