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

Wrong values when multiplication with scalar? #166

Closed
MichielStock opened this issue Feb 26, 2024 · 3 comments
Closed

Wrong values when multiplication with scalar? #166

MichielStock opened this issue Feb 26, 2024 · 3 comments

Comments

@MichielStock
Copy link

Unless I completely misunderstand how the error propagation is computed, there seems to be something wrong with the decimal points after the values when multiplying with a constant.

julia> r = 10.0 ± 0.9
10.0 ± 0.9

julia> r^2
100.0 ± 18.0

julia> π * r^2
314.0 ± 57.0

julia> π * r.val^2
314.1592653589793

I don't see why the values would be different, as Measurements should only propagate the errors?

@giordano
Copy link
Member

https://juliaphysics.github.io/Measurements.jl/stable/usage/#Measurements-in-the-REPL

julia> Measurements.value(π * r^2), Measurements.uncertainty(π * r^2)
(314.1592653589793, 56.548667764616276)

@giordano giordano closed this as not planned Won't fix, can't repro, duplicate, stale Feb 26, 2024
@MichielStock
Copy link
Author

But it should output 314.2 not 314.0, no?

@giordano
Copy link
Member

https://juliaphysics.github.io/Measurements.jl/stable/usage/#Measurements-in-the-REPL

truncated in order to present two significant digits for the uncertainty:

The second significant digit of the uncertainty is on the unit, and so also the value is truncated at the same level. And to be extra clear, this is only related to printing value to screen to avoid showing superlong unsignificant numbers, but the actual objects retains the full precision.

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