Skip to content

Jeffrey-Sarnoff/IntsWithInfinity.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

IntsWithInfinity.jl

Machine Integers augmented with positive and negative Infinities

         least magnitudes             |      greatest magnitudes
:-------------------------------------|:--------------------------------------
 typemin( InfInt16 ) == -Infinity16     | typemax( InfInt16 ) == +Infinity16  
  intmin( InfInt16 )  == typemin(Int16)  |  intmax( InfInt16 )  == typemax(Int16)  
PosInf + PosInf == PosInf - NegInf ==  PosInf
PosInf - PosInf == PosInf + NegInf ==  Unbound
PosInf + NegInf == PosInf - PosInf ==  Unbound
PosInf - NegInf == PosInf + PosInf ==  PosInf

NegInf + PosInf == NegInf - NegInf ==  Unbound
NegInf - PosInf == NegInf + NegInf ==  NegInf
NegInf + NegInf == NegInf - PosInf ==  NegInf
NegInf - NegInf == NegInf + PosInf ==  Unbound

PosInf * PosInf == PosInf / NegInf ==  PosInf
PosInf / PosInf == PosInf * NegInf ==  Unbound
PosInf * NegInf == PosInf / PosInf ==  Unbound
PosInf / NegInf == PosInf * PosInf ==  PosInf

NegInf * PosInf == NegInf / NegInf ==  Unbound
NegInf / PosInf == NegInf * NegInf ==  NegInf
NegInf * NegInf == NegInf / PosInf ==  NegInf
NegInf / NegInf == NegInf * PosInf ==  Unbound

PosInf + Int    == PosInf - Int    == Int + PosInf    ==  PosInf
NegInf + Int    == NegInf - Int    == Int - PosInf    ==  NegInf
PosInf * Int    == PosInf / Int    == Int * PosInf    ==  PosInf
NegInf * Int    == NegInf / Int    == Int * NegInf    ==  NegInf

Int / PosInf    == Int / NegInf    == Zero * Zero     ==  Zero
Zero * PosInf   == Zero * NegInf   == Zero / Zero     ==  Zero

op(x, Unbound)  == op(Unboud, x)   == Unbound
immutable InfInt32{I}
    val::Int32
end

typealias Zero32    InfInt32{ 0}
typealias NonZero32 InfInt32{ 1}
typealias PosInf32  InfInt32{+2}
typealias NegInf32  InfInt32{-2}
typealias Unbound32 InfInt32{ 3}

About

Ints augmented with Infinity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages