Skip to content

struct Float32
inherits Float

Constants

DIGITS = 6

The number of decimal digits that can be represented without losing precision

EPSILON = 1.19209290e-07_f32

The machine epsilon (difference between 1.0 and the next representable value)

INFINITY = (1_f32 / 0_f32).as(Float32)

MANT_DIGITS = 24

The number of digits that can be represented without losing precision (in base RADIX)

MAX = 3.40282347e+38_f32

Largest finite value

MAX_10_EXP = 38

The maximum possible power of 10 exponent (such that 10**MAX_10_EXP is representable)

MAX_EXP = 128

The maximum possible normal power of 2 exponent

MIN = -3.40282347e+38_f32

Smallest finite value

MIN_10_EXP = -37

The minimum possible power of 10 exponent (such that 10**MIN_10_EXP is representable)

MIN_EXP = -125

The minimum possible normal power of 2 exponent

MIN_POSITIVE = 1.17549435e-38_f32

Smallest representable positive value

NAN = (0_f32 / 0_f32).as(Float32)

RADIX = 2

The radix or integer base used by the internal representation

Class methods

.from_json_object_key?(key : String)

View source

.new!(value)

Returns a Float32 by invoking to_f32! on value.

View source

.new(value)

Returns a Float32 by invoking to_f32 on value.

View source

Methods

#!=(other : UInt128) : Bool

Returns true if self is not equal to other.

View source

#!=(other : Float64) : Bool

Returns true if self is not equal to other.

View source

#!=(other : Float32) : Bool

Returns true if self is not equal to other.

View source

#!=(other : Int8) : Bool

Returns true if self is not equal to other.

View source

#!=(other : Int16) : Bool

Returns true if self is not equal to other.

View source

#!=(other : Int32) : Bool

Returns true if self is not equal to other.

View source

#!=(other : Int64) : Bool

Returns true if self is not equal to other.

View source

#!=(other : Int128) : Bool

Returns true if self is not equal to other.

View source

#!=(other : UInt8) : Bool

Returns true if self is not equal to other.

View source

#!=(other : UInt16) : Bool

Returns true if self is not equal to other.

View source

#!=(other : UInt32) : Bool

Returns true if self is not equal to other.

View source

#!=(other : UInt64) : Bool

Returns true if self is not equal to other.

View source

#*(other : Int8) : self

Returns the result of multiplying self and other.

View source

#*(other : Int16) : self

Returns the result of multiplying self and other.

View source

#*(other : Int32) : self

Returns the result of multiplying self and other.

View source

#*(other : Int64) : self

Returns the result of multiplying self and other.

View source

#*(other : Int128) : self

Returns the result of multiplying self and other.

View source

#*(other : UInt8) : self

Returns the result of multiplying self and other.

View source

#*(other : UInt16) : self

Returns the result of multiplying self and other.

View source

#*(other : UInt32) : self

Returns the result of multiplying self and other.

View source

#*(other : UInt64) : self

Returns the result of multiplying self and other.

View source

#*(other : UInt128) : self

Returns the result of multiplying self and other.

View source

#*(other : Float32) : self

Returns the result of multiplying self and other.

View source

#*(other : Float64) : self

Returns the result of multiplying self and other.

View source

#**(other : Int32)

View source

#**(other : Float32)

View source

#**(other)

View source

#+(other : Float64) : self

Returns the result of adding self and other.

View source

#+(other : Float32) : self

Returns the result of adding self and other.

View source

#+(other : UInt128) : self

Returns the result of adding self and other.

View source

#+(other : UInt64) : self

Returns the result of adding self and other.

View source

#+(other : UInt32) : self

Returns the result of adding self and other.

View source

#+(other : UInt16) : self

Returns the result of adding self and other.

View source

#+(other : UInt8) : self

Returns the result of adding self and other.

View source

#+(other : Int128) : self

Returns the result of adding self and other.

View source

#+(other : Int8) : self

Returns the result of adding self and other.

View source

#+(other : Int16) : self

Returns the result of adding self and other.

View source

#+(other : Int32) : self

Returns the result of adding self and other.

View source

#+(other : Int64) : self

Returns the result of adding self and other.

View source

#-(other : Int8) : self

Returns the result of subtracting self and other.

View source

#-(other : Int16) : self

Returns the result of subtracting self and other.

View source

#-(other : Int32) : self

Returns the result of subtracting self and other.

View source

#-(other : Int64) : self

Returns the result of subtracting self and other.

View source

#-(other : Int128) : self

Returns the result of subtracting self and other.

View source

#-(other : UInt8) : self

Returns the result of subtracting self and other.

View source

#-(other : UInt16) : self

Returns the result of subtracting self and other.

View source

#-(other : UInt32) : self

Returns the result of subtracting self and other.

View source

#-(other : UInt64) : self

Returns the result of subtracting self and other.

View source

#-(other : UInt128) : self

Returns the result of subtracting self and other.

View source

#-(other : Float32) : self

Returns the result of subtracting self and other.

View source

#-(other : Float64) : self

Returns the result of subtracting self and other.

