mirror of
https://github.com/luau-lang/rfcs.git
synced 2025-04-08 04:20:56 +01:00
Update explicit-accuracy-for-math-round.md
This commit is contained in:
parent
44c56624cf
commit
2079898433
1 changed files with 1 additions and 1 deletions
|
@ -25,7 +25,7 @@ local function round_to( n: number, decimal_places: number? )
|
||||||
end
|
end
|
||||||
print( round_to(3.1415, 2) ) -- Output: 3.14
|
print( round_to(3.1415, 2) ) -- Output: 3.14
|
||||||
```
|
```
|
||||||
The proposed change provides the same level of convenience as the above `round_to` function without impacting the--for lack of a better term--'visual' size of projects. The change is simple: introduce a second parameter to `math.round` which accepts `number?`s.
|
The proposed change provides the same level of convenience as the above `round_to` function without impacting the--for lack of a better term--'visual' size of projects. The change is simple: introduce a second parameter to `math.round` which accepts a `number?`.
|
||||||
```lua
|
```lua
|
||||||
-- proposed change
|
-- proposed change
|
||||||
print( math.round(3.1415, 2) ) -- Output: 3.14
|
print( math.round(3.1415, 2) ) -- Output: 3.14
|
||||||
|
|
Loading…
Add table
Reference in a new issue