Mercurial > octave
changeset 25602:8f8d3fef29a8
num2str.m: Update Matlab Compatibility BIST tests (bug #36133).
* num2str.m: Update Matlab Compatibility BIST tests to reflect behavior in
2018A release.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 13 Jul 2018 08:54:12 -0700 |
parents | a8325f2361c7 |
children | e55fb9685803 |
files | scripts/general/num2str.m |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/general/num2str.m Fri Jul 13 02:57:33 2018 -0400 +++ b/scripts/general/num2str.m Fri Jul 13 08:54:12 2018 -0700 @@ -241,10 +241,14 @@ ## Clear shared variables %!shared -## FIXME: Integers greater than flintmax() - 1 should be masked to show just -## 16 digits of precision. -%!test <36133> -%! assert (num2str (1e23), "100000000000000000000000"); +## FIXME: Integers greater than 1e15 should switch to exponential notation +%!assert <36133> (num2str (1e15), "1000000000000000") +%!assert <36133> (num2str (1e16), "1e+16") +## Even exact integers in IEEE notation should use exponential notation +%!assert <36133> (num2str(2^512), "1.34078079299426e+154"); +## Mixed integer/floating point arrays +%!assert <36133> (num2str ([2.1, 1e23, pi]), +%! "2.1 9.999999999999999e+22 3.141592653589793") ## Test for extra rows generated from newlines in format %!assert <*44864> (rows (num2str (magic (3), "%3d %3d %3d\n")), 3)