(/ 4 3) returns 4/3 as an answer. What is the simplest way to get 1.3...?
An easy way would be to make sure that one of the numbers in the calculation is already a floating-point number:
> (/ 4.0 3)
1.3333333333333333
Another way would be to use exact->inexact
:
> (exact->inexact (/ 4 3))
1.3333333333333333
use
(/ 4 3.0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With