@@ -172,34 +172,35 @@ function printfmt(io::IO, fs::FormatSpec, x)
172
172
cls = fs. cls
173
173
ty = fs. typ
174
174
if cls == ' i'
175
+ local ix
175
176
try
176
177
ix = Integer (x)
177
- ty == ' d' || ty == ' n' ? _pfmt_i (io, fs, ix, _Dec ()) :
178
- ty == ' x' ? _pfmt_i (io, fs, ix, _Hex ()) :
179
- ty == ' X' ? _pfmt_i (io, fs, ix, _HEX ()) :
180
- ty == ' o' ? _pfmt_i (io, fs, ix, _Oct ()) :
181
- _pfmt_i (io, fs, ix, _Bin ())
182
178
catch
183
- ty == ' d' || ty == ' n' ? _pfmt_i (io, fs, x, _Dec ()) :
184
- ty == ' x' ? _pfmt_i (io, fs, x, _Hex ()) :
185
- ty == ' X' ? _pfmt_i (io, fs, x, _HEX ()) :
186
- ty == ' o' ? _pfmt_i (io, fs, x, _Oct ()) :
187
- _pfmt_i (io, fs, x, _Bin ())
179
+ ix = x
188
180
end
181
+ ty == ' d' || ty == ' n' ? _pfmt_i (io, fs, ix, _Dec ()) :
182
+ ty == ' x' ? _pfmt_i (io, fs, ix, _Hex ()) :
183
+ ty == ' X' ? _pfmt_i (io, fs, ix, _HEX ()) :
184
+ ty == ' o' ? _pfmt_i (io, fs, ix, _Oct ()) :
185
+ _pfmt_i (io, fs, ix, _Bin ())
189
186
elseif cls == ' f'
187
+ local fx, nospecialf
190
188
try
191
189
fx = float (x)
192
- if isfinite (fx)
193
- ty == ' f' || ty == ' F' ? _pfmt_f (io, fs, fx) :
194
- ty == ' e' || ty == ' E' ? _pfmt_e (io, fs, fx) :
195
- error (" format for type g or G is not supported yet (use f or e instead)." )
196
- else
197
- _pfmt_specialf (io, fs, fx)
198
- end
199
190
catch
200
- ty == ' f' || ty == ' F' ? _pfmt_f (io, fs, x) :
201
- ty == ' e' || ty == ' E' ? _pfmt_e (io, fs, x) :
191
+ fx = x
192
+ end
193
+ try
194
+ nospecialf = isfinite (fx)
195
+ catch
196
+ nospecialf = true
197
+ end
198
+ if nospecialf
199
+ ty == ' f' || ty == ' F' ? _pfmt_f (io, fs, fx) :
200
+ ty == ' e' || ty == ' E' ? _pfmt_e (io, fs, fx) :
202
201
error (" format for type g or G is not supported yet (use f or e instead)." )
202
+ else
203
+ _pfmt_specialf (io, fs, fx)
203
204
end
204
205
elseif cls == ' s'
205
206
_pfmt_s (io, fs, _srepr (x))
0 commit comments