integer
Factor documentation > Factor handbook > The language > Numbers > Integers
Next:fixnum? ( object -- ? )


Vocabulary
math

Class description
The class of integers, which is a disjoint union of fixnums and bignums.

Definition
IN: math

UNION: integer fixnum bignum ;


Methods
USING: math tools.disassembler.private ;

M: integer (>address) ;


USING: cpu.arm.assembler.private math ;

M: integer (B) { 24 { 1 25 } { 0 26 } { 1 27 } 0 } insn ;


USING: kernel math math.bitwise.private ;

M: integer (bitfield-quot) [ swapd shift bitor ] curry ;


USING: io kernel math serialize serialize.private ;

M: integer (serialize)
[ 122 write1 ]
[ dup 0 < [ neg 109 ] [ 112 ] if write1 serialize-cell ]
if-zero ;


USING: accessors calendar calendar.private kernel math ;

M: integer +day
[
over >date< julian-day-number + julian-day-number>date
[ >>year ] [ >>month ] [ >>day ] tri*
] unless-zero ;


USING: accessors calendar.private kernel math ;

M: integer +hour
[ over hour>> + hours/days [ >>hour ] dip +day ]
unless-zero ;


USING: accessors calendar.private kernel math ;

M: integer +minute
[ over minute>> + minutes/hours [ >>minute ] dip +hour ]
unless-zero ;


USING: accessors calendar.private kernel math ;

M: integer +month
[ over month>> + months/years [ >>month ] dip +year ]
unless-zero ;


USING: accessors calendar.private kernel math ;

M: integer +year [ + ] curry change-year adjust-leap-year ;


USING: kernel math math.functions math.ratios
math.ratios.private ;

M: integer /
[ division-by-zero ] [
dup 0 < [ [ neg ] bi@ ] when 2dup fast-gcd [ /i ] curry
bi@ fraction>
] if-zero ;


USING: kernel math mongodb.msg sequences ;

M: integer <mdb-killcursors-msg>
V{ } clone [ push ] keep <mdb-killcursors-msg> ;


USING: destructors grouping io.pipes io.pipes.private kernel
math sequences ;

M: integer <pipes>
[
[ (pipe) |dispose ] replicate
T{ pipe } [ prefix ] [ suffix ] bi 2 <clumps>
] with-destructors ;


USING: kernel math math.parser math.parser.private sequences ;

M: integer >base
over 0 =
[ 2drop "0" ] [
over 0 >
[ positive>base ]
[ [ neg ] dip positive>base 45 prefix ] if
] if ;


USING: math poker.private ;

M: integer >ckf ;


USING: math math.functions ;

M: integer >fraction 1 ; inline


USING: arrays io.servers io.servers.private math ;

M: integer >insecure internet-server 1array ;


USING: endian math pack ;

M: integer >n-byte-array >endian ;


USING: cpu.ppc.assembler math ;

M: integer B -2 shift 0 0 18 i-insn ;


USING: cpu.ppc.assembler math ;

M: integer BC -2 shift 0 0 16 b-insn ;


USING: cpu.ppc.assembler math ;

M: integer BL -2 shift 0 1 18 i-insn ;


USING: cpu.x86.assembler cpu.x86.assembler.private make math ;

M: integer CALL 232 , 4, ;


USING: cpu.x86.assembler cpu.x86.assembler.private make math ;

M: integer JMP 233 , 4, ;


USING: cpu.x86.assembler.private math ;

M: integer JUMPcc extended-opcode, 4, ;


USING: combinators cpu.x86.assembler cpu.x86.assembler.operands
cpu.x86.assembler.private kernel make math ;

M: integer MOVABS
swap {
{ AL [ 160 , cell, ] }
{ AX [ 102 , 161 , cell, ] }
{ EAX [ 161 , cell, ] }
{ RAX [ 72 , 161 , cell, ] }
[ swap bad-movabs-operands ]
} case ;


USING: cpu.arm.assembler.private math ;

M: integer addressing-mode-2 ;


USING: cpu.arm.assembler.private math math.bitwise ;

M: integer addressing-mode-3
b>n/n { { 1 22 } { 1 7 } { 1 4 } 0 8 } bitfield ;


USING: calendar math ;

M: integer april 4 1 <date> ;


USING: calendar math ;

M: integer august 8 1 <date> ;


USING: calendar math ;

M: integer beginning-of-year <year> ;


USING: alien.data math ;

M: integer binary-zero? zero? ; inline


USING: kernel math math.bitwise math.bitwise.private ;

M: integer bit-count
dup 0 < [ invalid-bit-count-target ] when (bit-count) ;
inline


USING: cuda.libraries.private math ;

M: integer block-dim 1 1 ; inline


USING: kernel math sequences ;

M: integer bounds-check?
dupd length < [ 0 >= ] [ drop f ] if ; inline


USING: kernel math sequences.deep ;

M: integer branch? drop f ;


USING: kernel math regexp.classes ;

M: integer class-member? = ; inline


USING: calendar math sequences ;

M: integer day-name day-names nth ;


USING: calendar.format io kernel math math.parser sequences ;

M: integer day.
number>string dup length 2 < [ bl ] when write ;


USING: calendar kernel math ;

M: integer days-in-year leap-year? 366 365 ? ;


USING: calendar math ;

M: integer december 12 1 <date> ;


USING: kernel math ;

M: integer denominator drop 1 ; inline


USING: calendar kernel math ;

M: integer easter dup easter-month-day <date> ;


USING: effects math math.parser ;

M: integer effect>string number>string ;


USING: calendar math ;

M: integer end-of-year 12 31 <date> ;


USING: alien.enums math ;

M: integer enum>number ;


USING: calendar math ;

M: integer february 2 1 <date> ;


USING: io.files.info.unix.private math math.bitwise ;

M: integer file-mode? mask? ;


USING: cpu.x86.assembler.private math math.order ;

M: integer fits-in-byte? -128 127 between? ;


USING: kernel math math.functions ;

M: integer frexp
[ 0.0 0 ] [
dup 0 > [ 1 ] [ abs -1 ] if swap dup log2 [
52 swap - shift 4503599627370495 bitand
0.5 double>bits bitor bits>double
] [ 1 + ] bi [ * ] dip
] if-zero ; inline


USING: fuel.pprint math prettyprint ;

M: integer fuel-pprint pprint ; inline


USING: cuda.libraries.private math ;

M: integer grid-dim 1 ; inline


USING: kernel math unix unix.ffi unix.groups
unix.groups.private ;

M: integer group-struct
(group-struct)
[ [ getgrgid_r ] unix-system-call drop ] keep
check-group-struct ;


USING: kernel math math.order xml-rpc xml.data
xml.syntax.private ;

M: integer item>xml
dup 31 2^ neg 31 2^ 1 - between?
[ "Integers must fit in 32 bits" throw ] unless 1 nenum T{
xml-chunk
{ seq
V{
""
T{ tag { name ~name~ } { children ~vector~ } }
""
}
}
} interpolate-xml ;


USING: calendar math ;

M: integer january 1 1 <date> ;


USING: calendar math ;

M: integer july 7 1 <date> ;


USING: calendar math ;

M: integer june 6 1 <date> ;


USING: kernel math math.functions ;

M: integer ldexp
2dup [ zero? ] either? [ 2drop 0 ] [ shift ] if ;


USING: calendar kernel math math.functions ;

M: integer leap-year? dup 100 divisor? 400 4 ? divisor? ;


USING: geo-ip interval-maps math ;

M: integer lookup-ip ip-intervals interval-at ;


USING: kernel math mirrors ;

M: integer make-mirror drop f ;


USING: calendar math ;

M: integer march 3 1 <date> ;


USING: calendar math ;

M: integer may 5 1 <date> ;


