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: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: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:316:
}
*out = FloatInit(alloc);
if (!int_try_from_u64(&out->significand, value, alloc)) {
FloatDeinit(out);- In
Float.c:319:
if (!int_try_from_u64(&out->significand, value, alloc)) {
FloatDeinit(out);
*out = FloatInit(alloc);
return false;
}- In
Float.c:353:
ValidateInt(value);
*out = FloatInit(IntAllocator(value));
if (!IntTryClone(&out->significand, value)) {
FloatDeinit(out);- In
Float.c:356:
if (!IntTryClone(&out->significand, value)) {
FloatDeinit(out);
*out = FloatInit(IntAllocator(value));
return false;
}- In
Float.c:366:
Float result;
result = FloatInit(alloc);
(void)float_try_from_u64_value(&result, value, alloc);
float_normalize(&result);- In
Float.c:373:
Float float_from_i64(i64 value, Allocator *alloc) {
Float result = FloatInit(alloc);
(void)float_try_from_i64_value(&result, value, alloc);- In
Float.c:385:
ValidateInt(value);
(void)alloc;
result = FloatInit(IntAllocator(value));
(void)float_try_from_int_value(&result, value);
float_normalize(&result);- In
Float.c:392:
Float float_from_f32(float value, Allocator *alloc) {
Float result = FloatInit(alloc);
(void)float_try_from_f32_value(&result, value, alloc);- In
Float.c:399:
Float float_from_f64(double value, Allocator *alloc) {
Float result = FloatInit(alloc);
(void)float_try_from_f64_value(&result, value, alloc);- In
Float.c:475:
ValidateFloat(out);
result = FloatInit(FloatAllocator(out));
digits = StrInit(FloatAllocator(out));- In
Float.c:595:
Float float_from_str_zstr(Zstr text, Allocator *alloc) {
Float result = FloatInit(alloc);
(void)float_try_from_str_zstr(&result, text);- In
Float.c:602:
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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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: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:1177:
}
if (FloatIsZero(a)) {
Float zero = FloatInit(FloatAllocator(result));
FloatDeinit(result);- 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: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: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:1257:
bool float_div_f64(Float *result, const Float *a, double b, u64 precision) {
Float rhs = FloatInit(FloatAllocator(result));
bool ok = false;- In
Io.Write.c:992:
DefaultAllocator alloc = DefaultAllocatorInit();
Float f = FloatInit(&alloc.base);
// Distinct sentinel so a no-op (failed) read is observable.
(void)FloatTryFromStr(&f, "99");- In
Io.Write.c:2384:
bool success = true;
Float val = FloatInit(alloc_base);
Zstr z = "3.5;";- In
Io.Write.c:2414:
bool success = true;
Float val = FloatInit(alloc_base);
Zstr z = "12.25";- In
Io.Write.c:2440:
bool success = true;
Float val = FloatInit(alloc_base);
Zstr z = "1.5e2!";- In
Io.Write.c:2466:
bool success = true;
Float val = FloatInit(alloc_base);
Zstr z = "-0.25";- In
Float.Leak.c:177:
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
Float.Leak.c:225:
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
Float.Leak.c:398:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
Int b = IntFrom(2, &dbg.base);- In
Float.Leak.c:415:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatAdd(&r, &a, 2u);- In
Float.Leak.c:430:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatAdd(&r, &a, -2);- In
Float.Leak.c:445:
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
Float.Leak.c:460:
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
Float.Leak.c:476:
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
Float.Leak.c:492:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("5.5", &dbg.base);
Float r = FloatInit(&dbg.base);
Int b = IntFrom(2, &dbg.base);- In
Float.Leak.c:509:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("5.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatSub(&r, &a, 2u);- In
Float.Leak.c:524:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("5.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatSub(&r, &a, -2);- In
Float.Leak.c:539:
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
Float.Leak.c:554:
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
Float.Leak.c:569:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
Int b = IntFrom(4, &dbg.base);- In
Float.Leak.c:586:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatMul(&r, &a, 4u);- In
Float.Leak.c:601:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatMul(&r, &a, -4);- In
Float.Leak.c:616:
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
Float.Leak.c:631:
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
Float.Leak.c:646:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1", &dbg.base);
Float r = FloatInit(&dbg.base);
Int b = IntFrom(4, &dbg.base);- In
Float.Leak.c:663:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatDiv(&r, &a, 4u, 6u);- In
Float.Leak.c:678:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1", &dbg.base);
Float r = FloatInit(&dbg.base);
bool ok = FloatDiv(&r, &a, -4, 6u);- In
Float.Leak.c:693:
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
Float.Leak.c:708:
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
Io.Blind.c:823:
DefaultAllocator alloc = DefaultAllocatorInit();
Allocator *ab = ALLOCATOR_OF(&alloc);
Float f = FloatInit(ab);
(void)FloatTryFromStr(&f, "99"); // sentinel
StrReadFmt(in, "{}", f);- In
Io.Blind.c:1312:
static bool test_read_float_value(void) {
DebugAllocator dbg = DebugAllocatorInit();
Float f = FloatInit(&dbg.base);
Zstr z = "3.14159";
StrReadFmt(z, "{}", f);- In
Io.Blind.c:1328:
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
Float parsed = FloatFromStr("12.3.4", ALLOCATOR_OF(&alloc));
Float value = FloatInit(ALLOCATOR_OF(&alloc));
bool result = !FloatTryFromStr(&value, "12.3.4"); DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatInit(ALLOCATOR_OF(&alloc));
FloatTryFromStr(&value, (Zstr)NULL);
FloatDeinit(&value); Float zero = FloatFromStr("0", &alloc.base);
Float neg = FloatFromStr("-7.5", &alloc.base);
Float product = FloatInit(&alloc.base);
Float canon = FloatFromStr("0", &alloc.base);
Str text = StrInitFromZstr("not-a-number", &alloc.base);
Float value = FloatInit(&alloc.base);
bool ok = (FloatTryFromStr(&value, &text) == false);
Str text = StrInitFromZstr("3.14", &alloc.base);
Float value = FloatInit(&alloc.base);
bool ok = FloatTryFromStr(&value, &text); DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatInit(&alloc.base);
bool ok = (FloatTryFromStr(&value, ".") == false); DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatInit(&alloc.base);
bool ok = (FloatTryFromStr(&value, "+.") == false); DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatInit(&alloc.base);
bool ok = FloatTryFromStr(&value, "1.");- In
Float.Math.c:64:
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
Float.Math.c:87:
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
Float.Math.c:111:
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
Float.Math.c:159:
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
Float.Math.c:182:
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
Float.Math.c:206:
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
Float.Math.c:249:
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
Float.Math.c:272:
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
Float.Math.c:296:
Float b = FloatFromStr("2", &alloc.base);
Int whole = IntFrom(2, &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Float.Math.c:339:
Float a = FloatFromStr("1", &alloc.base);
Float b = FloatFromStr("8", &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Float.Math.c:362:
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
Float.Math.c:386:
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
Float.Math.c:433:
Float a = FloatFromStr("1", &alloc.base);
Float b = FloatInit(&alloc.base);
Float r = FloatInit(&alloc.base);
bool ok;- In
Float.Math.c:434:
Float a = FloatFromStr("1", &alloc.base);
Float b = FloatInit(&alloc.base);
Float r = FloatInit(&alloc.base);
bool ok;- In
Float.Math.c:460:
Float a = FloatFromStr("-2", &alloc.base);
Float b = FloatFromStr("5", &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Float.Math.c:488:
Float a = FloatFromStr("2", &alloc.base);
Float b = FloatFromStr("-5", &alloc.base);
Float result_value = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Float.Math.c:514:
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
Float.Math.c:541:
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
Float.Math.c:563:
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
Float.Math.c:586:
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
Float.Math.c:608:
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
Float.Math.c:630:
Float a = FloatFromStr("1", &alloc.base);
Float r = FloatInit(&alloc.base);
bool ok = !FloatDiv(&r, &a, 0.0, 4);- In
Float.Math.c:761:
Float a = FloatFromStr("6", &alloc.base);
Float result = FloatInit(&alloc.base);
Int zero = IntFrom(0u, &alloc.base);- In
Float.Math.c:782:
Float a = FloatFromStr("6", &alloc.base);
Float result = FloatInit(&alloc.base);
bool ok = FloatDiv(&result, &a, (signed long long)0, 4);- In
Float.Math.c:800:
Float a = FloatFromStr("6", &alloc.base);
Float result = FloatInit(&alloc.base);
bool ok = FloatDiv(&result, &a, 0.0f, 4);- In
Float.Math.c:820:
DefaultAllocator alloc = DefaultAllocatorInit();
Float f = FloatInit(&alloc.base);
bool ok = FloatTryFromStr(&f, "+5");
Str text = StrInit(&alloc.base);- In
Float.Math.c:842:
DefaultAllocator alloc = DefaultAllocatorInit();
Float f = FloatInit(&alloc.base);
bool ok = FloatTryFromStr(&f, "19");
Str text = StrInit(&alloc.base);- In
Float.Math.c:863:
Float a = FloatFromStr("6", &alloc.base);
Float b = FloatFromStr("3", &alloc.base);
Float quotient = FloatInit(&alloc.base);
Str text = StrInit(&alloc.base);- In
Float.Math.c:890:
Float a = FloatFromStr("7.5", &alloc.base);
Float r = FloatInit(&alloc.base);
bool ok = (FloatDiv(&r, &a, 0u, 4) == false);- In
Float.Math.c:911:
Float a = FloatFromStr("100", &alloc.base);
Float r = FloatInit(&alloc.base);
bool ok = !FloatDiv(&r, &a, 0u, 4);- In
Float.Math.c:932:
Float a = FloatFromStr("7.5", &alloc.base);
Float r = FloatInit(&alloc.base);
Str text;- In
Float.Type.c:15:
bool test_float_init(void) {
WriteFmt("Testing FloatInit\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Float.Type.c:19:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatInit(&alloc.base);
bool result = FloatIsZero(&value);- In
Float.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
Float.Type.c:146:
Float normalized_zero = FloatFromStr("0", &alloc.base);
Float canonical_zero = FloatInit(&alloc.base);
// Sanity: both are zero.
- In
Float.Type.c:286:
DefaultAllocator alloc = DefaultAllocatorInit();
Float f = FloatInit(&alloc.base);
bool ok = FloatTryFromStr(&f, "1E2");
Str text = StrInit(&alloc.base);- In
Float.Type.c:310:
DefaultAllocator alloc = DefaultAllocatorInit();
Float f = FloatInit(&alloc.base);
bool ok = FloatTryFromStr(&f, "1e-9223372036854775808");
const i64 minexp = (i64)(-9223372036854775807LL - 1);- In
Float.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
Float.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); DefaultAllocator alloc = DefaultAllocatorInit();
Float zero = FloatInit(&alloc.base);
Float value = FloatFromStr("0.001", &alloc.base);- In
Io.Read.c:966:
bool success = true;
Float dec = FloatInit(alloc_base);
Float sci = FloatInit(alloc_base);
Float neg = FloatInit(alloc_base);- In
Io.Read.c:967:
Float dec = FloatInit(alloc_base);
Float sci = FloatInit(alloc_base);
Float neg = FloatInit(alloc_base);- In
Io.Read.c:968:
Float dec = FloatInit(alloc_base);
Float sci = FloatInit(alloc_base);
Float neg = FloatInit(alloc_base);
Str dec_text = StrInit(&alloc);- In
Io.Leak.c:465:
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