Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Math

puts Math.sqrt(4) # square root
puts Math.cbrt(8) # cube root
puts 4 ** 0.5
puts 8 ** (1/3)
puts Math.hypot(3, 4) # hypotenuse (Pythagoras)

puts Math.max(3, 10) # for only 2 values
puts Math.min(3, 10) # for only 2 values