Heyyo, I was wondering how I’d turn a decimal such as

→ 0.01333333333334

**into**

→ 0.01

By 3 digit system I mean minimum value would be 0.01 and maximum would be 100 [0.01 - 100]

Thanks, RoGamxr!

Heyyo, I was wondering how I’d turn a decimal such as

→ 0.01333333333334

**into**

→ 0.01

By 3 digit system I mean minimum value would be 0.01 and maximum would be 100 [0.01 - 100]

Thanks, RoGamxr!

```
function check(number)
if number <= 0.01 and number <= 100 then
return true
end
return false
end
print(check(0.01)) -- true
print(check(0.011)) -- false
```

1 Like

Thing is I would also need it to check others like; → 5.3535353535 or smthing like that.

ill call logarithms. theyre a Master when it comes to this.

```
function check(number)
local loggersarepoggers = math.ceil(math.log10(number))
if loggersarepoggers <= 3 and number <= 0.01 and number <= 100 then
return true
end
return false
end
```

just do

```
print(string.format("%.3f", 0.124500)) --> 0.124
```

1 Like

Thank you but I found a method already, thank you!

1 Like

I still think you should mark my post as the solution. “Thank you but I found a method already, thank you!” really wouldn’t help someone looking through this thread down the line.

Also giving yourself solutions is frowned upon

3 Likes

you should still give him the solution. even if you found it out before he posted it. as its unfair

2 Likes

Sorry for getting involved, but -

@TheH0meLands has a point. He gave you a working solution -

```
print(string.format("%.2f", 5.3535353535 )) --> 5.35
print(math.ceil(5.3535353535)) --> 6
```

You should mark his reply as the solution, as it apparently helped solving the issue.

by the way, i just use log and ceil to get the `len`

of the number, not to round it

Mk! That makes sense so I’ll do it. Thanks again!

3 Likes

Yes, this is of course better and more accurate, it was just for the demonstration buddy.

1 Like

here is another method

```
local value1 = 0.01333333333334
local value2 = math.round(value1 * 100) / 100
print(value2)
```

2 Likes