Functions
StaticNumbers.Static — TypeStatic{X} is short-hand for the Union of StaticInteger{X}, StaticReal{X} and StaticNumber{X}.
StaticNumbers.static — Functionstatic(X) is shorthand for StaticInteger{X}(), StaticReal{X}() or StaticNumber{X}(), depending on the type of X.
static(range) converts to a range where all aspects are Static.
StaticNumbers.unstatic — Functionunstatic(x) returns a non-static version of x. This function is rarely needed, as most operations on a static number (e.g. x+0) will yield a non-static result.
StaticNumbers.StaticBool — TypeStaticBool is a shorthand for Union{StaticInteger{false}, StaticInteger{true}}
StaticNumbers.StaticInteger — TypeA StaticInteger is an Integer whose value is stored in the type, and which contains no runtime data.
StaticNumbers.StaticReal — TypeA StaticReal is a Real whose value is stored in the type, and which contains no runtime data.
StaticNumbers.StaticNumber — TypeA StaticNumber is a Number whose value is stored in the type, and which contains no runtime data.
StaticNumbers.StaticOrInt — TypeStaticOrInt is the type union of Int and StaticInteger
(Functions that take only Int may be too restrictive.)
StaticNumbers.StaticOrBool — TypeStaticOrBool can be either a Bool or a StaticBool
StaticNumbers.@generate_static_methods — Macro@generate_static_methods numbers 1argfuns 2argfunsThis macro creates methods that return Static numbers when functions are called with only Static arguments.
The inputs should be a list of literal numbers that will be tested as inputs and outputs of all functions.
Optionally a fourth argument can give a list of numbers that will only be considered as results, but not as inputs.
Example:
@generate_static_methods (0, 1) (sin, cos) (+, -)will create all the following method definitions:
sin(::StaticInteger{0}) = StaticInteger{0}()
cos(::StaticInteger{0}) = StaticInteger{1}()
+(::StaticInteger{0}, ::StaticInteger{0}) = StaticInteger{0}()
+(::StaticInteger{0}, ::StaticInteger{1}) = StaticInteger{1}()
+(::StaticInteger{1}, ::StaticInteger{0}) = StaticInteger{1}()
-(::StaticInteger{0}, ::StaticInteger{0}) = StaticInteger{0}()
-(::StaticInteger{1}, ::StaticInteger{0}) = StaticInteger{0}()
-(::StaticInteger{1}, ::StaticInteger{1}) = StaticInteger{1}()(Note: The macro will run in the local scope. Functions from Base must be imported before they can be extended.)