Agreed: this is an upstream issue.  Thanks for forwarding.

More info/thoughts.

Plain old

  floor $ sqrt (-1)

manifests the issue.

Similar phenomena occur with ceiling instead of floor, and with Inf
instead of Nan.

  Prelude> ceiling $ 1/0
  
179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216

  Prelude> floor $ sqrt (-10^6) :: Int
  0

  Prelude> floor $ sqrt (-10^6) :: Integer
  
-269653970229347386159395778618353710042696546841345985910145121736599013708251444699062715983611304031680170819807090036488184653221624933739271145959211186566651840137298227914453329401869141179179624428127508653257226023513694322210869665811240855745025766026879447359920868907719574457253034494436336205824

It seems to me that the function that converts the RealFloat NaN or
Inf into a RealFrac should yield (error "NaN") or (error "Inf").  As
things stand, this is begging for silently incorrect numeric results.

                                        --Barak.
--
Barak A. Pearlmutter
 Hamilton Institute & Dept Comp Sci, NUI Maynooth, Co. Kildare, Ireland
 http://www.bcl.hamilton.ie/~barak/



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to