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

Bug: Rounding Error in Tests #910

Closed
elbow-jason opened this issue May 15, 2024 · 1 comment
Closed

Bug: Rounding Error in Tests #910

elbow-jason opened this issue May 15, 2024 · 1 comment

Comments

@elbow-jason
Copy link
Contributor

Hi all!

It seems that I have encountered a rounding error. While this is certainly a bug, I don't consider it to be very significant; maybe the least significant.

When I run tests with mix test on main I get a failed test:

1) doctest Explorer.DataFrame.summarise/2 (175) (Explorer.DataFrameTest)
     test/explorer/data_frame_test.exs:9
     Doctest failed
     doctest:
       iex> df = Explorer.Datasets.iris()
       iex> Explorer.DataFrame.summarise(df, mean_petal_length: mean(petal_length))
       #Explorer.DataFrame<
         Polars[1 x 1]
         mean_petal_length f64 [3.758666666666666]
       >
     code:  inspect(Explorer.DataFrame.summarise(df, mean_petal_length: mean(petal_length))) === "#Explorer.DataFrame<\n  Polars[1 x 1]\n  mean_petal_length f64 [3.758666666666666]\n>"
     left:  "#Explorer.DataFrame<\n  Polars[1 x 1]\n  mean_petal_length f64 [3.758666666666667]\n>"
     right: "#Explorer.DataFrame<\n  Polars[1 x 1]\n  mean_petal_length f64 [3.758666666666666]\n>"
     stacktrace:
       lib/explorer/data_frame.ex:5399: Explorer.DataFrame (module)

My machine is MacBook M1 on Sonoma 14.1.1 (23B81):

$ uname -a
Darwin Jasons-MacBook-Pro.local 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct  9 21:28:12 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T8103 arm64

Versions:

$ rustc --version
rustc 1.78.0-nightly (397937d81 2024-02-22)
$ iex
Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]

Interactive Elixir (1.15.7) - press Ctrl+C to exit (type h() ENTER for help)
asdf current erlang
erlang          26.2.1          /Users/jason/.tool-versions

Let me know if I need to provide more data about my setup.

@josevalim
Copy link
Member

This is somewhat expected for floats. Maybe we should round the value a bit to avoid such cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants