lib/formulae/run/excel_functions.rb in rubyfromexcel-0.0.6 vs lib/formulae/run/excel_functions.rb in rubyfromexcel-0.0.7
- old
+ new
@@ -124,9 +124,17 @@
return decimal_places if iserr(decimal_places)
return :na unless number.is_a?(Numeric)
return :na unless decimal_places.is_a?(Numeric)
(number * 10**decimal_places).floor.to_f / 10**decimal_places
end
+
+ def mod(number,divisor)
+ return number if iserr(number)
+ return divisor if iserr(divisor)
+ return :na unless number.is_a?(Numeric)
+ return :na unless divisor.is_a?(Numeric)
+ number % divisor
+ end
def sum(*args)
flatten_and_inject(args) do |counter,arg|
arg.is_a?(Numeric) ? counter + arg.to_f : counter
end
\ No newline at end of file