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

Fix numeric_limits digits for NVFP8/6/4 #4070

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davebayer
Copy link
Contributor

This PR fixes numeric_limits::digits for NVFP8/6/4 types.

The digits static member should have the value of mant_nbits + 1.

@davebayer davebayer requested a review from a team as a code owner March 10, 2025 12:35
@davebayer davebayer requested a review from griwes March 10, 2025 12:35
Copy link

copy-pr-bot bot commented Mar 10, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@@ -194,9 +194,9 @@ class __numeric_limits_impl<__nv_fp8_e4m3, __numeric_limits_type::__floating_poi
static constexpr bool is_specialized = true;

static constexpr bool is_signed = true;
static constexpr int digits = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

I am actually not sure whether this change is correct.

From cppreference:

For floating-point types, this is the digits of the mantissa (for IEC 559/IEEE 754 implementations, this is the number of digits stored for the mantissa plus one, because the mantissa has an implicit leading 1 and binary point).

These types return false for is_iec559 so I guess digits should be equal to the digits of the mantissa, which in this case is 3 not 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants