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

Correct exponent_max to conform to IEEE definition #38929

Merged
merged 5 commits into from
Dec 20, 2020

Conversation

musm
Copy link
Contributor

@musm musm commented Dec 17, 2020

rebased from #24978

cc @JeffreySarnoff

@musm musm added the domain:maths Mathematical functions label Dec 17, 2020
base/float.jl Outdated Show resolved Hide resolved
base/float.jl Outdated Show resolved Hide resolved
base/float.jl Outdated Show resolved Hide resolved
@musm musm requested a review from simonbyrne December 18, 2020 02:56
base/float.jl Show resolved Hide resolved
@mschauer
Copy link
Contributor

Looks good, also https://juliahub.com reports no additional use.

base/float.jl Outdated Show resolved Hide resolved
base/float.jl Outdated Show resolved Hide resolved
@musm
Copy link
Contributor Author

musm commented Dec 18, 2020

will merge within 48 hours. Original PR was approved by @simonbyrne

@musm musm merged commit 58d6684 into JuliaLang:master Dec 20, 2020
@musm musm deleted the exponentmax branch December 20, 2020 15:48
@goualard-f
Copy link

I do not get it. In Julia 1.6.0, Base.exponent_max still returns the "wrong value", e.g. :

julia> Base.exponent_max(Float64)
1024

@simeonschaub
Copy link
Member

simeonschaub commented Apr 12, 2021

This was merged after 1.6 was branched off. But perhaps this change should be backported?

@goualard-f
Copy link

I needed the correct definition but suffices to know for now that it will eventually make its way to the next release. In the meantime, I can rely on some workaround. Thanks.

ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
* Exponent exponent_max returns actual maximum exponent, not the sentinel.


Co-authored-by: mschauer <[email protected]>
@KristofferC
Copy link
Sponsor Member

This caused https://github.com/FedericoStra/ExactConversions.jl to start failing. Haven't looked into why, they probably just relied on the old behavior for some reason.

@JeffreySarnoff
Copy link
Contributor

There are 3 lines in https://github.com/FedericoStra/ExactConversions.jl that use Base.exponent_max.
The first line in both versions of function maxcommon and the first line of function mincommon.
The current source uses (Base.exponent_max(T)-1) which corrects for the old nonconformant exponent_max.
By removing the -1 from each of the three expressions, their code ought not error with this PR.

@KristofferC
Copy link
Sponsor Member

Thanks for looking into it @JeffreySarnoff

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

Successfully merging this pull request may close these issues.

None yet

7 participants