USING: arrays kernel math regexp.ast regexp.classes regexp.nfa
unicode.categories unicode.data ;

M: integer modify-class
case-insensitive option? [
dup Letter?
[ [ ch>lower ] [ ch>upper ] bi 2array <or-class> ] when
] when ;


USING: calendar calendar.private math sequences ;

M: integer month-name check-month 1 - month-names nth ;


USING: math tools.deploy.test.7 ;

M: integer my-generic sq ;


USING: cpu.x86.assembler.private io.binary make math ;

M: integer n, >le % ;


USING: math math.vectors.simd.intrinsics.private ;

M: integer native/ /i ; inline


USING: math regexp.nfa ;

M: integer nfa-node modify-class add-simple-entry ;


USING: calendar math ;

M: integer november 11 1 <date> ;


USING: math math.hashcodes math.hashcodes.private ;

M: integer number-hashcode 1 hash-fraction ;


USING: math ;

M: integer numerator ; inline


USING: calendar math ;

M: integer october 10 1 <date> ;


USING: kernel math math.parser sequences unix.linux.proc ;

M: integer proc-pid-path
[ "/proc/" ] 2dip [ number>string "/" append ] dip 3append
;


USING: math random random.private ;

M: integer random [ f ] [ random-integer ] if-zero ;


USING: kernel math math.ratios math.ratios.private ;

M: integer recip
1 swap
[ division-by-zero ]
[ dup 0 < [ [ neg ] bi@ ] when fraction> ] if-zero ;


USING: math math.functions ;

M: integer round ; inline


USING: math math.extras ;

M: integer round-to-even ; inline


USING: calendar math ;

M: integer september 9 1 <date> ;


USING: math unix.groups unix.groups.private ;

M: integer set-effective-group (set-effective-group) ;


USING: math unix.users unix.users.private ;

M: integer set-effective-user (set-effective-user) ;


USING: io.files.info.unix kernel math ;

M: integer set-file-group f swap set-file-ids ;


USING: io.files.info.unix math ;

M: integer set-file-user f set-file-ids ;


USING: math unix.groups unix.groups.private ;

M: integer set-real-group (set-real-group) ;


USING: math unix.users unix.users.private ;

M: integer set-real-user (set-real-user) ;


USING: cpu.arm.assembler.private math math.bitwise ;

M: integer shift-imm/reg
{ { 0 4 } 5 { register 0 } 7 } bitfield ;


USING: cpu.arm.assembler cpu.arm.assembler.private math ;

M: integer shifter-op 0 <IMM> shifter-op ;


USING: debugger.unix math sequences ;

M: integer signal-name 1 - signal-names ?nth ;


USING: kernel math threads threads.private ;

M: integer sleep-until
[ self ] dip schedule-sleep "sleep" suspend drop ;


USING: math math.matrices sequences ;

M: integer square-cols iota square-cols ;


USING: math math.matrices sequences ;

M: integer square-rows iota square-rows ;


USING: io json.writer kernel math math.parser ;

M: integer stream-json-print
[ number>string ] [ stream-write ] bi* ;


USING: math summary ;

M: integer summary object-summary ;


USING: cursors kernel math ;

M: integer up/i [ 1 - + ] keep /i ; inline


USING: math unix.groups unix.groups.private unix.users ;

M: integer user-groups user-name (user-groups) ;


USING: assocs kernel math namespaces unix.ffi unix.users ;

M: integer user-passwd
user-cache get
[ at ] [ getpwuid [ passwd>new-passwd ] [ f ] if* ] if* ;


USING: db.queries math ;

M: integer where object-where ;


USING: arrays arrays.shaped math ;

M: integer wrap-shape 1array <uniform-shape> ;


USING: cuda.ptx io math math.parser ;

M: integer write-ptx-operand number>string write ;


USING: arrays calendar.format io kernel math ;

M: integer year.
12 [ 1 + 2array month. nl ] with each-integer ;