Skip to content

Float division by zero is not constant-folded

If I do

module Lib where

f :: Float
f = 0.0/0.0

Then I see in the resulting Core:

f = case GHC.Prim.divideFloat# 0.0# 0.0# of wild2_aCm
    { __DEFAULT ->
    GHC.Types.F# wild2_aCm
    }

Rather than a literal for NaN (do we have those?). Division by other constants seems to work.

Edited by Matthew Pickering
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information