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

docs: warn against @big_str not obeying rounding mode or precision #50800

Merged
merged 1 commit into from
Aug 20, 2023

Conversation

nsajko
Copy link
Contributor

@nsajko nsajko commented Aug 4, 2023

One of the big pitfalls when using BigFloat.

@brenhinkeller brenhinkeller added the domain:docs This change adds or pertains to documentation label Aug 5, 2023
@rfourquet
Copy link
Member

rfourquet commented Aug 9, 2023

The intent is good, but I feel the wording must be improved. Indeed it says

As a macro, @big_str can't obey the global rounding mode or precision settings.
I.e., it is not affected by setprecision

But it is affected by the global precision setting:

julia> precision(big"1.2")
256

julia> setprecision(10)
10

julia> precision(big"1.2")
10

I think what you meant is that due to the way macros are evaluated, the global precision which is used is the one at play when the code is loaded rather than evaluated.
I.e. in a new session

julia> setprecision(20) do
           precision(big"1.2")
       end
256

One of the big pitfalls when using `BigFloat`.
@nsajko
Copy link
Contributor Author

nsajko commented Aug 20, 2023

ping

@oscardssmith oscardssmith merged commit 96e5b62 into JuliaLang:master Aug 20, 2023
5 of 7 checks passed
@nsajko nsajko deleted the big_str branch August 20, 2023 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:bignums BigInt and BigFloat domain:docs This change adds or pertains to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants