NumericSuffixes
Shorthand numeric conversions.
Contents
Installation
This package is registered in METADATA.jl and so can be installed using Pkg.add
Pkg.add("NumericSuffixes")
Public Interface
#
NumericSuffixes — Module.
Provides the @suffix macro for generating shorthand numeric conversion suffixes.
Examples
x = 1i8 # Convert `1` to `Int8`. y = 3u32 # Convert `3` to `UInt32`. z = (x + y)r16 # Convert `4` to `Float16`.
Default Suffixes
16 suffixes are provided by default:
i8 --> Int8i16 --> Int16i32 --> Int32i64 --> Int64i128 --> Int128u8 --> UInt8u16 --> UInt16u32 --> UInt32u64 --> UInt64u128 --> UInt128r16 --> Float16r32 --> Float32r64 --> Float64c32 --> Complex32c64 --> Complex64c128 --> Complex128
Additional user defined suffixes can be made using the @suffix macro.
#
NumericSuffixes.@suffix — Macro.
Generate a new numeric suffix named n which converts numbers to type T.
Signature
@suffix n T
Examples
@suffix i8 Int8 x = 1i8 typeof(x) == Int8
More complex conversions can be made using anonymous function syntax:
@suffix t16 x -> trunc(Int16, x) x = 1.2t16 typeof(x) == Int16
Methods
- 
    
@suffix(n::ANY<:Any, T::ANY<:Any)
defined at src/NumericSuffixes.jl:69 
Default Suffixes
Signed Integers
#
NumericSuffixes.i8 — Type.
Numeric suffix for Int8 values.
Methods
- 
    
i8()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
#
NumericSuffixes.i16 — Type.
Numeric suffix for Int16 values.
Methods
- 
    
i16()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
#
NumericSuffixes.i32 — Type.
Numeric suffix for Int32 values.
Methods
- 
    
i32()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
#
NumericSuffixes.i64 — Type.
Numeric suffix for Int64 values.
Methods
- 
    
i64()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
#
NumericSuffixes.i128 — Type.
Numeric suffix for Int128 values.
Methods
- 
    
i128()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
Unsigned Integers
#
NumericSuffixes.u8 — Type.
Numeric suffix for UInt8 values.
Methods
- 
    
u8()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
#
NumericSuffixes.u16 — Type.
Numeric suffix for UInt16 values.
Methods
- 
    
u16()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
#
NumericSuffixes.u32 — Type.
Numeric suffix for UInt32 values.
Methods
- 
    
u32()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
#
NumericSuffixes.u64 — Type.
Numeric suffix for UInt64 values.
Methods
- 
    
u64()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
#
NumericSuffixes.u128 — Type.
Numeric suffix for UInt128 values.
Methods
- 
    
u128()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
Floating Point Numbers
#
NumericSuffixes.r16 — Type.
Numeric suffix for Float16 values.
Methods
- 
    
r16()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
#
NumericSuffixes.r32 — Type.
Numeric suffix for Float32 values.
Methods
- 
    
r32()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
#
NumericSuffixes.r64 — Type.
Numeric suffix for Float64 values.
Methods
- 
    
r64()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
Complex Floating Point Numbers
#
NumericSuffixes.c32 — Type.
Numeric suffix for Complex{Float16} values.
Methods
- 
    
c32()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
#
NumericSuffixes.c64 — Type.
Numeric suffix for Complex{Float32} values.
Methods
- 
    
c64()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.
#
NumericSuffixes.c128 — Type.
Numeric suffix for Complex{Float64} values.
Methods
- 
    
c128()
defined at src/NumericSuffixes.jl:30 
Hiding 1 method defined outside of this package.