Skip to content

Commit

Permalink
@sym/prevprime: added prevprime (fixes #722)
Browse files Browse the repository at this point in the history
Added input check and some error tests
  • Loading branch information
nvs-abhilash committed Jan 15, 2017
1 parent a2ad71a commit 853450c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions inst/@sym/prevprime.m
Expand Up @@ -38,6 +38,8 @@

function y = prevprime(x)

if (nargin ~= 1) print_usage () end

%y = elementwise_op ('prevprime', x);

% workaround as upstream SymPy returns int, not sym
Expand All @@ -50,6 +52,9 @@
%!assert (isequal (prevprime(sym(20)), 19));
%!assert (isequal (prevprime(sym([3 5 10])), [2 3 7]));

%!error(prevprime(sym(2)))
%!error(prevprime(sym(-2)))

%!test
%! % result is a sym
%! p = prevprime(sym(3));
Expand Down

0 comments on commit 853450c

Please sign in to comment.