💾 Archived View for gemini.mingmengtou.org › 2024-03-21-vlang-println-truncation.gmi captured on 2024-05-10 at 10:22:47. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

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.