FloatAllocator
Description
Allocator backing the float’s storage.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Float to query. |
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Convert.h:138:
///
#define FloatTryToStr(...) OVERLOAD(FloatTryToStr, __VA_ARGS__)
#define FloatTryToStr_2(out, value) float_try_to_str((out), (value), FloatAllocator((value)))
#define FloatTryToStr_3(out, value, alloc) float_try_to_str((out), (value), (alloc))- In
Convert.h:155:
///
#define FloatToStr(...) OVERLOAD(FloatToStr, __VA_ARGS__)
#define FloatToStr_1(value) float_to_str((value), FloatAllocator((value)))
#define FloatToStr_2(value, alloc) float_to_str((value), (alloc))- In
Io.c:3406:
}
temp = StrInit(FloatAllocator(value));
parsed = FloatInit(FloatAllocator(value));- In
Io.c:3407:
temp = StrInit(FloatAllocator(value));
parsed = FloatInit(FloatAllocator(value));
if (float_fmt_uses_unsupported_flags(fmt_info)) {- In
Io.c:3443:
StrDeinit(&temp);
temp = StrInitFromCstr(start, token_len, FloatAllocator(value));
if (!FloatTryFromStr(&parsed, StrBegin(&temp))) {
StrDeinit(&temp);- In
Float.c:200:
{
u64 places = (u64)(value->exponent - target_exponent);
Int factor = IntInit(FloatAllocator(value));
Int scaled = IntInit(FloatAllocator(value));- In
Float.c:201:
u64 places = (u64)(value->exponent - target_exponent);
Int factor = IntInit(FloatAllocator(value));
Int scaled = IntInit(FloatAllocator(value));
if (!float_pow10(&factor, places, FloatAllocator(value)) || !int_mul(&scaled, &value->significand, &factor)) {- In
Float.c:203:
Int scaled = IntInit(FloatAllocator(value));
if (!float_pow10(&factor, places, FloatAllocator(value)) || !int_mul(&scaled, &value->significand, &factor)) {
IntDeinit(&factor);
IntDeinit(&scaled);- In
Float.c:241:
const Float *low = lhs->exponent < rhs->exponent ? lhs : rhs;
const Float *high = lhs->exponent < rhs->exponent ? rhs : lhs;
Float scaled = FloatInit(FloatAllocator(high));
bool ok = false;- In
Float.c:277:
// swapped in rather than reallocated per digit.
{
Allocator *alloc = FloatAllocator(value);
Int ten = IntInit(alloc);
Int q = IntInit(alloc);- In
Float.c:316:
ValidateFloat(value);
clone = FloatInit(FloatAllocator(value));
(void)FloatTryClone(&clone, value);
return clone;- In
Float.c:327:
ValidateFloat(value);
*out = FloatInit(FloatAllocator(value));
out->negative = value->negative;
out->exponent = value->exponent;- In
Float.c:332:
if (!IntTryClone(&out->significand, &value->significand)) {
FloatDeinit(out);
*out = FloatInit(FloatAllocator(value));
return false;
}- In
Float.c:451:
if (value->exponent >= 0) {
Int factor = IntInit(FloatAllocator(value));
if (!IntTryClone(&temp, &value->significand) ||- In
Float.c:454:
if (!IntTryClone(&temp, &value->significand) ||
!float_pow10(&factor, (u64)value->exponent, FloatAllocator(value)) || !int_mul(&temp, &temp, &factor)) {
IntDeinit(&factor);
IntDeinit(&temp);- In
Float.c:468:
{
u64 places = (u64)(-value->exponent);
Int factor = IntInit(FloatAllocator(value));
bool ok = false;- In
Float.c:471:
bool ok = false;
if (!float_pow10(&factor, places, FloatAllocator(value))) {
IntDeinit(&factor);
return false;- In
Float.c:503:
ValidateFloat(out);
result = FloatInit(FloatAllocator(out));
digits = StrInit(FloatAllocator(out));- In
Float.c:504:
ValidateFloat(out);
result = FloatInit(FloatAllocator(out));
digits = StrInit(FloatAllocator(out));
if (pos < length && (text[pos] == '+' || text[pos] == '-')) {- In
Float.c:784:
int float_compare_int_with_error(const Float *lhs, const Int *rhs, bool *error) {
Float rhs_value = FloatInit(FloatAllocator(lhs));
int cmp = 0;- In
Float.c:810:
int float_compare_u64_with_error(const Float *lhs, u64 rhs, bool *error) {
Float rhs_value = FloatInit(FloatAllocator(lhs));
int cmp = 0;- In
Float.c:818:
}
if (!float_try_from_u64_value(&rhs_value, rhs, FloatAllocator(lhs))) {
if (error) {
*error = true;- In
Float.c:835:
int float_compare_i64_with_error(const Float *lhs, i64 rhs, bool *error) {
Float rhs_value = FloatInit(FloatAllocator(lhs));
int cmp = 0;- In
Float.c:843:
}
if (!float_try_from_i64_value(&rhs_value, rhs, FloatAllocator(lhs))) {
if (error) {
*error = true;- In
Float.c:860:
int float_compare_f32_with_error(const Float *lhs, float rhs, bool *error) {
Float rhs_value = FloatInit(FloatAllocator(lhs));
int cmp = 0;- In
Float.c:868:
}
if (!float_try_from_f32_value(&rhs_value, rhs, FloatAllocator(lhs))) {
if (error) {
*error = true;- In
Float.c:885:
int float_compare_f64_with_error(const Float *lhs, double rhs, bool *error) {
Float rhs_value = FloatInit(FloatAllocator(lhs));
int cmp = 0;- In
Float.c:893:
}
if (!float_try_from_f64_value(&rhs_value, rhs, FloatAllocator(lhs))) {
if (error) {
*error = true;- In
Float.c:931:
ValidateFloat(a);
ValidateFloat(b);
lhs = FloatInit(FloatAllocator(a));
rhs = FloatInit(FloatAllocator(b));
temp = FloatInit(FloatAllocator(result));- In
Float.c:932:
ValidateFloat(b);
lhs = FloatInit(FloatAllocator(a));
rhs = FloatInit(FloatAllocator(b));
temp = FloatInit(FloatAllocator(result));- In
Float.c:933:
lhs = FloatInit(FloatAllocator(a));
rhs = FloatInit(FloatAllocator(b));
temp = FloatInit(FloatAllocator(result));
if (!FloatTryClone(&lhs, a) || !FloatTryClone(&rhs, b)) {- In
Float.c:992:
bool float_add_int(Float *result, const Float *a, const Int *b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_int_value(&rhs, b)) {- In
Float.c:1003:
bool float_add_u64(Float *result, const Float *a, u64 b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_u64_value(&rhs, b, FloatAllocator(result))) {- In
Float.c:1005:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_u64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1014:
bool float_add_i64(Float *result, const Float *a, i64 b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_i64_value(&rhs, b, FloatAllocator(result))) {- In
Float.c:1016:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_i64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1025:
bool float_add_f32(Float *result, const Float *a, float b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f32_value(&rhs, b, FloatAllocator(result))) {- In
Float.c:1027:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f32_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1036:
bool float_add_f64(Float *result, const Float *a, double b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f64_value(&rhs, b, FloatAllocator(result))) {- In
Float.c:1038:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1047:
bool float_sub(Float *result, const Float *a, const Float *b) {
Float rhs = FloatInit(FloatAllocator(b));
ValidateFloat(result);- In
Float.c:1063:
bool float_sub_int(Float *result, const Float *a, const Int *b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_int_value(&rhs, b)) {- In
Float.c:1074:
bool float_sub_u64(Float *result, const Float *a, u64 b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_u64_value(&rhs, b, FloatAllocator(result))) {- In
Float.c:1076:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_u64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1085:
bool float_sub_i64(Float *result, const Float *a, i64 b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_i64_value(&rhs, b, FloatAllocator(result))) {- In
Float.c:1087:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_i64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1096:
bool float_sub_f32(Float *result, const Float *a, float b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f32_value(&rhs, b, FloatAllocator(result))) {- In
Float.c:1098:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f32_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1107:
bool float_sub_f64(Float *result, const Float *a, double b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f64_value(&rhs, b, FloatAllocator(result))) {- In
Float.c:1109:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1118:
bool float_mul(Float *result, const Float *a, const Float *b) {
Float temp = FloatInit(FloatAllocator(result));
ValidateFloat(result);- In
Float.c:1137:
bool float_mul_int(Float *result, const Float *a, const Int *b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_int_value(&rhs, b)) {- In
Float.c:1148:
bool float_mul_u64(Float *result, const Float *a, u64 b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_u64_value(&rhs, b, FloatAllocator(result))) {- In
Float.c:1150:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_u64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1159:
bool float_mul_i64(Float *result, const Float *a, i64 b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_i64_value(&rhs, b, FloatAllocator(result))) {- In
Float.c:1161:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_i64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1170:
bool float_mul_f32(Float *result, const Float *a, float b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f32_value(&rhs, b, FloatAllocator(result))) {- In
Float.c:1172:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f32_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1181:
bool float_mul_f64(Float *result, const Float *a, double b) {
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f64_value(&rhs, b, FloatAllocator(result))) {- In
Float.c:1183:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1192:
bool float_div(Float *result, const Float *a, const Float *b, u64 precision) {
Float temp = FloatInit(FloatAllocator(result));
Int scale = IntInit(FloatAllocator(result));
Int scaled = IntInit(FloatAllocator(result));- In
Float.c:1193:
bool float_div(Float *result, const Float *a, const Float *b, u64 precision) {
Float temp = FloatInit(FloatAllocator(result));
Int scale = IntInit(FloatAllocator(result));
Int scaled = IntInit(FloatAllocator(result));- In
Float.c:1194:
Float temp = FloatInit(FloatAllocator(result));
Int scale = IntInit(FloatAllocator(result));
Int scaled = IntInit(FloatAllocator(result));
ValidateFloat(result);- In
Float.c:1205:
}
if (FloatIsZero(a)) {
Float zero = FloatInit(FloatAllocator(result));
FloatDeinit(result);- In
Float.c:1212:
}
if (!float_pow10(&scale, precision, FloatAllocator(result)) || !int_mul(&scaled, &a->significand, &scale)) {
IntDeinit(&scale);
IntDeinit(&scaled);- In
Float.c:1237:
bool float_div_int(Float *result, const Float *a, const Int *b, u64 precision) {
Float rhs = FloatInit(FloatAllocator(result));
bool ok = false;- In
Float.c:1249:
bool float_div_u64(Float *result, const Float *a, u64 b, u64 precision) {
Float rhs = FloatInit(FloatAllocator(result));
bool ok = false;- In
Float.c:1252:
bool ok = false;
if (!float_try_from_u64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1261:
bool float_div_i64(Float *result, const Float *a, i64 b, u64 precision) {
Float rhs = FloatInit(FloatAllocator(result));
bool ok = false;- In
Float.c:1264:
bool ok = false;
if (!float_try_from_i64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1273:
bool float_div_f32(Float *result, const Float *a, float b, u64 precision) {
Float rhs = FloatInit(FloatAllocator(result));
bool ok = false;- In
Float.c:1276:
bool ok = false;
if (!float_try_from_f32_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1285:
bool float_div_f64(Float *result, const Float *a, double b, u64 precision) {
Float rhs = FloatInit(FloatAllocator(result));
bool ok = false;- In
Float.c:1288:
bool ok = false;
if (!float_try_from_f64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Type.c:89:
Float clone = FloatClone(&original);
bool result = FloatEQ(&clone, &original) && FloatAllocator(&clone) == FloatAllocator(&original) &&
FloatAllocator(&clone)->allocate == FloatAllocator(&original)->allocate &&
FloatAllocator(&clone)->remap == FloatAllocator(&original)->remap &&- In
Type.c:90:
bool result = FloatEQ(&clone, &original) && FloatAllocator(&clone) == FloatAllocator(&original) &&
FloatAllocator(&clone)->allocate == FloatAllocator(&original)->allocate &&
FloatAllocator(&clone)->remap == FloatAllocator(&original)->remap &&
FloatAllocator(&clone)->deallocate == FloatAllocator(&original)->deallocate &&- In
Type.c:91:
bool result = FloatEQ(&clone, &original) && FloatAllocator(&clone) == FloatAllocator(&original) &&
FloatAllocator(&clone)->allocate == FloatAllocator(&original)->allocate &&
FloatAllocator(&clone)->remap == FloatAllocator(&original)->remap &&
FloatAllocator(&clone)->deallocate == FloatAllocator(&original)->deallocate &&
FloatAllocator(&clone)->effort == FloatAllocator(&original)->effort &&- In
Type.c:92:
FloatAllocator(&clone)->allocate == FloatAllocator(&original)->allocate &&
FloatAllocator(&clone)->remap == FloatAllocator(&original)->remap &&
FloatAllocator(&clone)->deallocate == FloatAllocator(&original)->deallocate &&
FloatAllocator(&clone)->effort == FloatAllocator(&original)->effort &&
FloatAllocator(&clone)->retry_limit == FloatAllocator(&original)->retry_limit;- In
Type.c:93:
FloatAllocator(&clone)->remap == FloatAllocator(&original)->remap &&
FloatAllocator(&clone)->deallocate == FloatAllocator(&original)->deallocate &&
FloatAllocator(&clone)->effort == FloatAllocator(&original)->effort &&
FloatAllocator(&clone)->retry_limit == FloatAllocator(&original)->retry_limit;- In
Type.c:94:
FloatAllocator(&clone)->deallocate == FloatAllocator(&original)->deallocate &&
FloatAllocator(&clone)->effort == FloatAllocator(&original)->effort &&
FloatAllocator(&clone)->retry_limit == FloatAllocator(&original)->retry_limit;
FloatDeinit(&original);
Last updated on