class Novika::Decimal
- Novika::Decimal
- Reference
- Object
Overview
A representation for decimal numbers inside Novika.
Included Modules
Defined in:
novika/forms/decimal.crConstructors
Class Method Summary
Instance Method Summary
-
#%(other : Decimal) : Decimal
Returns the remainder of this and other decimal numbers.
-
#&(other : Decimal) : Decimal
Combines this and other decimals using bitwise and.
-
#*(other : Decimal) : Decimal
Returns the product of this and other decimal numbers.
-
#**(other : Decimal) : Decimal
Raises this decimal to the power of other.
-
#+(other : Decimal) : Decimal
Returns the sum of this and other decimal numbers.
-
#-(other : Decimal) : Decimal
Returns the difference between this and other decimal numbers.
-
#/(other : Decimal) : Decimal
Returns the quotient of this and other decimal numbers.
-
#<(other : Decimal) : Bool
Returns whether this decimal is smaller than other.
-
#==(other : self)
Returns
true
if this reference is the same as other. -
#|(other : Decimal) : Decimal
Combines this and other decimals using bitwise or.
-
#bitcount : Decimal
Returns the number of bits in this decimal.
-
#ceil : Decimal
Rounds this decimal up.
-
#chr : Char
Returns the character corresponding to this decimal.
-
#desc(io : IO)
Appends a string description of this form to io.
-
#each_bit(& : Decimal -> )
Yields each bit in this decimal.
-
#floor : Decimal
Rounds this decimal down.
-
#hash(hasher)
See
Object#hash(hasher)
-
#i64?
Returns whether this decimal is in the bounds of
Int64
. -
#in(*ranges) : Decimal
Asserts this decimal is in one of ranges.
-
#int : Decimal
Asserts this decimal is an integer.
-
#integer?
Returns whether this decimal is an integer.
-
#nth_ls_bit(n : Decimal) : Decimal
Returns n-th least significant bit
-
#nth_ms_bit?(n : Decimal) : Decimal | Nil
Returns n-th most significant bit
-
#posint : Decimal
Asserts this decimal is a positive integer (i.e., >= 0).
-
#rad_cos : Decimal
Treats this decimal as radians, and returns cosine.
-
#rad_sin : Decimal
Treats this decimal as radians, and returns cosine.
-
#round : Decimal
Rounds this decimal.
-
#sqrt : Decimal
Returns the square root of this decimal.
- #to_f32(*args, **options)
- #to_f32(*args, **options, &)
- #to_f64(*args, **options)
- #to_f64(*args, **options, &)
-
#to_i : Int32
Downgrades this decimal into an integer (
Int32
). - #to_i16(*args, **options)
- #to_i16(*args, **options, &)
- #to_i32(*args, **options)
- #to_i32(*args, **options, &)
- #to_i64(*args, **options)
- #to_i64(*args, **options, &)
- #to_i8(*args, **options)
- #to_i8(*args, **options, &)
- #to_s(io)
- #to_u16(*args, **options)
- #to_u16(*args, **options, &)
- #to_u32(*args, **options)
- #to_u32(*args, **options, &)
- #to_u64(*args, **options)
- #to_u64(*args, **options, &)
- #to_u8(*args, **options)
- #to_u8(*args, **options, &)
-
#trunc : Decimal
Truncates this decimal.
-
#zero? : Bool
Returns whether this decimal is zero.
Instance methods inherited from module Novika::Form
a(type : T.class) : T forall T
a,
desc(io : IO)desc : String desc, die(details : String) die, effect(io)
effect effect, on_open(engine : Engine) : self on_open, on_parent_open(engine : Engine) : self on_parent_open, onto(block : Block) : self onto, sel(a, b) sel, to_quote : Quote to_quote
Instance methods inherited from module Novika::Schedulable
schedule(engine : Engine, stack : Block)
schedule,
schedule!(engine : Engine, stack : Block)
schedule!
Constructor Detail
Class Method Detail
Instance Method Detail
Returns the remainder of this and other decimal numbers.
Combines this and other decimals using bitwise and.
Returns the product of this and other decimal numbers.
Returns the difference between this and other decimal numbers.
Returns the quotient of this and other decimal numbers.
Returns true
if this reference is the same as other. Invokes same?
.
Appends a string description of this form to io.
Asserts this decimal is in one of ranges. Dies if it isn't.
Asserts this decimal is a positive integer (i.e., >= 0). Dies if it isn't.