brendanarnold / py-fortranformat

MIT License
31 stars 7 forks source link

G edit descriptor does not allow 0 for the precision #14

Closed brendanarnold closed 3 years ago

brendanarnold commented 3 years ago

Using G10.0 gives the following error even though this is perfectly valid edit descriptor

Traceback (most recent call last):
  File "/Users/brendan/Developer/py-fortranformat/tests/handwritten/g-ed/g-ed-output-tests.py", line 29, in g_output_test_2
    self.assertEqual(result, _output(eds, rev_eds, inpt))
  File "/Users/brendan/Developer/py-fortranformat/fortranformat/_output.py", line 114, in output
    sub_string = _compose_float_string(w, e, d, state, val, 'G')
  File "/Users/brendan/Developer/py-fortranformat/fortranformat/_output.py", line 300, in _compose_float_string
    out = _output_float(w, d, e, state, ftype, buff, sign_bit, zero_flag, ndigits, edigits)
  File "/Users/brendan/Developer/py-fortranformat/fortranformat/_output.py", line 368, in _output_float
    raise InvalidFormat("Precision not greater than zero in format specifier 'E' or 'D'")
InvalidFormat: Precision not greater than zero in format specifier 'E' or 'D'
brendanarnold commented 3 years ago

Fixed for E, D and G edit descriptors