FloatTryClone
Description
Create a deep copy of a floating-point value.
Parameters
| Name | Direction | Description |
|---|---|---|
out |
in,out | Destination Float that receives the clone. Must already be a valid initialised Float; its existing storage is deinitialised before the copy is installed. |
value |
in | Source Float to clone. Not modified. |
Success
Returns true. *out holds an independent deep copy of value (sign, significand bits, and exponent) bound to value’s allocator.
Failure
Returns false on allocation failure while copying the significand. *out is left as a freshly initialised empty Float bound to value’s allocator.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Float.c:244:
bool ok = false;
if (FloatTryClone(&scaled, high) && float_scale_to_exponent(&scaled, low->exponent)) {
int cmp = int_compare(&scaled.significand, &low->significand);- In
Float.c:317:
ValidateFloat(value);
clone = FloatInit(FloatAllocator(value));
(void)FloatTryClone(&clone, value);
return clone;
}- In
Float.c:321:
}
bool FloatTryClone(Float *out, const Float *value) {
if (!out || !value) {
LOG_FATAL("Invalid arguments");- In
Float.c:935:
temp = FloatInit(FloatAllocator(result));
if (!FloatTryClone(&lhs, a) || !FloatTryClone(&rhs, b)) {
FloatDeinit(&lhs);
FloatDeinit(&rhs);- In
Float.c:1053:
ValidateFloat(b);
if (!FloatTryClone(&rhs, b)) {
return false;
}
Last updated on