获取不同精度的floatnum
Get floatnum with different precision
JavaScript 具有 toFixed
函数,其作用如下:
3.14159265359.toFixed(4)
> "3.1415"
Racket中有类似的吗?
使用~r
from the racket/format
模块:
> (require racket/format)
> (~r pi #:precision 4)
"3.1416"
JavaScript 具有 toFixed
函数,其作用如下:
3.14159265359.toFixed(4)
> "3.1415"
Racket中有类似的吗?
使用~r
from the racket/format
模块:
> (require racket/format)
> (~r pi #:precision 4)
"3.1416"