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:
+ floatValue :(float) floatValue
Creates an object with value equal to floatValue.
str:
+ str :(STR) aString
Returns 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().
hash
- (unsigned) hash
Returns a small integer that is the same for objects that are equal (in the sense of isEqual:).
isEqual:
- (BOOL) isEqual : b
floatValue
- (float) floatValue
Returns the value of the object.
floatValue:
- floatValue :(float) f
Creates an object with value f.
sign
- (int) sign
Returns plus one if the object is positive (greater than zero), zero if zero and minus one if negative (less than zero).
compare:
- (int) compare : b
Returns -1, 0, or +1 if the object is respectively less than, equal to, or greater than b. Returns 0 for pointer equal objects.
zero
- zero
Returns a new reference to a shared float instance with value equal to zero.
isZero
- (BOOL) isZero
Whether the object is equal to zero.
isOpposite:
- (BOOL) isOpposite : b
Whether the object is the opposite of b.
negate
- negate
Returns the opposite of the object.
double
- double
Returns a new object, equal to the object multiplied by two i.e., added to itself.
add:
- add : b
Adds b to the object. Returns a new object.
subtract:
- subtract : b
Subtracts b from the object. Returns a new object.
one
- one
Returns a new reference to a shared float instance with value equal to one.
minusOne
- minusOne
Returns a new reference to the float minus one.
isOne
- (BOOL) isOne
Whether the object is equal to one.
isMinusOne
- (BOOL) isMinusOne
Whether the object is equal to minus one.
square
- square
Returns the square of the object i.e., a new object equal to the original object multiplied by itself.
multiply:
- multiply : b
Returns 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.
inverse
- inverse
Returns the multiplicative inverse of the object (returns a new object). Returns nil if the object is equal to zero or cannot be inverted.
divide:
- divide : b
Returns 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.
printsLeadingSign
- (BOOL) printsLeadingSign
Returns YES if the number is negative.