Module:Rational: Difference between revisions
m Misc functions |
m Bugfix |
||
Line 255: | Line 255: | ||
-- find max prime in ket notation | -- find max prime in ket notation | ||
function p.max_prime(a) | function p.max_prime(a) | ||
if type(a) == 'number' then | |||
a = p.new(a) | |||
end | |||
if a.nan or a.inf or a.zero then | if a.nan or a.inf or a.zero then | ||
return nil | return nil | ||
Line 271: | Line 274: | ||
-- determine whether the rational number is +- p/q, where p, q are primes OR 1 | -- determine whether the rational number is +- p/q, where p, q are primes OR 1 | ||
function p.is_prime_ratio(a) | function p.is_prime_ratio(a) | ||
if type(a) == 'number' then | |||
a = p.new(a) | |||
end | |||
if a.nan or a.inf or a.zero then | if a.nan or a.inf or a.zero then | ||
return false | return false |