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
Io.c:3272:
}
temp = StrInit(FloatAllocator(value));
parsed = FloatInit(FloatAllocator(value));- In
Io.c:3273:
temp = StrInit(FloatAllocator(value));
parsed = FloatInit(FloatAllocator(value));
if (float_fmt_uses_unsupported_flags(fmt_info)) {- In
Io.c:3309:
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:232:
{
i64 target_exponent = lhs->exponent < rhs->exponent ? lhs->exponent : rhs->exponent;
Float lhs_scaled = FloatInit(FloatAllocator(lhs));
Float rhs_scaled = FloatInit(FloatAllocator(rhs));- In
Float.c:233:
i64 target_exponent = lhs->exponent < rhs->exponent ? lhs->exponent : rhs->exponent;
Float lhs_scaled = FloatInit(FloatAllocator(lhs));
Float rhs_scaled = FloatInit(FloatAllocator(rhs));
if (!FloatTryClone(&lhs_scaled, lhs) || !FloatTryClone(&rhs_scaled, rhs) ||- In
Float.c:260:
while (int_mod_u64(&value->significand, 10) == 0) {
Int quotient = IntInit(FloatAllocator(value));
(void)int_div_u64_rem("ient, &value->significand, 10);- In
Float.c:288:
ValidateFloat(value);
clone = FloatInit(FloatAllocator(value));
(void)FloatTryClone(&clone, value);
return clone;- In
Float.c:299:
ValidateFloat(value);
*out = FloatInit(FloatAllocator(value));
out->negative = value->negative;
out->exponent = value->exponent;- In
Float.c:304:
if (!IntTryClone(&out->significand, &value->significand)) {
FloatDeinit(out);
*out = FloatInit(FloatAllocator(value));
return false;
}- In
Float.c:423:
if (value->exponent >= 0) {
Int factor = IntInit(FloatAllocator(value));
if (!IntTryClone(&temp, &value->significand) ||- In
Float.c:426:
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:440:
{
u64 places = (u64)(-value->exponent);
Int factor = IntInit(FloatAllocator(value));
bool ok = false;- In
Float.c:443:
bool ok = false;
if (!float_pow10(&factor, places, FloatAllocator(value))) {
IntDeinit(&factor);
return false;- In
Float.c:475:
ValidateFloat(out);
result = FloatInit(FloatAllocator(out));
digits = StrInit(FloatAllocator(out));- In
Float.c:476:
ValidateFloat(out);
result = FloatInit(FloatAllocator(out));
digits = StrInit(FloatAllocator(out));
if (pos < length && (text[pos] == '+' || text[pos] == '-')) {- In
Float.c:756:
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:782:
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:790:
}
if (!float_try_from_u64_value(&rhs_value, rhs, FloatAllocator(lhs))) {
if (error) {
*error = true;- In
Float.c:807:
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:815:
}
if (!float_try_from_i64_value(&rhs_value, rhs, FloatAllocator(lhs))) {
if (error) {
*error = true;- In
Float.c:832:
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:840:
}
if (!float_try_from_f32_value(&rhs_value, rhs, FloatAllocator(lhs))) {
if (error) {
*error = true;- In
Float.c:857:
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:865:
}
if (!float_try_from_f64_value(&rhs_value, rhs, FloatAllocator(lhs))) {
if (error) {
*error = true;- In
Float.c:903:
ValidateFloat(a);
ValidateFloat(b);
lhs = FloatInit(FloatAllocator(a));
rhs = FloatInit(FloatAllocator(b));
temp = FloatInit(FloatAllocator(result));- In
Float.c:904:
ValidateFloat(b);
lhs = FloatInit(FloatAllocator(a));
rhs = FloatInit(FloatAllocator(b));
temp = FloatInit(FloatAllocator(result));- In
Float.c:905:
lhs = FloatInit(FloatAllocator(a));
rhs = FloatInit(FloatAllocator(b));
temp = FloatInit(FloatAllocator(result));
if (!FloatTryClone(&lhs, a) || !FloatTryClone(&rhs, b)) {- In
Float.c:964:
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:975:
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:977:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_u64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:986:
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:988:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_i64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:997:
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:999:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f32_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1008:
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:1010:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1019:
bool float_sub(Float *result, const Float *a, const Float *b) {
Float rhs = FloatInit(FloatAllocator(b));
ValidateFloat(result);- In
Float.c:1035:
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:1046:
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:1048:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_u64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1057:
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:1059:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_i64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1068:
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:1070:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f32_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1079:
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:1081:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1090:
bool float_mul(Float *result, const Float *a, const Float *b) {
Float temp = FloatInit(FloatAllocator(result));
ValidateFloat(result);- In
Float.c:1109:
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:1120:
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:1122:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_u64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1131:
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:1133:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_i64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1142:
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:1144:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f32_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1153:
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:1155:
Float rhs = FloatInit(FloatAllocator(result));
if (!float_try_from_f64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1164:
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:1165:
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:1166:
Float temp = FloatInit(FloatAllocator(result));
Int scale = IntInit(FloatAllocator(result));
Int scaled = IntInit(FloatAllocator(result));
ValidateFloat(result);- In
Float.c:1177:
}
if (FloatIsZero(a)) {
Float zero = FloatInit(FloatAllocator(result));
FloatDeinit(result);- In
Float.c:1184:
}
if (!float_pow10(&scale, precision, FloatAllocator(result)) || !int_mul(&scaled, &a->significand, &scale)) {
IntDeinit(&scale);
IntDeinit(&scaled);- In
Float.c:1209:
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:1221:
bool float_div_u64(Float *result, const Float *a, u64 b, u64 precision) {
Float rhs = FloatInit(FloatAllocator(result));
bool ok = false;- In
Float.c:1224:
bool ok = false;
if (!float_try_from_u64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1233:
bool float_div_i64(Float *result, const Float *a, i64 b, u64 precision) {
Float rhs = FloatInit(FloatAllocator(result));
bool ok = false;- In
Float.c:1236:
bool ok = false;
if (!float_try_from_i64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1245:
bool float_div_f32(Float *result, const Float *a, float b, u64 precision) {
Float rhs = FloatInit(FloatAllocator(result));
bool ok = false;- In
Float.c:1248:
bool ok = false;
if (!float_try_from_f32_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.c:1257:
bool float_div_f64(Float *result, const Float *a, double b, u64 precision) {
Float rhs = FloatInit(FloatAllocator(result));
bool ok = false;- In
Float.c:1260:
bool ok = false;
if (!float_try_from_f64_value(&rhs, b, FloatAllocator(result))) {
return false;
}- In
Float.Type.c:88:
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
Float.Type.c:89:
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
Float.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 &&
FloatAllocator(&clone)->effort == FloatAllocator(&original)->effort &&- In
Float.Type.c:91:
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
Float.Type.c:92:
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
Float.Type.c:93:
FloatAllocator(&clone)->deallocate == FloatAllocator(&original)->deallocate &&
FloatAllocator(&clone)->effort == FloatAllocator(&original)->effort &&
FloatAllocator(&clone)->retry_limit == FloatAllocator(&original)->retry_limit;
FloatDeinit(&original);- 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))
Last updated on