Created
January 21, 2023 10:49
-
-
Save raberm/cb7253ae29cabd38c117d4b436561ba8 to your computer and use it in GitHub Desktop.
frexp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float frexp(float x, out float e) | |
{ | |
e = ceil(log2(x)); | |
return(x * exp2(-e)); | |
} | |
x = 0.15625; | |
x = -118.62500; | |
v = Ceiling[Log2[Abs[x]]] - 1 | |
s = -(Sign[x] - 1)/2; | |
r = Round[(Abs[x]*2^-v - 1)*2^23]; | |
{s, v + 127, r} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment