Skip to content

Issue of casting f32 to e4m3mxfp #342

Description

@wonjeon

Hello.
I have the following example to test casting of float number to fp8_e4m3 number:

>>> from bitstring import Bits
>>> f32 = 232.03683398099045
>>> f8 = Bits(e4m3mxfp=f32).e4m3mxfp
>>> f8
224.0
>>> abs(f32-240)
7.963166019009549
>>> abs(f32-224)
8.036833980990451

Why f8 is 224, not 240? The distance from f8 to 240 looks shorter than that to 224. Am I missing anything?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions