[Git][ghc/ghc][master] primops: Document semantics of Float/Int conversions

Marge Bot gitlab at gitlab.haskell.org
Fri Dec 18 10:54:29 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
3e9b7452 by Ben Gamari at 2020-12-18T05:54:21-05:00
primops: Document semantics of Float/Int conversions

Fixes #18840.

- - - - -


1 changed file:

- compiler/GHC/Builtin/primops.txt.pp


Changes:

=====================================
compiler/GHC/Builtin/primops.txt.pp
=====================================
@@ -627,10 +627,22 @@ primop   IntToWordOp "int2Word#" GenPrimOp Int# -> Word#
    with code_size = 0
 
 primop   IntToFloatOp   "int2Float#"      GenPrimOp  Int# -> Float#
+   {Convert an {\tt Int#} to the corresponding {\tt Float#} with the same
+    integral value (up to truncation due to floating-point precision). e.g.
+    {\tt int2Float# 1# == 1.0#}}
 primop   IntToDoubleOp   "int2Double#"          GenPrimOp  Int# -> Double#
+   {Convert an {\tt Int#} to the corresponding {\tt Double#} with the same
+    integral value (up to truncation due to floating-point precision). e.g.
+    {\tt int2Double# 1# == 1.0##}}
 
 primop   WordToFloatOp   "word2Float#"      GenPrimOp  Word# -> Float#
+   {Convert an {\tt Word#} to the corresponding {\tt Float#} with the same
+    integral value (up to truncation due to floating-point precision). e.g.
+    {\tt word2Float# 1## == 1.0#}}
 primop   WordToDoubleOp   "word2Double#"          GenPrimOp  Word# -> Double#
+   {Convert an {\tt Word#} to the corresponding {\tt Double#} with the same
+    integral value (up to truncation due to floating-point precision). e.g.
+    {\tt word2Double# 1## == 1.0##}}
 
 primop   IntSllOp   "uncheckedIShiftL#" GenPrimOp  Int# -> Int# -> Int#
          {Shift left.  Result undefined if shift amount is not



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3e9b745253cdf7299a692a95dceac87d6d0ff82f

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3e9b745253cdf7299a692a95dceac87d6d0ff82f
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201218/640cb85b/attachment-0001.html>


More information about the ghc-commits mailing list