Project Lucy has retired. For details please refer to its Attic page.
Clownfish::Float – C API Documentation
Apache Lucy™

Clownfish::Float

parcel Clownfish
class variable CFISH_FLOAT
struct symbol cfish_Float
class nickname cfish_Float
header file Clownfish/Num.h

Name

Clownfish::Float – Immutable double precision floating point number.

Functions

new
cfish_Float*
cfish_Float_new(
    double value
);

Return a new Float.

value

Initial value.

init
cfish_Float*
cfish_Float_init(
    cfish_Float *self,
    double value
);

Initialize a Float.

value

Initial value.

Methods

Get_Value
double
cfish_Float_Get_Value(
    cfish_Float *self
);

Return the value of the Float.

To_I64
int64_t
cfish_Float_To_I64(
    cfish_Float *self
);

Convert the Float to an integer, truncating toward zero. Throw an exception if the value is out of the range of an int64_t.

To_String
cfish_String* // incremented
cfish_Float_To_String(
    cfish_Float *self
);

Return the Float formatted as String using sprintf with conversion specifier %g.

Equals
bool
cfish_Float_Equals(
    cfish_Float *self,
    cfish_Obj *other
);

Indicate whether two numbers are the same.

Returns: true if other is a Float or Integer with the same value as self.

Compare_To
int32_t
cfish_Float_Compare_To(
    cfish_Float *self,
    cfish_Obj *other
);

Indicate whether one number is less than, equal to, or greater than another. Throws an exception if other is neither a Float nor an Integer.

Returns: 0 if the numbers are equal, a negative number if self is less than other, and a positive number if self is greater than other.

Clone
cfish_Float* // incremented
cfish_Float_Clone(
    cfish_Float *self
);

Return a clone of the object.

Inheritance

Clownfish::Float is a Clownfish::Obj.