View source

#/(other : Float64) : Float64

View source

#/(other : UInt128) : Float32

View source

#/(other : Int128) : Float32

View source

#/(other : UInt64) : Float32

View source

#/(other : Int64) : Float32

View source

#/(other : UInt32) : Float32

View source

#/(other : Int32) : Float32

View source

#/(other : UInt16) : Float32

View source

#/(other : Int16) : Float32

View source

#/(other : UInt8) : Float32

View source

#/(other : Float32) : Float32

Returns the result of division self and other.

View source

#/(other : BigInt) : BigFloat

View source

#/(other : Int8) : Float32

View source

#<(other : Int128) : Bool

Returns true if self is less than other.

View source

#<(other : Float64) : Bool

Returns true if self is less than other.

View source

#<(other : Float32) : Bool

Returns true if self is less than other.

View source

#<(other : UInt128) : Bool

Returns true if self is less than other.

View source

#<(other : UInt64) : Bool

Returns true if self is less than other.

View source

#<(other : UInt32) : Bool

Returns true if self is less than other.

View source

#<(other : UInt8) : Bool

Returns true if self is less than other.

View source

#<(other : Int8) : Bool

Returns true if self is less than other.

View source

#<(other : Int16) : Bool

Returns true if self is less than other.

View source

#<(other : Int32) : Bool

Returns true if self is less than other.

View source

#<(other : Int64) : Bool

Returns true if self is less than other.

View source

#<(other : UInt16) : Bool

Returns true if self is less than other.

View source

#<=(other : UInt32) : Bool

Returns true if self is less than or equal to other.

View source

#<=(other : Float64) : Bool

Returns true if self is less than or equal to other.

View source

#<=(other : Float32) : Bool

Returns true if self is less than or equal to other.

View source

#<=(other : UInt128) : Bool

Returns true if self is less than or equal to other.

View source

#<=(other : UInt64) : Bool

Returns true if self is less than or equal to other.

View source

#<=(other : UInt16) : Bool

Returns true if self is less than or equal to other.

View source

#<=(other : UInt8) : Bool

Returns true if self is less than or equal to other.

View source

#<=(other : Int128) : Bool

Returns true if self is less than or equal to other.

View source

#<=(other : Int64) : Bool

Returns true if self is less than or equal to other.

View source

#<=(other : Int32) : Bool

Returns true if self is less than or equal to other.

View source

#<=(other : Int16) : Bool

Returns true if self is less than or equal to other.

View source

#<=(other : Int8) : Bool

Returns true if self is less than or equal to other.

View source

#==(other : Float64) : Bool

Returns true if self is equal to other.

View source

#==(other : UInt32) : Bool

Returns true if self is equal to other.

View source

#==(other : Int8) : Bool

Returns true if self is equal to other.

View source

#==(other : Int16) : Bool

Returns true if self is equal to other.

View source

#==(other : Int32) : Bool

Returns true if self is equal to other.

View source

#==(other : Int64) : Bool

Returns true if self is equal to other.

View source

#==(other : Int128) : Bool

Returns true if self is equal to other.

View source

#==(other : UInt8) : Bool

Returns true if self is equal to other.

View source

#==(other : UInt16) : Bool

Returns true if self is equal to other.

View source

#==(other : UInt64) : Bool

Returns true if self is equal to other.

View source

#==(other : UInt128) : Bool

Returns true if self is equal to other.

View source

#==(other : Float32) : Bool

Returns true if self is equal to other.

View source

#>(other : UInt32) : Bool

Returns true if self is greater than other.

View source

#>(other : UInt64) : Bool

Returns true if self is greater than other.

View source

#>(other : UInt128) : Bool

Returns true if self is greater than other.

View source

#>(other : Float32) : Bool

Returns true if self is greater than other.

View source

#>(other : Int32) : Bool

Returns true if self is greater than other.

View source

#>(other : Float64) : Bool

Returns true if self is greater than other.

View source

#>(other : UInt16) : Bool

Returns true if self is greater than other.

View source

#>(other : UInt8) : Bool

Returns true if self is greater than other.

View source

#>(other : Int128) : Bool

Returns true if self is greater than other.

View source

#>(other : Int64) : Bool

Returns true if self is greater than other.

View source

#>(other : Int16) : Bool

Returns true if self is greater than other.

View source

#>(other : Int8) : Bool

Returns true if self is greater than other.

View source

#>=(other : UInt32) : Bool

Returns true if self is greater than or equal to other.

View source

#>=(other : UInt16) : Bool

Returns true if self is greater than or equal to other.

View source

#>=(other : UInt64) : Bool

Returns true if self is greater than or equal to other.

View source

#>=(other : UInt128) : Bool

Returns true if self is greater than or equal to other.

View source

#>=(other : Float32) : Bool

Returns true if self is greater than or equal to other.

View source

#>=(other : Float64) : Bool

Returns true if self is greater than or equal to other.

View source

#>=(other : UInt8) : Bool

Returns true if self is greater than or equal to other.

View source

#>=(other : Int128) : Bool

Returns true if self is greater than or equal to other.

