Maturity Index: Immature
Support for floating-point arithmetic is minimal in the Computer Algebra Kit; it is possible to convert results that are obtained by exact arithmetic to a numerical approximation (see the method asNumerical of Integer, Matrix, Polynomial etc.) for further processing by numerical analysis software.
+newCreates an floating-point object equal to zero.
+floatValue:(float)floatValueCreates an object with value equal to floatValue.
+str:(STR)aStringReturns a new float object given a string aString, or returns nil if the method can't parse aString. This method acts like the ANSI function atof().
- (unsigned)hashReturns a small integer that is the same for objects that are equal (in the sense of isEqual:).
- (BOOL)isEqual:b
- (float)floatValueReturns the value of the object.
-floatValue:(float)fCreates an object with value f.
- (int)signReturns plus one if the object is positive (greater than zero), zero if zero and minus one if negative (less than zero).
- (int)compare:bReturns -1, 0, or +1 if the object is respectively less than, equal to, or greater than b. Returns 0 for pointer equal objects.
-zeroReturns a new reference to a shared float instance with value equal to zero.
- (BOOL)isZeroWhether the object is equal to zero.
- (BOOL)isOpposite:bWhether the object is the opposite of b.
-negateReturns the opposite of the object.
-doubleReturns a new object, equal to the object multiplied by two i.e., added to itself.
-add:bAdds b to the object. Returns a new object.
-subtract:bSubtracts b from the object. Returns a new object.
-oneReturns a new reference to a shared float instance with value equal to one.
-minusOneReturns a new reference to the float minus one.
- (BOOL)isOneWhether the object is equal to one.
- (BOOL)isMinusOneWhether the object is equal to minus one.
-squareReturns the square of the object i.e., a new object equal to the original object multiplied by itself.
-multiply:bReturns a new object, the product of the object multiplied (to the right) by b. If the objects are pointer equal, this method is equivalent to square.
-inverseReturns the multiplicative inverse of the object (returns a new object). Returns nil if the object is equal to zero or cannot be inverted.
-divide:bReturns a new object, the exact quotient of the object divided by b. Returns nil if b is equal to zero or if the division is not exact.
- (BOOL)printsLeadingSignReturns YES if the number is negative.
-printOn:(IOD)aFilePrints the floating-point number to aFile according to the '%g' format of the ANSI function printf().