Method: Joules.power_v5
- Defined in:
- lib/joules/electricity.rb
.power_v5(voltage, resistance) ⇒ Float
Note:
There are four other methods for calculating power.
Calculates the power given voltage and resistance.
298 299 300 301 302 303 304 |
# File 'lib/joules/electricity.rb', line 298 def power_v5(voltage, resistance) if resistance.zero? raise ZeroDivisionError.new('divided by 0') else return (voltage ** 2.0) / resistance end end |