diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-10-26 13:32:23 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-12-18 05:54:21 -0500 |
commit | 3e9b745253cdf7299a692a95dceac87d6d0ff82f (patch) | |
tree | 394efe740157dfd42dcb0819e1b5353550e00c3d /compiler | |
parent | 0204b4aa14d66dcdeee7085beb65be9e2b833aa9 (diff) | |
download | haskell-3e9b745253cdf7299a692a95dceac87d6d0ff82f.tar.gz |
primops: Document semantics of Float/Int conversions
Fixes #18840.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/Builtin/primops.txt.pp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/GHC/Builtin/primops.txt.pp b/compiler/GHC/Builtin/primops.txt.pp index de1e98a5fc..7e61678301 100644 --- a/compiler/GHC/Builtin/primops.txt.pp +++ b/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 |