number library
The quantity package accepts both Dart's num types and the Numbers defined by this
Classes
- Binary
- Represents an integer as a binary number.
- Complex
- Complex numbers have both a real and an imaginary part.
- Decimal
- A number that can be exactly written with a finite number of digits in the decimal system.
- Digit
- Represents a digit in four bits of a single byte. This wastes four bits but that's a decent trade-off for simplicity and better anyway than the 4+ bytes allocated for a regular int.
- Double
- Wraps Dart's core double type, so that it can share a common base type with other Numbers.
- Fraction
- A convenient way to represent fractional numbers.
- Hexadecimal
- Represents an integer as a hexadecimal number.
- Imaginary
- Represents an imaginary number, defined as a number whose square is negative one.
- Integer
- Wraps Dart's core int type, so that it can share a common base type with other Numbers.
- Number
- The abstract base class for all Number types.
- Octal
- Represents an integer as an octal number.
- Precise
-
Preciserepresents an arbitrary precision number. - Real
- Provides a common handle for all Real Numbers.
Extensions
Functions
-
erf(
double x) → double -
Approximate solution for the error function of
x. -
hashObjects(
Iterable< Object> objects) → int - Generates a unique hash for a set of objects.
-
numberToNum(
Number number) → num - Converts a Number to the equivalent num.
-
numToNumber(
num value) → Number -
Converts a num
valueto associated Number object (Integer forints anddoubles that have an integer value, Double for otherdoubles). -
objToNumber(
Object object) → Number -
Converts an
objectto a Number. Theobjectmust be either a num or Number, otherwise an Exception is thrown.
Exceptions / Errors
- NumberException
- The base class for all exceptions thrown in relation to numbers.