Skip to content

Floating point exception with quotRemWord2# in NCG

Summary

See this code:

{-# LANGUAGE MagicHash, UnboxedTuples #-}
import GHC.Exts
main =
  let (# q, r #) = quotRemWord2# 7452075036915226192## 12548537408004052033## 59074572230081##
  in print (W# q, W# r)

This prints:

Floating point exception

Compiling with -fllvm works normally:

(16877255057060634841,13773278739368)

Environment

  • GHC version used: 8.10.4 & 9.0.1

Optional:

  • Operating System: Debian 10
  • System Architecture: x86_64
Edited by Jaro Reinders
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information