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

Sections using Base.Grisu need to be rewritten #24

Closed
dmbates opened this issue Sep 7, 2020 · 10 comments · Fixed by #25
Closed

Sections using Base.Grisu need to be rewritten #24

dmbates opened this issue Sep 7, 2020 · 10 comments · Fixed by #25

Comments

@dmbates
Copy link
Contributor

dmbates commented Sep 7, 2020

As of JuliaLang/julia#32859 Base.Grisu has been removed from Julia and the sections of Showoff that depend on Grisu will need to be rewritten, I believe.

@dmbates
Copy link
Contributor Author

dmbates commented Sep 7, 2020

Actually, I see from the News file changes that Grisu was replaced by Ryu in version 1.4

The `Base.Grisu` code has been officially removed (float printing was switched to the ryu algorithm code in 1.4)

@quinnj
Copy link

quinnj commented Sep 10, 2020

Luckily, it looks like a lot of the code can be simplified with the new Printf.format(::Printf.format, args...) functionality. It allows avoiding the @sprintf macro usage and dynamically formatting things much easier.

@jw3126
Copy link

jw3126 commented Sep 14, 2020

@quinnj can Printf also help with the following:

@test showoff([1, 1e39]) == ["1×10⁰", "1×10³⁹"]

@quinnj
Copy link

quinnj commented Sep 16, 2020

What are you hoping Printf can do for you there? (sorry, I'm not familiar w/ showoff at all)

@jw3126
Copy link

jw3126 commented Sep 16, 2020

Something like this:

function showoff(x)
    # trivial code
    intermediate = Printf.nontrivial(...)
    # trivial code
end
@test showoff(1e-39) == "1×10³⁹"

For instance if nontrivial could decompose 1.234e-39::Float64 into e.g. (mantissa=[1,2,3,4], exponent=-39, sign=:+) that would be great.

@quinnj
Copy link

quinnj commented Sep 16, 2020

Not that I can tell; it's really just for printing things to a buffer and it's pretty highly optimized for that, so it doesn't really do any decomposing.

@jw3126
Copy link

jw3126 commented Sep 16, 2020

So one way or another we need to pass from 1.234e-39 to the decimal representation of the mantissa and the exponent. AFAICT Grisu.grisu was the non trivial piece in doing this and now I am sure, what it should be replaced by?

@KristofferC
Copy link
Contributor

Grisu.grisu was the non trivial piece in doing this and now I am sure, what it should be replaced by?

Copy paste whatever you need from Grisu into here?

@KristofferC
Copy link
Contributor

@jw3126
Copy link

jw3126 commented Sep 21, 2020

Thanks @KristofferC !

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

Successfully merging a pull request may close this issue.

4 participants