decimal
decimal copied to clipboard
How to force decimals?
NewFromFloat(5.45600).Round(4).String() // output: "5.4560"
// I want output in the following format
NewFromFloat(5).Round(4).String() // output: "5.0000"
Hi! Currently, the are two ways to achieve that. Both are not the most elegant, but they work :D
NewFromFloat(5.45600).Truncate(0).Round(4).String() // output: "5.0000"
NewFromFloat(5.45600).Round(0).Round(4).String() // output: "5.0000"
Hopefully, I understood your question correctly. If no, please let me know. :D