FloatInit
Description
Initialize a Float (numeric value 0). Inside a Scope block the allocator argument may be omitted (MisraScope is used). Otherwise pass a typed allocator handle or a raw Allocator *.
Usage example (from documentation)
Scope(alloc, DefaultAllocator) {
Float value = FloatInit();
...
}Success
Returns a numerically-zero Float (sign positive, significand zero, exponent 0) bound to the chosen allocator.
Failure
Cannot fail at construction; first allocator OOM surfaces from later math/grow.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Io.c:3407:
temp = StrInit(FloatAllocator(value));
parsed = FloatInit(FloatAllocator(value));
if (float_fmt_uses_unsupported_flags(fmt_info)) {- In
Float.c:59:
LOG_FATAL("Invalid arguments");
}
*out = FloatInit(alloc);
out->negative = negative;- 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: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:344:
}
*out = FloatInit(alloc);
if (!int_try_from_u64(&out->significand, value, alloc)) {
FloatDeinit(out);- In
Float.c:347:
if (!int_try_from_u64(&out->significand, value, alloc)) {
FloatDeinit(out);
*out = FloatInit(alloc);
return false;
}- In
Float.c:381:
ValidateInt(value);
*out = FloatInit(IntAllocator(value));
if (!IntTryClone(&out->significand, value)) {
FloatDeinit(out);- In
Float.c:384:
if (!IntTryClone(&out->significand, value)) {
FloatDeinit(out);
*out = FloatInit(IntAllocator(value));
return false;
}- In
Float.c:394:
Float result;
result = FloatInit(alloc);
(void)float_try_from_u64_value(&result, value, alloc);
float_normalize(&result);- In
Float.c:401:
Float float_from_i64(i64 value, Allocator *alloc) {
Float result = FloatInit(alloc);
(void)float_try_from_i64_value(&result, value, alloc);- In
Float.c:413:
ValidateInt(value);
(void)alloc;
result = FloatInit(IntAllocator(value));
(void)float_try_from_int_value(&result, value);
float_normalize(&result);- In
Float.c:420:
Float float_from_f32(float value, Allocator *alloc) {
Float result = FloatInit(alloc);
(void)float_try_from_f32_value(&result, value, alloc);- In
Float.c:427:
Float float_from_f64(double value, Allocator *alloc) {
Float result = FloatInit(alloc);
(void)float_try_from_f64_value(&result, value, alloc);- In
Float.c:503:
ValidateFloat(out);
result = FloatInit(FloatAllocator(out));
digits = StrInit(FloatAllocator(out));- In
Float.c:623:
Float float_from_str_zstr(Zstr text, Allocator *alloc) {
Float result = FloatInit(alloc);
(void)float_try_from_str_zstr(&result, text);- In
Float.c:630:
Float float_from_str_str(const Str *text, Allocator *alloc) {
Float result = FloatInit(alloc);
(void)float_try_from_str_str(&result, text);- 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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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:1205:
}
if (FloatIsZero(a)) {
Float zero = FloatInit(FloatAllocator(result));
FloatDeinit(result);- 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: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: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:1285:
bool float_div_f64(Float *result, const Float *a, double b, u64 precision) {
Float rhs = FloatInit(FloatAllocator(result));
bool ok = false;- In
Type.c:15:
bool test_float_init(void) {
WriteFmt("Testing FloatInit\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Type.c:19:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatInit(&alloc.base);
bool result = FloatIsZero(&value);- In
Type.c:113:
Float zero = FloatFromStr("0", &alloc.base);
Float big = FloatFromStr("3e5", &alloc.base);
Float r = FloatInit(&alloc.base);
bool ok = FloatMul(&r, &zero, &big);- In
Type.c:146:
Float normalized_zero = FloatFromStr("0", &alloc.base);
Float canonical_zero = FloatInit(&alloc.base);
// Sanity: both are zero.
- In
Type.c:286:
DefaultAllocator alloc = DefaultAllocatorInit();
Float f = FloatInit(&alloc.base);
bool ok = FloatTryFromStr(&f, "1E2");
Str text = StrInit(&alloc.base);- In
Type.c:310:
DefaultAllocator alloc = DefaultAllocatorInit();
Float f = FloatInit(&alloc.base);
bool ok = FloatTryFromStr(&f, "1e-9223372036854775808");
const i64 minexp = (i64)(-9223372036854775807LL - 1);- In
Type.c:352:
Float a = FloatFromStr("100", &alloc.base); // exp 2
Float b = FloatFromStr("0.1", &alloc.base); // exp -1
Float r = FloatInit(&alloc.base);
Str t = StrInit(&alloc.base);- In
Type.c:374:
Float a = FloatFromStr("12.5", &alloc.base); // exp -1
Float z = FloatFromStr("0", &alloc.base); // exp 0, zero
Float r = FloatInit(&alloc.base);
Str t = StrInit(&alloc.base);- In
Math.c:102:
Float a = FloatFromStr("1.2", &alloc.base);
Float b = FloatFromStr("0.03", &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:125:
Float a = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);
Float b = FloatFromStr(FLOAT_TEST_VERY_LARGE_TWOS, &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:149:
Float b = FloatFromStr("0.75", &alloc.base);
Int whole = IntFrom(2, &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:197:
Float a = FloatFromStr("1.5", &alloc.base);
Float b = FloatFromStr("2", &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:220:
Float a = FloatFromStr(FLOAT_TEST_VERY_LARGE_THREES, &alloc.base);
Float b = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:244:
Float b = FloatFromStr("0.5", &alloc.base);
Int whole = IntFrom(2, &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:287:
Float a = FloatFromStr("12.5", &alloc.base);
Float b = FloatFromStr("-0.2", &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:310:
Float a = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);
Float b = FloatFromStr("2", &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:334:
Float b = FloatFromStr("2", &alloc.base);
Int whole = IntFrom(2, &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:377:
Float a = FloatFromStr("1", &alloc.base);
Float b = FloatFromStr("8", &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:400:
Float a = FloatFromStr(FLOAT_TEST_VERY_LARGE_TWOS, &alloc.base);
Float b = FloatFromStr("2", &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:424:
Float b = FloatFromStr("2.5", &alloc.base);
Int whole = IntFrom(3, &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:471:
Float a = FloatFromStr("1", &alloc.base);
Float b = FloatInit(&alloc.base);
Float r = FloatInit(&alloc.base);
bool ok;- In
Math.c:472:
Float a = FloatFromStr("1", &alloc.base);
Float b = FloatInit(&alloc.base);
Float r = FloatInit(&alloc.base);
bool ok;- In
Math.c:498:
Float a = FloatFromStr("-2", &alloc.base);
Float b = FloatFromStr("5", &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:526:
Float a = FloatFromStr("2", &alloc.base);
Float b = FloatFromStr("-5", &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:552:
Float a = FloatFromStr("-0.25", &alloc.base);
Float b = FloatFromStr("1.00", &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:579:
Float a = FloatFromStr("3e" EXP_HALF_LO, &alloc.base);
Float b = FloatFromStr("3e" EXP_HALF_HI, &alloc.base);
Float r = FloatInit(&alloc.base);
bool ok = FloatMul(&r, &a, &b);- In
Math.c:601:
Float a = FloatFromStr("3e-" EXP_HALF_HI, &alloc.base);
Float b = FloatFromStr("3e-" EXP_HALF_HI, &alloc.base);
Float r = FloatInit(&alloc.base);
bool ok = FloatMul(&r, &a, &b);- In
Math.c:624:
Float a = FloatFromStr("3e-" EXP_HALF_HI, &alloc.base);
Float b = FloatFromStr("3e" EXP_HALF_HI, &alloc.base);
Float r = FloatInit(&alloc.base);
bool ok = FloatDiv(&r, &a, &b, 0);- In
Math.c:646:
Float a = FloatFromStr("3e" EXP_HALF_LO, &alloc.base);
Float b = FloatFromStr("3e-" EXP_HALF_HI, &alloc.base);
Float r = FloatInit(&alloc.base);
bool ok = FloatDiv(&r, &a, &b, 0);- In
Math.c:668:
Float a = FloatFromStr("1", &alloc.base);
Float r = FloatInit(&alloc.base);
bool ok = !FloatDiv(&r, &a, 0.0, 4);- In
Math.c:799:
Float a = FloatFromStr("6", &alloc.base);
Float result = FloatInit(&alloc.base);
Int zero = IntFrom(0u, &alloc.base);- In
Math.c:820:
Float a = FloatFromStr("6", &alloc.base);
Float result = FloatInit(&alloc.base);
bool ok = FloatDiv(&result, &a, (signed long long)0, 4);- In
Math.c:838:
Float a = FloatFromStr("6", &alloc.base);
Float result = FloatInit(&alloc.base);
bool ok = FloatDiv(&result, &a, 0.0f, 4);- In
Math.c:858:
DefaultAllocator alloc = DefaultAllocatorInit();
Float f = FloatInit(&alloc.base);
bool ok = FloatTryFromStr(&f, "+5");
Str text = StrInit(&alloc.base);- In
Math.c:880:
DefaultAllocator alloc = DefaultAllocatorInit();
Float f = FloatInit(&alloc.base);
bool ok = FloatTryFromStr(&f, "19");
Str text = StrInit(&alloc.base);- In
Math.c:901:
Float a = FloatFromStr("6", &alloc.base);
Float b = FloatFromStr("3", &alloc.base);
Float quotient = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:928:
Float a = FloatFromStr("7.5", &alloc.base);
Float r = FloatInit(&alloc.base);
bool ok = (FloatDiv(&r, &a, 0u, 4) == false);- In
Math.c:949:
Float a = FloatFromStr("100", &alloc.base);
Float r = FloatInit(&alloc.base);
bool ok = !FloatDiv(&r, &a, 0u, 4);- In
Math.c:970:
Float a = FloatFromStr("7.5", &alloc.base);
Float r = FloatInit(&alloc.base);
Str text;- In
Math.c:996:
Float a = FloatFromStr("1.5", &dbg.base); // exp -1
Float b = FloatFromStr("0.025", &dbg.base); // exp -3 -> scaling occurs
Float r = FloatInit(&dbg.base);
bool ok = FloatAdd(&r, &a, &b);- In
Math.c:1044:
Float a = FloatFromStr("7.25", &dbg.base);
Float b = FloatFromStr("-7.25", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatAdd(&r, &a, &b);- In
Math.c:1138:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
Int b = IntFrom(2, &dbg.base);- In
Math.c:1155:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatAdd(&r, &a, 2u);- In
Math.c:1170:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatAdd(&r, &a, -2);- In
Math.c:1185:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatAdd(&r, &a, 0.5f);- In
Math.c:1200:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatAdd(&r, &a, 0.25);- In
Math.c:1216:
Float a = FloatFromStr("5.5", &dbg.base);
Float b = FloatFromStr("1.25", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatSub(&r, &a, &b);- In
Math.c:1232:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("5.5", &dbg.base);
Float r = FloatInit(&dbg.base);
Int b = IntFrom(2, &dbg.base);- In
Math.c:1249:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("5.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatSub(&r, &a, 2u);- In
Math.c:1264:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("5.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatSub(&r, &a, -2);- In
Math.c:1279:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("5.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatSub(&r, &a, 0.5f);- In
Math.c:1294:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("5.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatSub(&r, &a, 0.25);- In
Math.c:1309:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
Int b = IntFrom(4, &dbg.base);- In
Math.c:1326:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatMul(&r, &a, 4u);- In
Math.c:1341:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatMul(&r, &a, -4);- In
Math.c:1356:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatMul(&r, &a, 0.5f);- In
Math.c:1371:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatMul(&r, &a, 0.25);- In
Math.c:1386:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1", &dbg.base);
Float r = FloatInit(&dbg.base);
Int b = IntFrom(4, &dbg.base);- In
Math.c:1403:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatDiv(&r, &a, 4u, 6u);- In
Math.c:1418:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatDiv(&r, &a, -4, 6u);- In
Math.c:1433:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatDiv(&r, &a, 4.0f, 6u);- In
Math.c:1448:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatDiv(&r, &a, 4.0, 6u);- In
Convert.c:235:
Float parsed = FloatFromStr("12.3.4", ALLOCATOR_OF(&alloc));
Float value = FloatInit(ALLOCATOR_OF(&alloc));
bool result = !FloatTryFromStr(&value, "12.3.4");- In
Convert.c:262:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatInit(ALLOCATOR_OF(&alloc));
FloatTryFromStr(&value, (Zstr)NULL);
FloatDeinit(&value);- In
Convert.c:281:
Float zero = FloatFromStr("0", &alloc.base);
Float neg = FloatFromStr("-7.5", &alloc.base);
Float product = FloatInit(&alloc.base);
Float canon = FloatFromStr("0", &alloc.base);- In
Convert.c:420:
Str text = StrInitFromZstr("not-a-number", &alloc.base);
Float value = FloatInit(&alloc.base);
bool ok = (FloatTryFromStr(&value, &text) == false);- In
Convert.c:435:
Str text = StrInitFromZstr("3.14", &alloc.base);
Float value = FloatInit(&alloc.base);
bool ok = FloatTryFromStr(&value, &text);- In
Convert.c:577:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatInit(&alloc.base);
bool ok = (FloatTryFromStr(&value, ".") == false);- In
Convert.c:590:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatInit(&alloc.base);
bool ok = (FloatTryFromStr(&value, "+.") == false);- In
Convert.c:603:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatInit(&alloc.base);
bool ok = FloatTryFromStr(&value, "1.");- In
Access.c:16:
DefaultAllocator alloc = DefaultAllocatorInit();
Float zero = FloatInit(&alloc.base);
Float value = FloatFromStr("0.001", &alloc.base);- In
Write.c:993:
DefaultAllocator alloc = DefaultAllocatorInit();
Float f = FloatInit(&alloc.base);
// Distinct sentinel so a no-op (failed) read is observable.
(void)FloatTryFromStr(&f, "99");- In
Write.c:2385:
bool success = true;
Float val = FloatInit(alloc_base);
Zstr z = "3.5;";- In
Write.c:2415:
bool success = true;
Float val = FloatInit(alloc_base);
Zstr z = "12.25";- In
Write.c:2441:
bool success = true;
Float val = FloatInit(alloc_base);
Zstr z = "1.5e2!";- In
Write.c:2467:
bool success = true;
Float val = FloatInit(alloc_base);
Zstr z = "-0.25";- In
Read.c:967:
bool success = true;
Float dec = FloatInit(alloc_base);
Float sci = FloatInit(alloc_base);
Float neg = FloatInit(alloc_base);- In
Read.c:968:
Float dec = FloatInit(alloc_base);
Float sci = FloatInit(alloc_base);
Float neg = FloatInit(alloc_base);- In
Read.c:969:
Float dec = FloatInit(alloc_base);
Float sci = FloatInit(alloc_base);
Float neg = FloatInit(alloc_base);
Str dec_text = StrInit(&alloc);- In
Read.c:2114:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *ab = ALLOCATOR_OF(&alloc);
Float f = FloatInit(ab);
(void)FloatTryFromStr(&f, "99"); // sentinel
StrReadFmt(in, "{}", f);- In
Read.c:2632:
static bool test_read_float_value(void) {
DebugAllocator dbg = DebugAllocatorInit();
Float f = FloatInit(&dbg.base);
Zstr z = "3.14159";
StrReadFmt(z, "{}", f);- In
Read.c:2648:
static bool test_read_float_reject_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInit();
Float f = FloatInit(&dbg.base);
(void)FloatTryFromStr(&f, "42");
Zstr z = "xyz"; // no float token
- In
Read.c:2791:
bool test_leak_read_float_exp_overflow_freed(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float fv = FloatInit(ALLOCATOR_OF(&dbg));
Zstr p = "1e99999999999999999999999999999999999999999999999999";
StrReadFmt(p, "{}", fv);
Last updated on