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

Support hex floating point format in fmt.parseFloat and fmt.print #2047

Closed
tiehuis opened this issue Mar 11, 2019 · 8 comments
Closed

Support hex floating point format in fmt.parseFloat and fmt.print #2047

tiehuis opened this issue Mar 11, 2019 · 8 comments
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@tiehuis
Copy link
Member

tiehuis commented Mar 11, 2019

We should support hexadecimal floating point values in fmt.format and fmt.parseFloat.

For example, the following should hold true.

std.testing.expectEqual(std.fmt.parseFloat(""0x1.999999999999ap-4"), 0.1);

For print as a hexidecimal, a "{x}" format specifier seems most appropriate. Related to #1358 but can be done independently.

@tiehuis tiehuis added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. labels Mar 11, 2019
@tiehuis tiehuis added this to the 0.5.0 milestone Mar 11, 2019
@andrewrk andrewrk added the standard library This issue involves writing Zig code for the standard library. label Mar 11, 2019
@shawnl
Copy link
Contributor

shawnl commented Mar 22, 2019

Ahh, the compiler cheats by using strtod()

@corona10
Copy link
Contributor

corona10 commented May 2, 2019

@tiehuis @shawnl

Hi devs, Is there any progress? Or can I take a look at this issue if no one works on it?

@tiehuis
Copy link
Member Author

tiehuis commented May 2, 2019

No progress on my end, and I am not aware of anyone working this. I think it'll be fine for you to work on this.

@corona10
Copy link
Contributor

corona10 commented May 2, 2019

@tiehuis
Great! I will take a look!

@daurnimator
Copy link
Contributor

@corona10 did you get anywhere with this?

@corona10
Copy link
Contributor

corona10 commented May 3, 2019

@daurnimator Currently not, I will ping you if I am not able to work on this issue. Thanks!

@corona10
Copy link
Contributor

corona10 commented May 6, 2019

@daurnimator If you have any progress with this issue, please handle this issue. For me, this issue might need times.

@andrewrk andrewrk modified the milestones: 0.5.0, 0.6.0 Aug 28, 2019
@andrewrk andrewrk modified the milestones: 0.6.0, 0.7.0 Oct 17, 2019
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Oct 13, 2020
@andrewrk andrewrk modified the milestones: 0.8.0, 0.9.0 Nov 6, 2020
@andrewrk andrewrk modified the milestones: 0.9.0, 0.10.0 May 19, 2021
@arBmind
Copy link
Contributor

arBmind commented May 10, 2022

Both fmt.format and fmt.parseFloat already support hex floats.

@daurnimator This issue can be closed I guess.

@tiehuis tiehuis closed this as completed May 11, 2022
@andrewrk andrewrk modified the milestones: 0.12.0, 0.10.0 May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

No branches or pull requests

6 participants