lib/unitwise/unit.rb in unitwise-2.1.0 vs lib/unitwise/unit.rb in unitwise-2.2.0
- old
+ new
@@ -84,22 +84,22 @@
# Get a scalar value for this unit.
# @param magnitude [Numeric] An optional magnitude on this unit's scale.
# @return [Numeric] A scalar value on a linear scale
# @api public
- def scalar(magnitude = 1.0)
- terms.reduce(1.0) do |prod, term|
+ def scalar(magnitude = 1)
+ terms.reduce(1) do |prod, term|
prod * term.scalar(magnitude)
end
end
# Get a magnitude for this unit based on a linear scale value.
# Should only be used by units with special atoms in it's hierarchy.
# @param scalar [Numeric] A linear scalar value
# @return [Numeric] The equivalent magnitude on this scale
# @api public
def magnitude(scalar = scalar())
- terms.reduce(1.0) do |prod, term|
+ terms.reduce(1) do |prod, term|
prod * term.magnitude(scalar)
end
end
# Multiply this unit by another unit, term, or number.