Ruby class Numeric interactive
→ Click to get an interactive sample (type in code)
Methods
Querying
Comparing
Converting
polarComplex(-1,0).polar # [1,3.14159] Documentation Playground
[1.4142135623730951, 0.7853981633974483]Other
Integer, Float, Rational, Complex are always frozen (immutable value types)
clonec1=1; c2=c1.clone; c2.frozen? # true Documentation
dup (alias +@)d1=1; d2=d1.dup; d2=+d1; d2.frozen? # true Documentation
step4.step(by: 2, to: 8) {|i| p i } # 4;6;8 Documentation