float choppedstring - part-cw/lambdanative GitHub Wiki
(float->choppedstring v p)
float->choppedstring converts a float to string. This version always shows precision number of digits, even if this means not showing the complete number.
| Parameter | Description |
|---|---|
| v | Floating point number |
| p | String length desired |
Example
Example 1: Convert the number 100.513 to a string with 2 digits of length
> (float->choppedstring 100.513 2)
"10"
Example 2: Convert the number 7.3 to a string with 2 digits of length
> (float->choppedstring 7.3 2)
"7"
Example 3: Convert the number 3 to a string with 2 digits of length
> (float->choppedstring 3 2)
"3"
Example 4: Convert the number 3.14 to a string with 3 digits of length
> (float->choppedstring 3.14 3)
"3.1"
Example 5: Convert the number 3 to a string with 3 digits of length
> (float->choppedstring 3 3)
"3.0"