Method: CMath.log2
- Defined in:
- lib/cmath.rb
.log2(z) ⇒ Object
Returns the base 2 logarithm of z
CMath.log2(-1) => (0.0+4.532360141827194i)
98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/cmath.rb', line 98 def log2(z) begin if z.real? and z >= 0 RealMath.log2(z) else log(z) / RealMath.log(2) end rescue NoMethodError handle_no_method_error end end |