Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(koan): add a koan about rounding pitfalls #290

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/koans/03_numbers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ defmodule Numbers do
assert Float.round(-5.5674, 3) === ___
end

koan "But beware of floating dragons" do
assert Float.round(2.675, 2) == ___
Goutte marked this conversation as resolved.
Show resolved Hide resolved
end

koan "I want the first and last in the range" do
first..last = Range.new(1, 10)

Expand Down
1 change: 1 addition & 0 deletions test/koans/numbers_koans_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ defmodule NumbersTests do
99.0,
12.34,
{:multiple, [6.0, 5.0, 8.9, -5.567]},
2.67,
{:multiple, [1, 10]},
{:multiple, [true, true, false]},
{:multiple, [true, false]}
Expand Down
Loading