unwitch-3.0.0: converts between primitives
Safe HaskellNone
LanguageHaskell2010

Unwitch.Convert.Word64

Description

Conversions from Word64.

Synopsis

Conversions

toFloat :: Word64 -> Either Overflows Float Source #

Checked conversion, fails with Overflow if outside exact float integer range.

toDouble :: Word64 -> Either Overflows Double Source #

Checked conversion, fails with Overflow if outside exact double integer range.

toCInt :: Word64 -> Maybe CInt Source #

Narrowing conversion via Int32, fails if outside Int32 range.

Unboxed conversions

These use GHC unboxed types and unboxed sums for zero-allocation failure handling. Requires the MagicHash, UnboxedSums and UnboxedTuples language extensions. See the GHC manual on unboxed types.

toWord8# :: Word64 -> (# Word8 | (# #) #) Source #

Unsigned narrowing via Word64# comparison

toWord16# :: Word64 -> (# Word16 | (# #) #) Source #

Unsigned narrowing via Word64# comparison

toWord32# :: Word64 -> (# Word32 | (# #) #) Source #

Unsigned narrowing via Word64# comparison

toWord# :: Word64 -> (# Word | (# #) #) Source #

Roundtrip check at Word64# level

toInt8# :: Word64 -> (# Int8 | (# #) #) Source #

Check upper bound at Word64# level

toInt16# :: Word64 -> (# Int16 | (# #) #) Source #

Check upper bound for Int16

toInt32# :: Word64 -> (# Int32 | (# #) #) Source #

Check upper bound for Int32

toInt64# :: Word64 -> (# Int64 | (# #) #) Source #

Check high bit not set for Int64

toInt# :: Word64 -> (# Int | (# #) #) Source #

Check fits in non-negative Int range

toFloat# :: Word64 -> (# Overflows | Float #) Source #

Bounds-checked float conversion at Word64# level

toDouble# :: Word64 -> (# Overflows | Double #) Source #

Bounds-checked double conversion at Word64# level