Spec-Zone.ru › Dart 2

dart:core

num class

An integer or floating-point number.

It is a compile-time error for any type other than int or double to attempt to extend or implement num.

See also:

  • int: An integer number.
  • double: A double-precision floating point number.
  • Numbers in A tour of the Dart language.
Implemented types
  • Comparable<num>
Implementers
  • double
  • int

Constructors

num()

Properties

hashCode → int
read-onlyoverride
Returns a hash code for a numerical value.
isFinite → bool
read-only
Whether this number is finite.
isInfinite → bool
read-only
Whether this number is positive infinity or negative infinity.
isNaN → bool
read-only
Whether this number is a Not-a-Number value.
isNegative → bool
read-only
Whether this number is negative.
runtimeType → Type
read-onlyinherited
A representation of the runtime type of the object.
sign → num
read-only
Negative one, zero or positive one depending on the sign and numerical value of this number.

Methods

abs() → num
The absolute value of this number.
ceil() → int
The least integer no smaller than this.
ceilToDouble() → double
Returns the least double integer value no smaller than this.
clamp(num lowerLimit, num upperLimit) → num
Returns this num clamped to be in the range lowerLimit-upperLimit.
compareTo(num other) → int
override
Compares this to other.
floor() → int
The greatest integer no greater than this number.
floorToDouble() → double
Returns the greatest double integer value no greater than this.
noSuchMethod(Invocation invocation) → dynamic
inherited
Invoked when a non-existent method or property is accessed.
remainder(num other) → num
The remainder of the truncating division of this by other.
round() → int
The integer closest to this number.
roundToDouble() → double
The double integer value closest to this value.
toDouble() → double
This number as a double.
toInt() → int
Truncates this num to an integer and returns the result as an int.
toString() → String
override
The shortest string that correctly represents this number.
toStringAsExponential([int? fractionDigits]) → String
An exponential string-representation of this number.
toStringAsFixed(int fractionDigits) → String
A decimal-point string-representation of this number.
toStringAsPrecision(int precision) → String
A string representation with precision significant digits.
truncate() → int
The integer obtained by discarding any fractional digits from this.
truncateToDouble() → double
Returns the double integer value obtained by discarding any fractional digits from the double value of this.

Operators

operator %(num other) → num
Euclidean modulo of this number by other.
operator *(num other) → num
Multiplies this number by other.
operator +(num other) → num
Adds other to this number.
operator -(num other) → num
Subtracts other from this number.
operator /(num other) → double
Divides this number by other.
operator <(num other) → bool
Whether this number is numerically smaller than other.
operator <=(num other) → bool
Whether this number is numerically smaller than or equal to other.
operator ==(Object other) → bool
override
Test whether this value is numerically equal to other.
operator >(num other) → bool
Whether this number is numerically greater than other.
operator >=(num other) → bool
Whether this number is numerically greater than or equal to other.
operator unary-() → num
The negation of this value.
operator ~/(num other) → int
Truncating division operator.

Static Methods

parse(String input, [num onError(String input)?]) → num
Parses a string containing a number literal into a number.
tryParse(String input) → num?
Parses a string containing a number literal into a number.

© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.19.6/dart-core/num-class.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API