Bobb1118
|
  |
| Joined: 03 Oct 2008 |
| Total Posts: 476 |
|
|
| 23 May 2013 12:25 PM |
Value = 12.35654356 Value2 = 1.3421
want Value to = 12.37 and Value2 to = 1.34
how D:
since it could be variable length i cant use string sub |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 23 May 2013 12:44 PM |
umm how would 12.35654356 round to 12.37?
function round2(x) return math.floor(x*100+.5)/100 end
print(round2(12.35654356))
-> 12.36 |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 23 May 2013 12:45 PM |
| Because, obeying the normal rules of Maths, the digit after the number you're rounding to has to increase by one if it's more than 5. |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 23 May 2013 12:47 PM |
| duh check the number again |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 23 May 2013 12:49 PM |
12.35654356
12.356
Rounded to hundredths:
12.36
|
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 23 May 2013 12:50 PM |
| yes now read my post again |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
| |
|
Bobb1118
|
  |
| Joined: 03 Oct 2008 |
| Total Posts: 476 |
|
|
| 23 May 2013 12:58 PM |
yah i pushed the wrong key. anyway i figured it out
math.floor(n * 10^p + .5)/10^p
n = number p = number of places to show after decimal
now i have this issue
CurrentStat = Attack
Stats.Level.Text = [CurrentStat]..": "..[CurrentStat].MinLevel.Value.."/"..[CurrentStat].Level.Value
should read Attack: # / #
just keeps erroring "unexpected symbol near [" |
|
|
| Report Abuse |
|
|
Bobb1118
|
  |
| Joined: 03 Oct 2008 |
| Total Posts: 476 |
|
|
| 23 May 2013 01:01 PM |
again nevermind.
have to have a path beforhand |
|
|
| Report Abuse |
|
|