Float operations

Most of these operations deal with Float objects. A few additional utility functions are provided as well. Of course, all standard C functions dealing with floating point numbers such as sin and sqrt can be used as well, provided that the required headers are included.

Efficiency note: For maximal efficiency, try to avoid conversion and creation operations, and perform as many operations as possible directly using the C double type.

See also: Sections Arithmetic operations and Comparison operations describe generic operations that can also be used with Float objects.

Creating

AValue AMakeFloat(AThread *t, double f)
Create a std::Float object. Raise a direct exception on all error conditions.

Reading

double AGetFloat(AThread *t, AValue v)
If v is a Float or Int object, return its value as a double. Otherwise, raise a direct std::TypeError exception.

Checking

ABool AIsFloat(AValue v)
Return a boolean indicating whether v is a std::Float object.
void AExpectFloat(AThread *t, AValue v)
Check if v is a Float object and raise a direct std::TypeError exception if it is not.
ABool AIsInf(double f)
Return a boolean indicating whether f represents the positive or negative infinity.
ABool AIsNaN(double f)
Return a boolean indicating whether f represents not-a-number.