tags:

views:

78

answers:

2

(/ 4 3) returns 4/3 as an answer. What is the simplest way to get 1.3...?

+2  A: 

use

(/ 4 3.0)
akf
+9  A: 

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
Kyle Cronin
That's it, exact->inexact. The first isn't really an option because the number is a result of several procedures. Thanks!
Harvey