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

[std.fmt] Added parsing support for f80 #20462

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

hmcty
Copy link

@hmcty hmcty commented Jun 30, 2024

Resolves: #19263

Test plan:

  • zig test lib/std/fmt/parse_float.zig passes locally with additional f80 unit tests
  • CI passes

Copy link
Member

@tiehuis tiehuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good.

Can you remove this (no longer needed) check here for float round-tripping? then I will trigger the CI:

if (@bitSizeOf(T) != 80) {

.max_exponent_fast_path_disguised = 46,
.max_mantissa_fast_path = 2 << std.math.floatMantissaBits(T),
// Slow + Eisel-Lemire
.mantissa_explicit_bits = std.math.floatFractionalBits(T),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is clearer if we change the other float types to use floatFractionalBits instead of floatMantissaBits as done here. The value is the same for the other IEEE types.

@@ -72,8 +77,6 @@ pub fn isEightDigits(v: u64) bool {
}

pub fn isDigit(c: u8, comptime base: u8) bool {
std.debug.assert(base == 10 or base == 16);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this?

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 this pull request may close these issues.

std.fmt.parseFloat: add f80 float parsing support
2 participants