开发者

output format of float

开发者 https://www.devze.com 2023-02-09 21:20 出处:网络
I am using MIT/GNU开发者_如何学运维 Scheme. If I calculate two integers\' quotient and the quotient is float, the output is not a float number, but two number\'s expression, like: 12222222222222232/23

I am using MIT/GNU开发者_如何学运维 Scheme. If I calculate two integers' quotient and the quotient is float, the output is not a float number, but two number's expression, like: 12222222222222232/2344444444412. How can I get a float format output?


Use the exact->inexact function:

(let ((x (/ 5 7)))
    (let ((f (exact->inexact x)))
        (display f)))
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号