mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Merge branch 'main' into auto-snake-case
This commit is contained in:
commit
cd0e2a4474
24 changed files with 95 additions and 51 deletions
|
@ -874,7 +874,7 @@ map_with_index_help = \src, dest, func, index, length ->
|
|||
## All of these options are compatible with the others. For example, you can use `At` or `After`
|
||||
## with `start` regardless of what `end` and `step` are set to.
|
||||
range : _
|
||||
range = \{ start, end, step ? 0 } ->
|
||||
range = \{ start, end, step ?? 0 } ->
|
||||
{ calc_next, step_is_positive } =
|
||||
if step == 0 then
|
||||
when T(start, end) is
|
||||
|
|
|
@ -617,8 +617,8 @@ is_gte : Num a, Num a -> Bool
|
|||
##
|
||||
## If either argument is [*NaN*](Num.is_nan), returns `Bool.false` no matter what. (*NaN*
|
||||
## is [defined to be unordered](https://en.wikipedia.org/wiki/NaN#Comparison_with_NaN).)
|
||||
is_approx_eq : Frac a, Frac a, { rtol ? Frac a, atol ? Frac a } -> Bool
|
||||
is_approx_eq = \x, y, { rtol ? 0.00001, atol ? 0.00000001 } ->
|
||||
is_approx_eq : Frac a, Frac a, { rtol ?? Frac a, atol ?? Frac a } -> Bool
|
||||
is_approx_eq = \x, y, { rtol ?? 0.00001, atol ?? 0.00000001 } ->
|
||||
eq = x <= y && x >= y
|
||||
meets_tolerance = Num.abs_diff(x, y) <= Num.max(atol, (rtol * Num.max(Num.abs(x), Num.abs(y))))
|
||||
eq || meets_tolerance
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue