Class: Toybox::Lang::Double

Inherits:
Object
  • Object
show all

Overview

Double represents a 64-bit floating point number.

To use a double in Monkey C add 'd' to the end of the number.

Examples:

var e = 2.718281828459045d;

Since:

  • 1.0.0

Instance Method Summary collapse

Methods inherited from Object

hashCode, method, weak

Instance Method Details

absToybox::Lang::Double

Get the absolute value of a Double.

Returns:

Since:

  • 1.0.0


5557
5558
# File 'Monkeybrains.rb', line 5557

def abs()
end

equals(object) ⇒ Toybox::Lang::Boolean

Test if an Object instance is equal to another instance of an Object.

Parameters:

Returns:

Since:

  • 1.3.0


5623
5624
# File 'Monkeybrains.rb', line 5623

def equals(object)
end

format(format) ⇒ Toybox::Lang::String

Format a Double using a formatting String.

The formatting string is similar to that available in printf from the C stdio library, though the length option is not available:

"%[flags][width][.precision]specifier"
specifiers
  • d or i - signed decimal integer

  • e - scientific notation (mantissa/exponent) using 'e' character

  • E - scientific notation (mantissa/exponent) using 'E' character

  • f - decimal floating point

  • o - signed octal

  • u - unsigned decimal integer

  • x - unsigned hexadecimal integer

  • X - unsigned hexadecimal integer (capital letters)

flags
  • + - Prepends the result with a plus or minus sign ('+' or '-'), including positive numbers. By default, only negative numbers are preceded with a '-' sign.

  • 0 - Left-pads the number with zeros (0) instead of spaces, where padding is specified (see width sub-specifier).

width

supports only numbers (* is not supported)

.precision

supports only numbers (* is not supported)

Returns:

Since:

  • 1.0.0


5610
5611
# File 'Monkeybrains.rb', line 5610

def format(format)
end

toDoubleToybox::Lang::Double

Convert a Double to a Double.

Returns:

Since:

  • 1.0.0


5563
5564
# File 'Monkeybrains.rb', line 5563

def toDouble()
end

toFloatToybox::Lang::Float

Convert a Double to a Float.

Returns:

Since:

  • 1.0.0


5578
5579
# File 'Monkeybrains.rb', line 5578

def toFloat()
end

toLongToybox::Lang::Long

Convert a Double to a Long.

Returns:

Since:

  • 1.0.0


5584
5585
# File 'Monkeybrains.rb', line 5584

def toLong()
end

toNumberToybox::Lang::Number

Convert a Double to a Number.

The Double value will be rounded toward 0 upon conversion. For example, 6.8 becomes 6 and -5.7 becomes -5.

Returns:

Since:

  • 1.0.0


5572
5573
# File 'Monkeybrains.rb', line 5572

def toNumber()
end

toStringToybox::Lang::String

Convert a Double to a String.

Returns:

Since:

  • 1.0.0


5615
5616
# File 'Monkeybrains.rb', line 5615

def toString()
end