Skip to content

Instantly share code, notes, and snippets.

@ogrisel
Last active October 28, 2022 13:54
Show Gist options
  • Save ogrisel/eb3073db349cdf6445f9631f4fc416d5 to your computer and use it in GitHub Desktop.
Save ogrisel/eb3073db349cdf6445f9631f4fc416d5 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fcharras
Copy link

fcharras commented Oct 28, 2022

float32(np.uint32(x >> uint32(32)) >> uint32(8)) * (float32(1) / float32(uint32(1) << uint32(24))) seems to be better, it seems equivalent to casting an intermediate float64 to float32, without actually materializing the float64 !

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