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