Attributes
Members list
Type members
Classlikes
Implicit class which takes a Double, and using method ~ and an Int parameter, yields a Number with the appropriate degree of fuzziness. This class provides an alternative to having to parse a fuzzy number from a String.
Implicit class which takes a Double, and using method ~ and an Int parameter, yields a Number with the appropriate degree of fuzziness. This class provides an alternative to having to parse a fuzzy number from a String.
Value parameters
- x
-
a Double.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Implicit class which takes a String, and using method ~ and an Int parameter, yields a Number with the appropriate degree of fuzziness. This class provides an alternative to having to parse a fuzzy number from a String. Really, the only function it provides is the ability to put the error bounds after the exponent. It is parallel to FuzzOps except for two differences: the input is a String, and this is is so that trailing zeros in the fractional part don't get ignored, thus messing up the fuzziness; And, secondly, the result of ~ is a Try[Number], not just a Number.
Implicit class which takes a String, and using method ~ and an Int parameter, yields a Number with the appropriate degree of fuzziness. This class provides an alternative to having to parse a fuzzy number from a String. Really, the only function it provides is the ability to put the error bounds after the exponent. It is parallel to FuzzOps except for two differences: the input is a String, and this is is so that trailing zeros in the fractional part don't get ignored, thus messing up the fuzziness; And, secondly, the result of ~ is a Try[Number], not just a Number.
Value parameters
- w
-
a String.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Provides an implicit object for handling operations on Number with fractional, numeric, and ordering capabilities.
Provides an implicit object for handling operations on Number with fractional, numeric, and ordering capabilities.
This implicit object combines the functionality of NumberIsFractional, NumberIsNumeric, and NumberIsOrdering, enabling division operations along with general numeric and ordering functionalities for the Number type.
Attributes
- Companion
- trait
- Supertypes
-
trait NumberIsFractionaltrait NumberIsNumerictrait NumberIsOrderingtrait Fractional[Number]trait Numeric[Number]trait Ordering[Number]trait PartialOrdering[Number]trait Equiv[Number]trait Serializabletrait Comparator[Number]class Objecttrait Matchableclass AnyShow all
- Self type
-
NumberIsFractional.type
Following are the definitions required by Fractional[Number]
Following are the definitions required by Fractional[Number]
Attributes
- Companion
- object
- Supertypes
-
trait NumberIsNumerictrait NumberIsOrderingtrait Fractional[Number]trait Numeric[Number]trait Ordering[Number]trait PartialOrdering[Number]trait Equiv[Number]trait Serializabletrait Comparator[Number]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
trait HasValueNumberobject NumberIsFractional
Following are the definitions required by Numeric[Number]
Following are the definitions required by Numeric[Number]
Attributes
- Supertypes
- Known subtypes
Attributes
- Companion
- trait
- Supertypes
-
trait NumberIsOrderingtrait Ordering[Number]trait PartialOrdering[Number]trait Equiv[Number]trait Serializabletrait Comparator[Number]class Objecttrait Matchableclass AnyShow all
- Self type
-
NumberIsOrdering.type
Following are the definitions required by Ordering[Number]
Following are the definitions required by Ordering[Number]
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
object NumberIsFractionaltrait NumberIsNumerictrait NumberIsFractionaltrait HasValueNumberobject NumberIsOrdering
Implicit class to operate on Numbers introduced as integers. CONSIDER reinstating the ∧ operator definitions (but they were never used). CONSIDER generalizing this to inputs of Values (or Rationals, Doubles).
Implicit class to operate on Numbers introduced as integers. CONSIDER reinstating the ∧ operator definitions (but they were never used). CONSIDER generalizing this to inputs of Values (or Rationals, Doubles).
Value parameters
- x
-
an Int to be treated as a Number.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Concrete methods
Applies the given input to create a Number instance.
Applies the given input to create a Number instance.
Value parameters
- x
-
the input value of type NumberLike, which can be a Rational, a Number, or another acceptable form from which a Number can be created.
Attributes
- Returns
-
a Number instance created from the input x if its type matches the expected forms. Throws a CoreException otherwise.
Method to construct a Number from a Double.
Method to construct a Number from a Double.
Value parameters
- factor
-
the appropriate factor
- x
-
the Double value.
Attributes
- Returns
-
a Number based on x.
Method to construct a Number from an optional Double.
Method to construct a Number from an optional Double.
Value parameters
- factor
-
the appropriate factor
- xo
-
an optional Double.
Attributes
- Returns
-
a Number based on xo.
Method to construct a Number from a String. This is by far the best way of creating the number that you really want.
Method to construct a Number from a String. This is by far the best way of creating the number that you really want.
Value parameters
- x
-
the String representation of the value.
Attributes
- Returns
-
a Number based on x.
Method to construct a Number from a String. This is by far the best way of creating the number that you really want.
Method to construct a Number from a String. This is by far the best way of creating the number that you really want.
CONSIDER why does this not invoke apply(String,Factor) in turn?
Value parameters
- x
-
the
Stringrepresentation of the value.
Attributes
- Returns
-
a Number based on
x.
Method to construct a unit Number with explicit factor.
Method to construct a unit Number with explicit factor.
Value parameters
- factor
-
the appropriate factor
Attributes
- Returns
-
a unit Number with the given factor.
Method to construct a Number from an Int.
Method to construct a Number from an Int.
Value parameters
- factor
-
the appropriate factor
- x
-
the Int value.
Attributes
- Returns
-
a Number based on x.
Method to construct a Number from an Int.
Method to construct a Number from an Int.
Value parameters
- factor
-
the appropriate factor
- x
-
the Int value.
Attributes
- Returns
-
a Number based on x.
Method to construct a Number from an Int.
Method to construct a Number from an Int.
Value parameters
- x
-
the Int value.
Attributes
- Returns
-
a Number based on x.
Method to construct a Number from a BigInt.
Method to construct a Number from a BigInt.
Value parameters
- x
-
a BigInt value.
Attributes
- Returns
-
a Number based on x.
Method to construct a Number from a BigInt.
Method to construct a Number from a BigInt.
Value parameters
- factor
-
the appropriate factor
- x
-
the BigInt value.
Attributes
- Returns
-
a Number based on x.
Method to construct a Number from a BigInt.
Method to construct a Number from a BigInt.
Value parameters
- factor
-
the appropriate factor
- x
-
the BigInt value.
Attributes
- Returns
-
a Number based on x.
Method to construct a Number from a Rational.
Method to construct a Number from a Rational.
Value parameters
- x
-
a Rational value.
Attributes
- Returns
-
a Number based on x.
Method to construct a Number from a Rational.
Method to construct a Number from a Rational.
Value parameters
- factor
-
the appropriate factor
- x
-
the BigInt value.
Attributes
- Returns
-
a Number based on x.
Applies the given factor to the specified long x and returns a Number result.
Applies the given factor to the specified long x and returns a Number result.
Value parameters
- factor
-
the Factor to be applied to the input value
- x
-
the input value as a Long to be processed
Attributes
- Returns
-
a Number instance derived from the input value and factor
Constructs a Number instance from the given long value.
Constructs a Number instance from the given long value.
Value parameters
- x
-
the input long value
Attributes
- Returns
-
a
Numberinstance representing the provided long value
Method to construct a Number from a BigDecimal.
Method to construct a Number from a BigDecimal.
Value parameters
- x
-
the BigDecimal value.
Attributes
- Returns
-
a Number based on x.
Method to construct a Number from a BigDecimal.
Method to construct a Number from a BigDecimal.
Value parameters
- factor
-
the appropriate factor
- x
-
the BigDecimal value.
Attributes
- Returns
-
a Number based on x.
Method to construct a Number from a BigDecimal.
Method to construct a Number from a BigDecimal.
Value parameters
- factor
-
the appropriate factor
- x
-
the BigDecimal value.
Attributes
- Returns
-
a Number based on x.
Method to construct a Number from a Rational. NOTE: this method is invoked indirectly by parse(String).
Method to construct a Number from a Rational. NOTE: this method is invoked indirectly by parse(String).
Value parameters
- factor
-
the appropriate factor
- x
-
the BigInt value.
Attributes
- Returns
-
a Number based on x.
Method to construct a Number from an optional Double.
Method to construct a Number from an optional Double.
Value parameters
- xo
-
an optional Double.
Attributes
- Returns
-
a Number based on xo.
Method to construct a Number from an optional Double.
Method to construct a Number from an optional Double.
Value parameters
- factor
-
the appropriate factor
- xo
-
an optional Double.
Attributes
- Returns
-
a Number based on xo.
Method to construct a Number from a Double.
Method to construct a Number from a Double.
Value parameters
- x
-
the Double value.
Attributes
- Returns
-
a Number based on x.
Method to construct an invalid Number.
Method to construct an invalid Number.
Attributes
- Returns
-
a invalid Number.
Method to construct a Number from a Double.
Method to construct a Number from a Double.
Value parameters
- factor
-
the appropriate factor
- x
-
the Double value.
Attributes
- Returns
-
a Number based on x.
Calculates the arctangent of the angle specified by the ratio of y to x. The result is an angle expressed in radians. CONSIDER checking here for x being zero.
Calculates the arctangent of the angle specified by the ratio of y to x. The result is an angle expressed in radians. CONSIDER checking here for x being zero.
Value parameters
- x
-
the horizontal coordinate of the point
- y
-
the vertical coordinate of the point
Attributes
- Returns
-
the arctangent of the angle, in radians
Method to construct a new Number from value, factor and fuzz, according to whether there is any fuzziness.
Method to construct a new Number from value, factor and fuzz, according to whether there is any fuzziness.
Value parameters
- actualFuzz
-
the fuzziness of this Number.
- value
-
the value of the Number, expressed as a nested Either type.
Attributes
- Returns
-
a Number.
Method to construct a new Number from value, factor and fuzz, according to whether there is any fuzziness.
Method to construct a new Number from value, factor and fuzz, according to whether there is any fuzziness.
Value parameters
- value
-
the value of the Number, expressed as a nested Either type.
Attributes
- Returns
-
a Number.
Method to construct a new Number from value, factor and fuzz, according to whether there is any fuzziness.
Method to construct a new Number from value, factor and fuzz, according to whether there is any fuzziness.
Value parameters
- factor
-
the scale factor of the Number: valid scales are: PureNumber, Radian, and NatLog.
- value
-
the value of the Number, expressed as a nested Either type.
Attributes
- Returns
-
a Number.
Method to construct a new Number from value, factor and fuzz, according to whether there is any fuzziness.
Method to construct a new Number from value, factor and fuzz, according to whether there is any fuzziness.
CONSIDER modulate the result so that, in the case of a multiple of Radian, we restrict the range to 0 to 2pi immediately. However, note that this will change the behavior such that it is no longer possible to have the constant 2pi.
Value parameters
- factor
-
the scale factor of the Number: valid scales are: PureNumber, Radian, and NatLog.
- fuzz
-
the fuzziness of this Number, wrapped in Option.
- value
-
the value of the Number, expressed as a nested Either type.
Attributes
- Returns
-
a Number.
CONSIDER why do we need this method?
CONSIDER why do we need this method?
NOTE not all double values should be given fuzz.
Value parameters
- factor
-
a Factor.
- x
-
a Double.
Attributes
- Returns
-
a Number formed from x and factor using standard double precision fuzziness.
CONSIDER inlining this method or making it private.
CONSIDER inlining this method or making it private.
Value parameters
- x
-
the first number.
- y
-
the second number.
Attributes
- Returns
-
the order.
Yield the exponential of x i.e., e to the power of x. If the factor is PureNumber, then we force the factor to be NatLog and simplify. Otherwise, we convert to a PureNumber number and call exp recursively.
Yield the exponential of x i.e., e to the power of x. If the factor is PureNumber, then we force the factor to be NatLog and simplify. Otherwise, we convert to a PureNumber number and call exp recursively.
Value parameters
- x
-
a (real) Number whose factor is NatLog.
Attributes
- Returns
-
the value of e raised to the power of x.
Computes the inverse of the given number based on its factor type.
Computes the inverse of the given number based on its factor type.
Value parameters
- x
-
the number to be inverted
Attributes
- Returns
-
the inverted number, processed according to its factor type
Yield the natural log of x. If the factor is NatLog, then we force the factor to be PureNumber and simplify. Otherwise, if the factor is PureNumber, we first convert it to a NatLog number, then call log recursively. Otherwise, we convert to a PureNumber number and call log recursively.
Yield the natural log of x. If the factor is NatLog, then we force the factor to be PureNumber and simplify. Otherwise, if the factor is PureNumber, we first convert it to a NatLog number, then call log recursively. Otherwise, we convert to a PureNumber number and call log recursively.
CONSIDER using x.factor.log(x.nominalValue)
Value parameters
- x
-
a Number.
Attributes
- Returns
-
the natural log of x.
This method returns a Number equivalent to x but with the value in an explicit factor-dependent range. Only Radian is currently fixed within a range (-1 -> 1).
This method returns a Number equivalent to x but with the value in an explicit factor-dependent range. Only Radian is currently fixed within a range (-1 -> 1).
Value parameters
- x
-
the Number to operate on.
Attributes
- Returns
-
either x or a number equivalent to x with value in defined range.
Method to change the sign of this Number. The meaning of "change the sign" is in terms of pure numbers (PureNumber, Radian). For any other factor, we convert x into PureNumber form (which will most likely introduce fuzziness). Imaginary numbers cannot be negated--they must first be converted to Complex form and then negated.
Method to change the sign of this Number. The meaning of "change the sign" is in terms of pure numbers (PureNumber, Radian). For any other factor, we convert x into PureNumber form (which will most likely introduce fuzziness). Imaginary numbers cannot be negated--they must first be converted to Complex form and then negated.
Value parameters
- x
-
a Number to be negated.
Attributes
- Returns
-
-xunless the negative cannot be represented, in which case a CoreException will be thrown.
Method to parse a String and yield a Try[Number].
Method to parse a String and yield a Try[Number].
NOTE: this method indirectly invokes apply(Rational, Factor, Option of Fuzz[Double] )
Value parameters
- w
-
the String to be parsed.
Attributes
- Returns
-
a Number.
Prepares a valid Number based on the provided optional input.
Prepares a valid Number based on the provided optional input.
Value parameters
- no
-
An optional Number that may or may not be defined.
Attributes
- Returns
-
The provided Number if it exists, otherwise a default Number instance.
Prepares and specializes a given optional number.
Prepares and specializes a given optional number.
Value parameters
- no
-
An optional value of type Number to be prepared.
Attributes
- Returns
-
A specialized Number derived from the prepared input.
Method to deal with a Scale factor change.
Method to deal with a Scale factor change.
TODO: this will work for FuzzyNumber but only if the fuzz is relative, and even then perhaps not for NatLog conversions.
Value parameters
- factor
-
the factor to which it should be converted.
- n
-
the Number to be scaled.
Attributes
- Returns
-
the resulting Number (equivalent in value, but with a potentially different scale factor).
CONSIDER move this to GeneralNumber as an instance method.
CONSIDER move this to GeneralNumber as an instance method.
Value parameters
- x
-
a Number.
Attributes
- Returns
-
-1, 0, or 1 according to its sign.
Implement sin of a Number. See https://en.wikipedia.org/wiki/Sine_and_cosine.
Implement sin of a Number. See https://en.wikipedia.org/wiki/Sine_and_cosine.
CONSIDER implementing this (and cos) as part of exp method (providing a Complex parameter, of course).
CONSIDER implementing this (and cos) by using MonadicOperationSin throughout. But NOTE that said operation will need enhancement before it can work identically.
CONSIDER returning an Expression rather than a Number. That would enable an exact result for 1/12 and 5/12 pi.
Value parameters
- x
-
a Number, typically in Radians, but if not, then will be converted.
Attributes
- Returns
-
a PureNumber Number which represents the sine of x.
Method to yield the square root of a Number.
Method to yield the square root of a Number.
Value parameters
- x
-
the Number whose square root we need.
Attributes
- Returns
-
the square root of x.
NOTE: this unapply method does not match on the fuzz of a Number.
NOTE: this unapply method does not match on the fuzz of a Number.
Value parameters
- arg
-
a Number to be unapplied.
Attributes
- Returns
-
optional Value and Factor.
Concrete fields
Represents a constant value for positive infinity. This value is defined using a Number wrapper around Double.PositiveInfinity.
Represents a constant value for positive infinity. This value is defined using a Number wrapper around Double.PositiveInfinity.
Attributes
Represents the mathematical constant π/3. It is defined as a Number with a rational value of 1/3 and a unit of measurement as Radian.
Represents the mathematical constant π/3. It is defined as a Number with a rational value of 1/3 and a unit of measurement as Radian.
Attributes
Exact value of the Number √2 (not Complex)
Exact value of the Number √2 (not Complex)
Attributes
A constant value representing the number three as a Number type.
A constant value representing the number three as a Number type.
Attributes
Represents the mathematical concept of infinity as a lazy value of type Number. The value is constructed using an exact representation of infinity via the ExactNumber class.
Represents the mathematical concept of infinity as a lazy value of type Number. The value is constructed using an exact representation of infinity via the ExactNumber class.
Attributes
Implicits
Implicits
Implicit class which takes a Double, and using method ~ and an Int parameter, yields a Number with the appropriate degree of fuzziness. This class provides an alternative to having to parse a fuzzy number from a String.
Implicit class which takes a Double, and using method ~ and an Int parameter, yields a Number with the appropriate degree of fuzziness. This class provides an alternative to having to parse a fuzzy number from a String.
Value parameters
- x
-
a Double.
Attributes
Implicit class which takes a String, and using method ~ and an Int parameter, yields a Number with the appropriate degree of fuzziness. This class provides an alternative to having to parse a fuzzy number from a String. Really, the only function it provides is the ability to put the error bounds after the exponent. It is parallel to FuzzOps except for two differences: the input is a String, and this is is so that trailing zeros in the fractional part don't get ignored, thus messing up the fuzziness; And, secondly, the result of ~ is a Try[Number], not just a Number.
Implicit class which takes a String, and using method ~ and an Int parameter, yields a Number with the appropriate degree of fuzziness. This class provides an alternative to having to parse a fuzzy number from a String. Really, the only function it provides is the ability to put the error bounds after the exponent. It is parallel to FuzzOps except for two differences: the input is a String, and this is is so that trailing zeros in the fractional part don't get ignored, thus messing up the fuzziness; And, secondly, the result of ~ is a Try[Number], not just a Number.
Value parameters
- w
-
a String.
Attributes
Implicit class to operate on Numbers introduced as integers. CONSIDER reinstating the ∧ operator definitions (but they were never used). CONSIDER generalizing this to inputs of Values (or Rationals, Doubles).
Implicit class to operate on Numbers introduced as integers. CONSIDER reinstating the ∧ operator definitions (but they were never used). CONSIDER generalizing this to inputs of Values (or Rationals, Doubles).
Value parameters
- x
-
an Int to be treated as a Number.
Attributes
Implicit converter from Double to Number.
Implicit converter from Double to Number.
Value parameters
- x
-
the Double to be converted.
Attributes
- Returns
-
the equivalent Number.
Implicit converter from Int to Number.
Implicit converter from Int to Number.
Value parameters
- x
-
the Int to be converted.
Attributes
- Returns
-
the equivalent Number.