neil in gemini space

vlang println truncation - 2024-03-21

i just dabble so i often don't know what i don't know, however...

writing a short v ditty to print golden ratios and areas to optional significant figures. i use println to output.

seems in v println will output 3 digits after the decimal point!! i worked round by converting my float to str.

mut x := 4.123456789012345
places := 7
// not what i want
println('${math.round_sig(x,places):10}') //  4.123
// better:-)
println('${math.round_sig(x,places).str():10}') //  4.1234568

all this may be because i have no idea what i am doing:-)

=> 2024-03-22 - golden.v available for ridicule. | 2024-03-21 - The V Programming Language.


=> return to gemini.mingmengtou.org index page.


neil.gemini@mingmengtou.org

content licensed CC-BY-SA 4.0 unless stated.

=> creative commons licence.

Proxy Information
Original URL
gemini://gemini.mingmengtou.org/2024-03-21-vlang-println-truncation.gmi
Status Code
Success (20)
Meta
text/gemini;lang=en-GB
Capsule Response Time
288.74752 milliseconds
Gemini-to-HTML Time
0.295238 milliseconds

This content has been proxied by September (ba2dc).