Arithmetic/Complex: Difference between revisions

→‎{{header|Ruby}}: CMath is removed from Standard Library since Ruby 2.5
(Added 11l)
(→‎{{header|Ruby}}: CMath is removed from Standard Library since Ruby 2.5)
Line 4,192:
puts 1.0 / a # works, but forces floating-point math
puts 1 / a # might truncate to integer</lang>
 
CMath is a standard library that provides trigonometric and transcendental functions for complex numbers:
 
<lang ruby>require "cmath"
CMath.sqrt(-9) #=> 0+3.0i
CMath.acos(0+3.0i) #=> (1.5707963267948966-1.8184464592320668i)
#etc</lang>
 
=={{header|Rust}}==
1,149

edits