Mercurial > octave-nkf
comparison src/oct-stream.cc @ 4305:98e65d1728a1
[project @ 2003-01-23 16:48:11 by jwe]
author | jwe |
---|---|
date | Thu, 23 Jan 2003 16:48:11 +0000 |
parents | e15a96673976 |
children | 1b3804420b1b |
comparison
equal
deleted
inserted
replaced
4304:fd7d9a6e15ff | 4305:98e65d1728a1 |
---|---|
2297 double val = val_cache.double_value (); | 2297 double val = val_cache.double_value (); |
2298 | 2298 |
2299 if (val_cache) | 2299 if (val_cache) |
2300 { | 2300 { |
2301 if ((xisnan (val) || xisinf (val) | 2301 if ((xisnan (val) || xisinf (val) |
2302 && (elt->type == 'd' | 2302 || val > INT_MAX || val < INT_MIN) |
2303 || elt->type == 'i' | 2303 && (elt->type == 'd' |
2304 || elt->type == 'c' | 2304 || elt->type == 'i' |
2305 || elt->type == 'o' | 2305 || elt->type == 'c' |
2306 || elt->type == 'x' | 2306 || elt->type == 'o' |
2307 || elt->type == 'X' | 2307 || elt->type == 'x' |
2308 || elt->type == 'u'))) | 2308 || elt->type == 'X' |
2309 || elt->type == 'u')) | |
2309 { | 2310 { |
2310 std::string tfmt = fmt; | 2311 std::string tfmt = fmt; |
2311 | 2312 |
2312 tfmt.replace (tfmt.rfind (elt->type), 1, 1, 's'); | 2313 if (xisnan (val) || xisinf (val)) |
2313 | 2314 { |
2314 const char *tval = xisinf (val) | 2315 tfmt.replace (tfmt.rfind (elt->type), 1, 1, 's'); |
2315 ? (val < 0 ? "-Inf" : "Inf") : "NaN"; | 2316 |
2316 | 2317 const char *tval = xisinf (val) |
2317 retval += do_printf_conv (os, tfmt.c_str (), | 2318 ? (val < 0 ? "-Inf" : "Inf") : "NaN"; |
2318 nsa, sa_1, sa_2, tval); | 2319 |
2320 retval += do_printf_conv (os, tfmt.c_str (), | |
2321 nsa, sa_1, sa_2, tval); | |
2322 } | |
2323 else | |
2324 { | |
2325 tfmt.replace (tfmt.rfind (elt->type), 1, ".f"); | |
2326 | |
2327 retval += do_printf_conv (os, tfmt.c_str (), | |
2328 nsa, sa_1, sa_2, val); | |
2329 } | |
2319 } | 2330 } |
2320 else | 2331 else |
2321 { | 2332 { |
2322 switch (elt->type) | 2333 switch (elt->type) |
2323 { | 2334 { |