Class RealFloat

java.lang.Object
java.lang.Number
org.episteme.core.mathematics.numbers.real.Real
org.episteme.core.mathematics.numbers.real.RealFloat
All Implemented Interfaces:
Serializable, Comparable<Real>, AbelianGroup<Real>, AbelianMonoid<Real>, Group<Real>, Magma<Real>, Monoid<Real>, Field<Real>, FieldElement<Real>, Ring<Real>, RingElement<Real>, Semiring<Real>, Set<Real>

public final class RealFloat extends Real
Real number backed by a 32-bit float. Package-private implementation detail.
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
See Also:
  • Field Details

  • Method Details

    • create

      public static RealFloat create(float value)
    • add

      public Real add(Real other)
      Description copied from interface: RingElement
      Returns the sum of this element and another.
      Specified by:
      add in interface RingElement<Real>
      Specified by:
      add in class Real
      Parameters:
      other - the element to add
      Returns:
      this + other
    • subtract

      public Real subtract(Real other)
      Description copied from interface: RingElement
      Returns the difference of this element and another.

      Default implementation: this.add(other.negate())

      Specified by:
      subtract in interface RingElement<Real>
      Specified by:
      subtract in class Real
      Parameters:
      other - the element to subtract
      Returns:
      this - other
    • multiply

      public Real multiply(Real other)
      Description copied from interface: RingElement
      Returns the product of this element and another.
      Specified by:
      multiply in interface RingElement<Real>
      Specified by:
      multiply in class Real
      Parameters:
      other - the element to multiply
      Returns:
      this * other
    • divide

      public Real divide(Real other)
      Description copied from interface: FieldElement
      Returns this element divided by another.

      Default implementation: this.multiply(other.inverse())

      Specified by:
      divide in interface FieldElement<Real>
      Specified by:
      divide in class Real
      Parameters:
      other - the divisor
      Returns:
      this / other
    • negate

      public Real negate()
      Description copied from interface: RingElement
      Returns the additive inverse of this element.
      Specified by:
      negate in interface RingElement<Real>
      Specified by:
      negate in class Real
      Returns:
      -this
    • abs

      public Real abs()
      Specified by:
      abs in class Real
    • inverse

      public Real inverse()
      Description copied from interface: FieldElement
      Returns the multiplicative inverse of this element.

      For any non-zero element e: e.multiply(e.inverse()) = e.one()

      Specified by:
      inverse in interface FieldElement<Real>
      Specified by:
      inverse in class Real
      Returns:
      1/this
    • sqrt

      public Real sqrt()
      Specified by:
      sqrt in class Real
    • pow

      public Real pow(int exp)
      Specified by:
      pow in class Real
    • pow

      public Real pow(Real exp)
      Specified by:
      pow in class Real
    • isZero

      public boolean isZero()
      Description copied from interface: RingElement
      Checks if this element is the additive identity (zero).
      Specified by:
      isZero in interface RingElement<Real>
      Specified by:
      isZero in class Real
      Returns:
      true if this equals zero()
    • isOne

      public boolean isOne()
      Description copied from interface: RingElement
      Checks if this element is the multiplicative identity (one).
      Specified by:
      isOne in interface RingElement<Real>
      Specified by:
      isOne in class Real
      Returns:
      true if this equals one()
    • isNaN

      public boolean isNaN()
      Specified by:
      isNaN in class Real
    • isInfinite

      public boolean isInfinite()
      Specified by:
      isInfinite in class Real
    • isFast

      public boolean isFast()
      Overrides:
      isFast in class Real
    • doubleValue

      public double doubleValue()
      Specified by:
      doubleValue in class Real
    • bigDecimalValue

      public BigDecimal bigDecimalValue()
      Specified by:
      bigDecimalValue in class Real
    • compareTo

      public int compareTo(Real other)
      Specified by:
      compareTo in interface Comparable<Real>
      Specified by:
      compareTo in class Real
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in class Real
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class Real
    • toString

      public String toString()
      Specified by:
      toString in class Real
    • pow

      public Real pow(double exponent)
      Description copied from class: Real
      Returns this number raised to a power.
      Specified by:
      pow in class Real
      Parameters:
      exponent - the exponent
      Returns:
      this^exponent
    • exp

      public Real exp()
      Description copied from class: Real
      Returns e raised to this number.
      Specified by:
      exp in class Real
      Returns:
      e^this
    • log

      public Real log()
      Description copied from class: Real
      Returns the natural logarithm of this number.
      Specified by:
      log in class Real
      Returns:
      ln(this)
    • log10

      public Real log10()
      Description copied from class: Real
      Returns the base-10 logarithm of this number.
      Specified by:
      log10 in class Real
      Returns:
      log₁₀(this)
    • sin

      public Real sin()
      Description copied from class: Real
      Returns the sine of this number (in radians).
      Specified by:
      sin in class Real
      Returns:
      sin(this)
    • cos

      public Real cos()
      Description copied from class: Real
      Returns the cosine of this number (in radians).
      Specified by:
      cos in class Real
      Returns:
      cos(this)
    • tan

      public Real tan()
      Description copied from class: Real
      Returns the tangent of this number (in radians).
      Specified by:
      tan in class Real
      Returns:
      tan(this)
    • asin

      public Real asin()
      Description copied from class: Real
      Returns the arcsine of this number.
      Specified by:
      asin in class Real
      Returns:
      arcsin(this) in radians
    • acos

      public Real acos()
      Description copied from class: Real
      Returns the arccosine of this number.
      Specified by:
      acos in class Real
      Returns:
      arccos(this) in radians
    • atan

      public Real atan()
      Description copied from class: Real
      Returns the arctangent of this number.
      Specified by:
      atan in class Real
      Returns:
      arctan(this) in radians
    • atan2

      public Real atan2(Real x)
      Description copied from class: Real
      Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).
      Specified by:
      atan2 in class Real
      Parameters:
      x - the abscissa coordinate
      Returns:
      the theta component of the point (r, theta)
    • sinh

      public Real sinh()
      Description copied from class: Real
      Returns the hyperbolic sine of this number.
      Specified by:
      sinh in class Real
      Returns:
      sinh(this)
    • cosh

      public Real cosh()
      Description copied from class: Real
      Returns the hyperbolic cosine of this number.
      Specified by:
      cosh in class Real
      Returns:
      cosh(this)
    • tanh

      public Real tanh()
      Description copied from class: Real
      Returns the hyperbolic tangent of this number.
      Specified by:
      tanh in class Real
      Returns:
      tanh(this)
    • asinh

      public Real asinh()
      Description copied from class: Real
      Returns the inverse hyperbolic sine of this number.
      Specified by:
      asinh in class Real
      Returns:
      asinh(this)
    • acosh

      public Real acosh()
      Description copied from class: Real
      Returns the inverse hyperbolic cosine of this number.
      Specified by:
      acosh in class Real
      Returns:
      acosh(this)
    • atanh

      public Real atanh()
      Description copied from class: Real
      Returns the inverse hyperbolic tangent of this number.
      Specified by:
      atanh in class Real
      Returns:
      atanh(this)
    • cbrt

      public Real cbrt()
      Description copied from class: Real
      Returns the cube root of this number.
      Specified by:
      cbrt in class Real
      Returns:
      cbrt(this)
    • hypot

      public Real hypot(Real y)
      Description copied from class: Real
      Returns sqrt(x^2 + y^2) without intermediate overflow or underflow.
      Specified by:
      hypot in class Real
      Parameters:
      y - the other value
      Returns:
      sqrt(this^2 + y^2)
    • ceil

      public Real ceil()
      Description copied from class: Real
      Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer.
      Specified by:
      ceil in class Real
      Returns:
      ceil(this)
    • floor

      public Real floor()
      Description copied from class: Real
      Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.
      Specified by:
      floor in class Real
      Returns:
      floor(this)
    • round

      public Real round()
      Description copied from class: Real
      Returns the closest long to the argument, with ties rounding to positive infinity.
      Specified by:
      round in class Real
      Returns:
      round(this)
    • toDegrees

      public Real toDegrees()
      Description copied from class: Real
      Converts an angle measured in radians to an approximately equivalent angle measured in degrees.
      Overrides:
      toDegrees in class Real
      Returns:
      this converted to degrees
    • toRadians

      public Real toRadians()
      Description copied from class: Real
      Converts an angle measured in degrees to an approximately equivalent angle measured in radians.
      Overrides:
      toRadians in class Real
      Returns:
      this converted to radians
    • characteristic

      public int characteristic()
      Description copied from interface: Field
      Returns the characteristic of this field.

      The characteristic is the smallest positive integer n such that:
      1 + 1 + ... + 1 (n times) = 0
      If no such n exists, the characteristic is 0.

      Examples:

      • char(ℚ) = char(ℝ) = char(â„‚) = 0
      • char(𝔽ₚ) = p (for prime p)

      Specified by:
      characteristic in interface Field<Real>
      Overrides:
      characteristic in class Real
      Returns:
      the characteristic (0 for infinite fields, p for finite fields)