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:235:
Float rhs_scaled = FloatInit(FloatAllocator(rhs));
if (!FloatTryClone(&lhs_scaled, lhs) || !FloatTryClone(&rhs_scaled, rhs) ||
!float_scale_to_exponent(&lhs_scaled, target_exponent) ||
!float_scale_to_exponent(&rhs_scaled, target_exponent)) {- In
Float.c:289:
ValidateFloat(value);
clone = FloatInit(FloatAllocator(value));
(void)FloatTryClone(&clone, value);
return clone;
}- In
Float.c:293:
}
bool FloatTryClone(Float *out, const Float *value) {
if (!out || !value) {
LOG_FATAL("Invalid arguments");- In
Float.c:907:
temp = FloatInit(FloatAllocator(result));
if (!FloatTryClone(&lhs, a) || !FloatTryClone(&rhs, b)) {
FloatDeinit(&lhs);
FloatDeinit(&rhs);- In
Float.c:1025:
ValidateFloat(b);
if (!FloatTryClone(&rhs, b)) {
return false;
}
Last updated on