[Gambas-user] Best ways to format float values
Charlie
charlie at ...2793...
Thu Jul 13 11:13:20 CEST 2017
alexchernoff wrote
> Peace to all,
>
> this might a bit silly but what is the best way to format float values
> like 26.6601666666666 into having two digits AND/OR with rounding them?
>
> e.g.
> 26.6601666666666 becomes 26.66 shortened
> 26.6601666666666 becomes 26.67 rounded
>
> cheers!
You said 'Format' so you could use: -
Print Format("26.6601666666666", "#.00") '26.66
Print Format("26", "#.00") '26.00
Print Format("1.533", "#.00") '1.53
-----
Check out www.gambas.one
--
View this message in context: http://gambas.8142.n7.nabble.com/Best-ways-to-format-float-values-tp59733p59740.html
Sent from the gambas-user mailing list archive at Nabble.com.
More information about the User
mailing list