Skip to content

Commit

Permalink
Merge pull request #1291 from gnu-octave/vpa_int
Browse files Browse the repository at this point in the history
vpa: add tests that integers of differencing precision should be non-equal
  • Loading branch information
cbm755 committed Jan 29, 2024
2 parents 76f215d + b0b9d90 commit f5ea38d
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions inst/vpa.m
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,41 @@
%! c = vpa('1524157877488187881');
%! assert (isequal (b, c))

%!test
%! % isequal and other comparisons
%! a = vpa ("2/3", 32);
%! b = vpa ("2/3", 64);
%! assert (~ logical (a == b))
%! assert (~ isequal (a, b))
%! a = vpa ("1/3", 32);
%! b = vpa ("1/3", 64);
%! assert (~ logical (a == b))
%! assert (~ isequal (a, b))
%! a = vpa ("0.1", 32);
%! b = vpa ("0.1", 64);
%! assert (~ logical (a == b))
%! assert (~ isequal (a, b))

%!test
%! % isequal with array: Issue #1285
%! a = vpa ("2/3", 32);
%! b = vpa ("2/3", 64);
%! assert (~ isequal ([a 2*a], [b 2*b]))

%!xtest
%! % non-equality of vpa that "might be" be integers: Issue #1285
%! a = vpa ("123", 32);
%! b = vpa ("123", 64);
%! assert (~ logical (a == b))

%!test
%! % non-equality of vpa that "might be" be integers: Issue #1285
%! if (pycall_sympy__ ('return Version(spver) >= Version("1.12.1")'))
%! a = vpa ("123", 32);
%! b = vpa ("123", 64);
%! assert (~ isequal (a, b))
%! end

%!warning <dangerous> vpa ('sqrt(2.0)');

%!warning <dangerous>
Expand Down

0 comments on commit f5ea38d

Please sign in to comment.