View source

#>=(other : Int64) : Bool

Returns true if self is greater than or equal to other.

View source

#>=(other : Int32) : Bool

Returns true if self is greater than or equal to other.

View source

#>=(other : Int16) : Bool

Returns true if self is greater than or equal to other.

View source

#>=(other : Int8) : Bool

Returns true if self is greater than or equal to other.

View source

#ceil

View source

#clone

View source

#fdiv(other : Int8) : self

Returns the float division of self and other.

View source

#fdiv(other : Int16) : self

Returns the float division of self and other.

View source

#fdiv(other : Int32) : self

Returns the float division of self and other.

View source

#fdiv(other : Int64) : self

Returns the float division of self and other.

View source

#fdiv(other : Int128) : self

Returns the float division of self and other.

View source

#fdiv(other : UInt8) : self

Returns the float division of self and other.

View source

#fdiv(other : UInt16) : self

Returns the float division of self and other.

View source

#fdiv(other : UInt32) : self

Returns the float division of self and other.

View source

#fdiv(other : UInt64) : self

Returns the float division of self and other.

View source

#fdiv(other : UInt128) : self

Returns the float division of self and other.

View source

#fdiv(other : Float32) : self

Returns the float division of self and other.

View source

#fdiv(other : Float64) : self

Returns the float division of self and other.

View source

#floor

View source

#round_away

Rounds towards the nearest integer. If both neighboring integers are equidistant, rounds away from zero.

View source

#round_even : self

Rounds towards the nearest integer. If both neighboring integers are equidistant, rounds towards the even neighbor (Banker's rounding).

View source

#to_f : Float64

Returns self converted to Float64. Raises OverflowError in case of overflow.

View source

#to_f! : Float64

Returns self converted to Float64. In case of overflow a wrapping is performed.

View source

#to_f32 : Float32

Returns self converted to Float32. Raises OverflowError in case of overflow.

View source

#to_f32! : Float32

Returns self converted to Float32. In case of overflow a wrapping is performed.

View source

#to_f64 : Float64

Returns self converted to Float64. Raises OverflowError in case of overflow.

View source

#to_f64! : Float64

Returns self converted to Float64. In case of overflow a wrapping is performed.

View source

#to_i : Int32

Returns self converted to Int32. Raises OverflowError in case of overflow.

View source

#to_i! : Int32

Returns self converted to Int32. In case of overflow a wrapping is performed.

View source

#to_i128 : Int128

Returns self converted to Int128. Raises OverflowError in case of overflow.

View source

#to_i128! : Int128

Returns self converted to Int128. In case of overflow a wrapping is performed.

View source

#to_i16 : Int16

Returns self converted to Int16. Raises OverflowError in case of overflow.

View source

#to_i16! : Int16

Returns self converted to Int16. In case of overflow a wrapping is performed.

View source

#to_i32 : Int32

Returns self converted to Int32. Raises OverflowError in case of overflow.

View source

#to_i32! : Int32

Returns self converted to Int32. In case of overflow a wrapping is performed.

View source

#to_i64 : Int64

Returns self converted to Int64. Raises OverflowError in case of overflow.

View source

#to_i64! : Int64

Returns self converted to Int64. In case of overflow a wrapping is performed.

View source

#to_i8 : Int8

Returns self converted to Int8. Raises OverflowError in case of overflow.

View source

#to_i8! : Int8

Returns self converted to Int8. In case of overflow a wrapping is performed.

View source

#to_s : String

Returns a string representation of this object.

Descendants must usually not override this method. Instead, they must override to_s(io), which must append to the given IO object.

View source

#to_s(io : IO) : Nil

Appends a String representation of this object to the given IO object.

An object must never append itself to the io argument, as this will in turn call to_s(io) on it.

View source

#to_u : UInt32

Returns self converted to UInt32. Raises OverflowError in case of overflow.

View source

#to_u! : UInt32

Returns self converted to UInt32. In case of overflow a wrapping is performed.

View source

#to_u128 : UInt128

Returns self converted to UInt128. Raises OverflowError in case of overflow.

View source

#to_u128! : UInt128

Returns self converted to UInt128. In case of overflow a wrapping is performed.

View source

#to_u16 : UInt16

Returns self converted to UInt16. Raises OverflowError in case of overflow.

View source

#to_u16! : UInt16

Returns self converted to UInt16. In case of overflow a wrapping is performed.

View source

#to_u32 : UInt32

Returns self converted to UInt32. Raises OverflowError in case of overflow.

View source

#to_u32! : UInt32

Returns self converted to UInt32. In case of overflow a wrapping is performed.

View source

#to_u64 : UInt64

Returns self converted to UInt64. Raises OverflowError in case of overflow.

View source

#to_u64! : UInt64

Returns self converted to UInt64. In case of overflow a wrapping is performed.

View source

#to_u8 : UInt8

Returns self converted to UInt8. Raises OverflowError in case of overflow.

View source

#to_u8! : UInt8

Returns self converted to UInt8. In case of overflow a wrapping is performed.

View source

#trunc

View source