Trying to simply get my double rounded to 1 dec place using floor
Var Surfer1Total As Double = Floor(SurferScore1(0)*10)/10
container.StatNum.Text = Surfer1Total.ToText
As I trace this through the program no rounding takes place??
Trying to simply get my double rounded to 1 dec place using floor
Var Surfer1Total As Double = Floor(SurferScore1(0)*10)/10
container.StatNum.Text = Surfer1Total.ToText
As I trace this through the program no rounding takes place??
2 decimal places:
Var Surfer1Total As Double = Floor(SurferScore1(0)*100)/100
see this page:
https://documentation.xojo.com/api/deprecated/deprecated_class_members/xojo.math.floor.html
1 decimal place:
Var Surfer1Total As Double = Floor( SurferScore1(0) * 10 ) / 10
that should just work…
Note the .ToText can format it wrongly if not explictly set.
https://documentation.xojo.com/api/deprecated/deprecated_class_members/double.totext.html
Try this:
Var Surfer1Total As Double = Floor(SurferScore1(0)*10)/10
container.StatNum.Text = Surfer1Total.ToText(Xojo.Core.Locale.Current, "#.0")
Thanks Derk, must have been a .ToText issue