-
Notifications
You must be signed in to change notification settings - Fork 39
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
Cov Float32 precision issues #83
Comments
Good catch. See https://github.com/JuliaLang/Statistics.jl/pull/85. BTW, note that only the julia> using Statistics
julia> A = 20*randn(Float32,10_000_000) .+ 100;
julia> cov(A,A)
394.65015f0
julia> var(A)
400.24118f0
julia> var((x for x in A))
394.6492f0
julia> var((x for x in A), mean=mean(A))
394.65015f0 |
Amazing work, thanks @nalimilan! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Julia v1.6 on both mac and linux
While the true variance should be 400 for
A
the estimate fromcov
is way off. In contrast,var
seems to be written in a way that the rounding error does not scale with the number of elements inA
, as it should be.The text was updated successfully, but these errors were encountered: