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

Add PrecisionFromFloat32() to return precision without performing conversion #3

Closed
x448 opened this issue Jan 5, 2020 · 0 comments
Closed

Comments

@x448
Copy link
Owner

x448 commented Jan 5, 2020

It would be useful to know the precision of converting IEEE binary32 to binary16, if the function can be inlined.

PrecisionFromFloat32 should return Precision without performing the conversion.
Conversions from both Infinity and NaN values will always report PrecisionExact even
if NaN payload or NaN-Quiet-Bit is lost.

If this is too complex to be inlined by Go, then make it an extra return value as part of conversion functions.

// Precision indicates whether the conversion to Float16 is
// exact, inexact, underflow, or overflow.
type Precision int

const (
       PrecisionExact Precision = iota
       PrecisionInexact
       PrecisionUnderflow
       PrecisionOverflow
)

func PrecisionFromfloat32(f32 float32) Precision 
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

No branches or pull requests

1 participant