Data.Int64
- Package
- purescript-int64
- Repository
- purescript-contrib/purescript-int64
Signed two’s-complement 64-bit integers and operations.
All of the usual arithmetic operations are supplied by typeclass instances.
Usage
import Prelude
import Data.Int64 as Int64
let
hundred = Int64.fromInt 100
billion = Int64.fromInt 1000000000
> hundred * billion
100000000000l
> billion / hundred
10000000l
> hundred + one
101l
> hundred * zero
0l
> Int64.lowBits (hundred * billion)
1215752192
> Int64.highBits (hundred * billion)
23
#fromLowHighBits Source
fromLowHighBits :: Int -> Int -> Int64
Creates an Int64
from low and high bits represented as Int
.
#fromNumber Source
fromNumber :: Number -> Maybe Int64
Creates an Int64
from a Number
value. The number must already be an
integer and fall within the valid range of values for the Int64
type
otherwise Nothing
is returned.
#fromString Source
fromString :: String -> Maybe Int64
Reads an Int64
from a String
value. The number must parse as an integer
and fall within the valid range of values for the Int64
type, otherwise
Nothing
is returned.
#fromStringAs Source
fromStringAs :: Radix -> String -> Maybe Int64
Like fromString
, but the integer can be specified in a different base.
#toStringAs Source
toStringAs :: Radix -> Int64 -> String
Like toString
, but the integer can be specified in a different base.
#toUnsigned Source
toUnsigned :: Int64 -> UInt64
Converts to a UInt64
by casting the bits as a 64-bit unsigned integer.
#complement Source
complement :: Int64 -> Int64
Bitwise NOT.
The
Show
instance will suffix a lowercase ‘l’ for “long”. (SeetoString
.)