FloatFromStr
Description
Compatibility wrapper for FloatTryFromStr(...).
Success
Returns Parsed floating-point value, or zero on failure.
Failure
Returns a zero-initialised Float on a malformed string, an exponent overflow, or an allocation failure. Use FloatTryFromStr(...) when explicit failure propagation is required.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Compare.c:46:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("1.23", &alloc.base);
Float b = FloatFromStr("123e-2", &alloc.base);
Float c = FloatFromStr("-1.23", &alloc.base);- In
Compare.c:47:
Float a = FloatFromStr("1.23", &alloc.base);
Float b = FloatFromStr("123e-2", &alloc.base);
Float c = FloatFromStr("-1.23", &alloc.base);- In
Compare.c:48:
Float a = FloatFromStr("1.23", &alloc.base);
Float b = FloatFromStr("123e-2", &alloc.base);
Float c = FloatFromStr("-1.23", &alloc.base);
bool result = FloatCompare(&a, &b) == 0;- In
Compare.c:67:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);
Float b = FloatFromStr(FLOAT_TEST_VERY_LARGE_TWOS, &alloc.base);
Float c = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);- In
Compare.c:68:
Float a = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);
Float b = FloatFromStr(FLOAT_TEST_VERY_LARGE_TWOS, &alloc.base);
Float c = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);- In
Compare.c:69:
Float a = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);
Float b = FloatFromStr(FLOAT_TEST_VERY_LARGE_TWOS, &alloc.base);
Float c = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);
bool result = FloatLT(&a, &b);- In
Compare.c:88:
DefaultAllocator alloc = DefaultAllocatorInit();
Float large = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);
Float negative_large = FloatFromStr("-" FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);
Float small = FloatFromStr("2.5", &alloc.base);- In
Compare.c:89:
Float large = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);
Float negative_large = FloatFromStr("-" FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);
Float small = FloatFromStr("2.5", &alloc.base);- In
Compare.c:90:
Float large = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);
Float negative_large = FloatFromStr("-" FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);
Float small = FloatFromStr("2.5", &alloc.base);
bool result = FloatGT(&large, &small);- In
Compare.c:108:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("-2", &alloc.base);
Float b = FloatFromStr("0.5", &alloc.base);
Float expected = FloatFromStr("5e-1", &alloc.base);- In
Compare.c:109:
Float a = FloatFromStr("-2", &alloc.base);
Float b = FloatFromStr("0.5", &alloc.base);
Float expected = FloatFromStr("5e-1", &alloc.base);- In
Compare.c:110:
Float a = FloatFromStr("-2", &alloc.base);
Float b = FloatFromStr("0.5", &alloc.base);
Float expected = FloatFromStr("5e-1", &alloc.base);
bool result = FloatLT(&a, &b);- In
Compare.c:131:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("12.5", &alloc.base);
Float same = FloatFromStr("12.5", &alloc.base);
Int whole = IntFrom(12, &alloc.base);- In
Compare.c:132:
Float value = FloatFromStr("12.5", &alloc.base);
Float same = FloatFromStr("12.5", &alloc.base);
Int whole = IntFrom(12, &alloc.base);
Int next = IntFrom(13, &alloc.base);- In
Compare.c:164:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("1.23", &alloc.base);
Float b = FloatFromStr("123e-2", &alloc.base);
Float zero1 = FloatFromStr("0", &alloc.base);- In
Compare.c:165:
Float a = FloatFromStr("1.23", &alloc.base);
Float b = FloatFromStr("123e-2", &alloc.base);
Float zero1 = FloatFromStr("0", &alloc.base);
Float zero2 = FloatFromStr("0", &alloc.base);- In
Compare.c:166:
Float a = FloatFromStr("1.23", &alloc.base);
Float b = FloatFromStr("123e-2", &alloc.base);
Float zero1 = FloatFromStr("0", &alloc.base);
Float zero2 = FloatFromStr("0", &alloc.base);- In
Compare.c:167:
Float b = FloatFromStr("123e-2", &alloc.base);
Float zero1 = FloatFromStr("0", &alloc.base);
Float zero2 = FloatFromStr("0", &alloc.base);
bool result = (float_hash(&a, 0) == float_hash(&b, 0));- In
Compare.c:187:
DefaultAllocator alloc = DefaultAllocatorInit();
Float pos = FloatFromStr("1.5e3", &alloc.base);
Float neg = FloatFromStr("-1.5e3", &alloc.base);
Float small = FloatFromStr("1.5e2", &alloc.base);- In
Compare.c:188:
Float pos = FloatFromStr("1.5e3", &alloc.base);
Float neg = FloatFromStr("-1.5e3", &alloc.base);
Float small = FloatFromStr("1.5e2", &alloc.base);
Float zero = FloatFromStr("0", &alloc.base);- In
Compare.c:189:
Float pos = FloatFromStr("1.5e3", &alloc.base);
Float neg = FloatFromStr("-1.5e3", &alloc.base);
Float small = FloatFromStr("1.5e2", &alloc.base);
Float zero = FloatFromStr("0", &alloc.base);
Float one = FloatFromStr("1", &alloc.base);- In
Compare.c:190:
Float neg = FloatFromStr("-1.5e3", &alloc.base);
Float small = FloatFromStr("1.5e2", &alloc.base);
Float zero = FloatFromStr("0", &alloc.base);
Float one = FloatFromStr("1", &alloc.base);- In
Compare.c:191:
Float small = FloatFromStr("1.5e2", &alloc.base);
Float zero = FloatFromStr("0", &alloc.base);
Float one = FloatFromStr("1", &alloc.base);
u64 h_pos = float_hash(&pos, 0);- In
Compare.c:223:
Map(Float, u64) counts = MapInit(float_hash, float_compare, &alloc);
Float k1 = FloatFromStr("3.14", &alloc.base);
Float k2 = FloatFromStr("2.71", &alloc.base);
MapInsertR(&counts, k1, 1u);- In
Compare.c:224:
Float k1 = FloatFromStr("3.14", &alloc.base);
Float k2 = FloatFromStr("2.71", &alloc.base);
MapInsertR(&counts, k1, 1u);
MapInsertR(&counts, k2, 2u);- In
Compare.c:228:
MapInsertR(&counts, k2, 2u);
Float probe = FloatFromStr("314e-2", &alloc.base); // same value as k1
u64 *got = MapGetFirstPtr(&counts, probe);
Float missing = FloatFromStr("9.99", &alloc.base);- In
Compare.c:230:
Float probe = FloatFromStr("314e-2", &alloc.base); // same value as k1
u64 *got = MapGetFirstPtr(&counts, probe);
Float missing = FloatFromStr("9.99", &alloc.base);
u64 *gone = MapGetFirstPtr(&counts, missing);- In
Compare.c:288:
DefaultAllocator alloc = DefaultAllocatorInit();
Float v = FloatFromStr("3", &alloc.base);
Int i3 = IntFrom(3, &alloc.base);
bool err = true;- In
Compare.c:363:
DefaultAllocator alloc = DefaultAllocatorInit();
Float lhs = FloatFromStr("5", &alloc.base);
int cmp = FloatCompare(&lhs, (u64)3);- In
Compare.c:379:
DefaultAllocator alloc = DefaultAllocatorInit();
Float lhs = FloatFromStr("5", &alloc.base);
int cmp = FloatCompare(&lhs, (u64)5);- In
Compare.c:395:
DefaultAllocator alloc = DefaultAllocatorInit();
Float lhs = FloatFromStr("5", &alloc.base);
int cmp = FloatCompare(&lhs, (u64)9);- In
Compare.c:413:
DefaultAllocator alloc = DefaultAllocatorInit();
Float lhs = FloatFromStr("7", &alloc.base);
bool error = true;
int cmp = FloatCompare(&lhs, (u64)2, &error);- In
Compare.c:429:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("1.5", &alloc.base);
Float b = FloatFromStr("2.5", &alloc.base);
bool err = true;- In
Compare.c:430:
Float a = FloatFromStr("1.5", &alloc.base);
Float b = FloatFromStr("2.5", &alloc.base);
bool err = true;- In
Compare.c:448:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("3", &alloc.base); // non-zero
Float b = FloatFromStr("0", &alloc.base); // zero
- In
Compare.c:449:
Float a = FloatFromStr("3", &alloc.base); // non-zero
Float b = FloatFromStr("0", &alloc.base); // zero
int cmp = FloatCompare(&a, &b);- In
Compare.c:466:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("0", &alloc.base); // zero
Float b = FloatFromStr("4", &alloc.base); // non-zero
- In
Compare.c:467:
Float a = FloatFromStr("0", &alloc.base); // zero
Float b = FloatFromStr("4", &alloc.base); // non-zero
int cmp = FloatCompare(&a, &b);- In
Compare.c:484:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("-5", &alloc.base);
Float b = FloatFromStr("-2", &alloc.base);- In
Compare.c:485:
Float a = FloatFromStr("-5", &alloc.base);
Float b = FloatFromStr("-2", &alloc.base);
int cmp = FloatCompare(&a, &b); // -5 < -2 -> -1
- In
Compare.c:501:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("-2", &alloc.base);
Float b = FloatFromStr("-5", &alloc.base);- In
Compare.c:502:
Float a = FloatFromStr("-2", &alloc.base);
Float b = FloatFromStr("-5", &alloc.base);
int cmp = FloatCompare(&a, &b); // -2 > -5 -> 1
- In
Compare.c:524:
DefaultAllocator alloc = DefaultAllocatorInit();
Float lhs = FloatFromStr("7", &alloc.base);
Int less = IntFrom(3, &alloc.base);
Int same = IntFrom(7, &alloc.base);- In
Compare.c:559:
DefaultAllocator alloc = DefaultAllocatorInit();
Float lhs = FloatFromStr("-4", &alloc.base);
bool error = true;- In
Compare.c:588:
DefaultAllocator alloc = DefaultAllocatorInit();
Float lhs = FloatFromStr("0.5", &alloc.base);
bool error = true;- In
Compare.c:617:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("1", &alloc.base); // significand 1, exponent 0
Float b = FloatFromStr("1e2", &alloc.base); // significand 1, exponent 2
- In
Compare.c:618:
Float a = FloatFromStr("1", &alloc.base); // significand 1, exponent 0
Float b = FloatFromStr("1e2", &alloc.base); // significand 1, exponent 2
// Construction guard: identical significand, exponents differ only in low
- In
Compare.c:641:
DefaultAllocator alloc = DefaultAllocatorInit();
Float pos = FloatFromStr("3.14", &alloc.base);
Float neg = FloatFromStr("-3.14", &alloc.base);- In
Compare.c:642:
Float pos = FloatFromStr("3.14", &alloc.base);
Float neg = FloatFromStr("-3.14", &alloc.base);
bool distinct = float_hash(&pos, 0) != float_hash(&neg, 0);- In
Compare.c:659:
DefaultAllocator alloc = DefaultAllocatorInit();
Float pos = FloatFromStr("2", &alloc.base);
Float neg = FloatFromStr("-2", &alloc.base);- In
Compare.c:660:
Float pos = FloatFromStr("2", &alloc.base);
Float neg = FloatFromStr("-2", &alloc.base);
bool distinct = float_hash(&pos, 0) != float_hash(&neg, 0);- In
Compare.c:681:
DefaultAllocator alloc = DefaultAllocatorInit();
Float one = FloatFromStr("1", &alloc.base);
// Real float_hash(1) == 8811625884996682770; the i<=sizeof mutant yields
- In
Compare.c:699:
DefaultAllocator alloc = DefaultAllocatorInit();
Float zero = FloatFromStr("0", &alloc.base);
// Real float_hash(0) == 16357866887873635513; the i<=sizeof mutant yields
- In
Compare.c:720:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float b = FloatFromStr("1.25", &dbg.base);- In
Compare.c:721:
Float a = FloatFromStr("1.5", &dbg.base);
Float b = FloatFromStr("1.25", &dbg.base);
int cmp = FloatCompare(&a, &b);- In
Compare.c:741:
bool test_compare_int_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("3.5", &dbg.base);
Int b = IntFrom(3, &dbg.base);- In
Compare.c:757:
bool test_compare_u64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("3.5", &dbg.base);
int cmp = FloatCompare(&a, 3u);- In
Compare.c:771:
bool test_compare_i64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("-3.5", &dbg.base);
int cmp = FloatCompare(&a, -3);- In
Compare.c:785:
bool test_compare_f32_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("3.5", &dbg.base);
int cmp = FloatCompare(&a, 3.25f);- In
Compare.c:799:
bool test_compare_f64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("3.5", &dbg.base);
int cmp = FloatCompare(&a, 3.25);- In
Type.c:35:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("-123.45", &alloc.base);
FloatClear(&value);- In
Type.c:53:
DefaultAllocator alloc = DefaultAllocatorInit();
Float original = FloatFromStr("-12.5", &alloc.base);
Float clone = FloatClone(&original);
Float expected = FloatFromStr("-12.5", &alloc.base);- In
Type.c:55:
Float original = FloatFromStr("-12.5", &alloc.base);
Float clone = FloatClone(&original);
Float expected = FloatFromStr("-12.5", &alloc.base);
Str text = FloatToStr(&clone);- In
Type.c:85:
// a non-trivial three-bit magnitude that exercises the clone-vs-original
// equality check below.
Float original = FloatFromStr("-0.005", &alloc.base);
Float clone = FloatClone(&original);- In
Type.c:111:
DefaultAllocator alloc = DefaultAllocatorInit();
Float zero = FloatFromStr("0", &alloc.base);
Float big = FloatFromStr("3e5", &alloc.base);
Float r = FloatInit(&alloc.base);- In
Type.c:112:
Float zero = FloatFromStr("0", &alloc.base);
Float big = FloatFromStr("3e5", &alloc.base);
Float r = FloatInit(&alloc.base);- In
Type.c:145:
DefaultAllocator alloc = DefaultAllocatorInit();
Float normalized_zero = FloatFromStr("0", &alloc.base);
Float canonical_zero = FloatInit(&alloc.base);- In
Type.c:174:
DefaultAllocator alloc = DefaultAllocatorInit();
Float neg = FloatFromStr("-5", &alloc.base);
Int out = IntInit(&alloc.base);- In
Type.c:227:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("120", &alloc.base);
Int result = IntInit(&alloc.base);- In
Type.c:248:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("0", &alloc.base);
Int result = IntFromStr("999", &alloc.base);- In
Type.c:266:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("-7", &alloc.base);
Int result = IntInit(&alloc.base);- In
Type.c:350:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("100", &alloc.base); // exp 2
Float b = FloatFromStr("0.1", &alloc.base); // exp -1
Float r = FloatInit(&alloc.base);- In
Type.c:351:
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:372:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("12.5", &alloc.base); // exp -1
Float z = FloatFromStr("0", &alloc.base); // exp 0, zero
Float r = FloatInit(&alloc.base);- In
Type.c:373:
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:76:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("12.5", &alloc.base);
Str text = StrInit(&alloc.base);- In
Math.c:100:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("1.2", &alloc.base);
Float b = FloatFromStr("0.03", &alloc.base);
Float result_value = FloatInit(&alloc.base);- In
Math.c:101:
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:123:
DefaultAllocator alloc = DefaultAllocatorInit();
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);- In
Math.c:124:
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:146:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("1.25", &alloc.base);
Float b = FloatFromStr("0.75", &alloc.base);
Int whole = IntFrom(2, &alloc.base);- In
Math.c:147:
Float a = FloatFromStr("1.25", &alloc.base);
Float b = FloatFromStr("0.75", &alloc.base);
Int whole = IntFrom(2, &alloc.base);
Float result_value = FloatInit(&alloc.base);- In
Math.c:195:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("1.5", &alloc.base);
Float b = FloatFromStr("2", &alloc.base);
Float result_value = FloatInit(&alloc.base);- In
Math.c:196:
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:218:
DefaultAllocator alloc = DefaultAllocatorInit();
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);- In
Math.c:219:
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:241:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("5.5", &alloc.base);
Float b = FloatFromStr("0.5", &alloc.base);
Int whole = IntFrom(2, &alloc.base);- In
Math.c:242:
Float a = FloatFromStr("5.5", &alloc.base);
Float b = FloatFromStr("0.5", &alloc.base);
Int whole = IntFrom(2, &alloc.base);
Float result_value = FloatInit(&alloc.base);- In
Math.c:285:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("12.5", &alloc.base);
Float b = FloatFromStr("-0.2", &alloc.base);
Float result_value = FloatInit(&alloc.base);- In
Math.c:286:
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:308:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, &alloc.base);
Float b = FloatFromStr("2", &alloc.base);
Float result_value = FloatInit(&alloc.base);- In
Math.c:309:
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:331:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("1.5", &alloc.base);
Float b = FloatFromStr("2", &alloc.base);
Int whole = IntFrom(2, &alloc.base);- In
Math.c:332:
Float a = FloatFromStr("1.5", &alloc.base);
Float b = FloatFromStr("2", &alloc.base);
Int whole = IntFrom(2, &alloc.base);
Float result_value = FloatInit(&alloc.base);- In
Math.c:375:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("1", &alloc.base);
Float b = FloatFromStr("8", &alloc.base);
Float result_value = FloatInit(&alloc.base);- In
Math.c:376:
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:398:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr(FLOAT_TEST_VERY_LARGE_TWOS, &alloc.base);
Float b = FloatFromStr("2", &alloc.base);
Float result_value = FloatInit(&alloc.base);- In
Math.c:399:
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:421:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("7.5", &alloc.base);
Float b = FloatFromStr("2.5", &alloc.base);
Int whole = IntFrom(3, &alloc.base);- In
Math.c:422:
Float a = FloatFromStr("7.5", &alloc.base);
Float b = FloatFromStr("2.5", &alloc.base);
Int whole = IntFrom(3, &alloc.base);
Float result_value = FloatInit(&alloc.base);- In
Math.c:470:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("1", &alloc.base);
Float b = FloatInit(&alloc.base);
Float r = FloatInit(&alloc.base);- In
Math.c:496:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("-2", &alloc.base);
Float b = FloatFromStr("5", &alloc.base);
Float result_value = FloatInit(&alloc.base);- In
Math.c:497:
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:524:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("2", &alloc.base);
Float b = FloatFromStr("-5", &alloc.base);
Float result_value = FloatInit(&alloc.base);- In
Math.c:525:
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:550:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("-0.25", &alloc.base);
Float b = FloatFromStr("1.00", &alloc.base);
Float result_value = FloatInit(&alloc.base);- In
Math.c:551:
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:577:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("3e" EXP_HALF_LO, &alloc.base);
Float b = FloatFromStr("3e" EXP_HALF_HI, &alloc.base);
Float r = FloatInit(&alloc.base);- In
Math.c:578:
Float a = FloatFromStr("3e" EXP_HALF_LO, &alloc.base);
Float b = FloatFromStr("3e" EXP_HALF_HI, &alloc.base);
Float r = FloatInit(&alloc.base);- In
Math.c:599:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("3e-" EXP_HALF_HI, &alloc.base);
Float b = FloatFromStr("3e-" EXP_HALF_HI, &alloc.base);
Float r = FloatInit(&alloc.base);- In
Math.c:600:
Float a = FloatFromStr("3e-" EXP_HALF_HI, &alloc.base);
Float b = FloatFromStr("3e-" EXP_HALF_HI, &alloc.base);
Float r = FloatInit(&alloc.base);- In
Math.c:622:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("3e-" EXP_HALF_HI, &alloc.base);
Float b = FloatFromStr("3e" EXP_HALF_HI, &alloc.base);
Float r = FloatInit(&alloc.base);- In
Math.c:623:
Float a = FloatFromStr("3e-" EXP_HALF_HI, &alloc.base);
Float b = FloatFromStr("3e" EXP_HALF_HI, &alloc.base);
Float r = FloatInit(&alloc.base);- In
Math.c:644:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("3e" EXP_HALF_LO, &alloc.base);
Float b = FloatFromStr("3e-" EXP_HALF_HI, &alloc.base);
Float r = FloatInit(&alloc.base);- In
Math.c:645:
Float a = FloatFromStr("3e" EXP_HALF_LO, &alloc.base);
Float b = FloatFromStr("3e-" EXP_HALF_HI, &alloc.base);
Float r = FloatInit(&alloc.base);- In
Math.c:667:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("1", &alloc.base);
Float r = FloatInit(&alloc.base);- In
Math.c:798:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("6", &alloc.base);
Float result = FloatInit(&alloc.base);
Int zero = IntFrom(0u, &alloc.base);- In
Math.c:819:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("6", &alloc.base);
Float result = FloatInit(&alloc.base);- In
Math.c:837:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("6", &alloc.base);
Float result = FloatInit(&alloc.base);- In
Math.c:899:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("6", &alloc.base);
Float b = FloatFromStr("3", &alloc.base);
Float quotient = FloatInit(&alloc.base);- In
Math.c:900:
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:927:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("7.5", &alloc.base);
Float r = FloatInit(&alloc.base);- In
Math.c:948:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("100", &alloc.base);
Float r = FloatInit(&alloc.base);- In
Math.c:969:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("7.5", &alloc.base);
Float r = FloatInit(&alloc.base);
Str text;- In
Math.c:994:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
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);- In
Math.c:995:
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);- In
Math.c:1019:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("2.5", &dbg.base);
Float b = FloatFromStr("3.5", &dbg.base);
Float r = FloatFromStr("123456789", &dbg.base); // pre-populated dest
- In
Math.c:1020:
Float a = FloatFromStr("2.5", &dbg.base);
Float b = FloatFromStr("3.5", &dbg.base);
Float r = FloatFromStr("123456789", &dbg.base); // pre-populated dest
- In
Math.c:1021:
Float a = FloatFromStr("2.5", &dbg.base);
Float b = FloatFromStr("3.5", &dbg.base);
Float r = FloatFromStr("123456789", &dbg.base); // pre-populated dest
bool ok = FloatAdd(&r, &a, &b);- In
Math.c:1042:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("7.25", &dbg.base);
Float b = FloatFromStr("-7.25", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1043:
Float a = FloatFromStr("7.25", &dbg.base);
Float b = FloatFromStr("-7.25", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1068:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1", &dbg.base);
Float b = FloatFromStr("3", &dbg.base);
Float r = FloatFromStr("987654321", &dbg.base); // pre-populated dest
- In
Math.c:1069:
Float a = FloatFromStr("1", &dbg.base);
Float b = FloatFromStr("3", &dbg.base);
Float r = FloatFromStr("987654321", &dbg.base); // pre-populated dest
- In
Math.c:1070:
Float a = FloatFromStr("1", &dbg.base);
Float b = FloatFromStr("3", &dbg.base);
Float r = FloatFromStr("987654321", &dbg.base); // pre-populated dest
bool ok = FloatDiv(&r, &a, &b, 8u);- In
Math.c:1091:
Float a = FloatFrom(0u, &dbg.base);
Float b = FloatFromStr("4", &dbg.base);
Float r = FloatFromStr("55555", &dbg.base); // pre-populated dest
- In
Math.c:1092:
Float a = FloatFrom(0u, &dbg.base);
Float b = FloatFromStr("4", &dbg.base);
Float r = FloatFromStr("55555", &dbg.base); // pre-populated dest
bool ok = FloatDiv(&r, &a, &b, 4u);- In
Math.c:1114:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("2.5", &dbg.base);
Float b = FloatFromStr("4", &dbg.base);
Float r = FloatFromStr("314159265", &dbg.base); // pre-populated dest
- In
Math.c:1115:
Float a = FloatFromStr("2.5", &dbg.base);
Float b = FloatFromStr("4", &dbg.base);
Float r = FloatFromStr("314159265", &dbg.base); // pre-populated dest
- In
Math.c:1116:
Float a = FloatFromStr("2.5", &dbg.base);
Float b = FloatFromStr("4", &dbg.base);
Float r = FloatFromStr("314159265", &dbg.base); // pre-populated dest
bool ok = FloatMul(&r, &a, &b);- In
Math.c:1137:
bool test_add_int_rhs_no_leak(void) {
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:1154:
bool test_add_u64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1169:
bool test_add_i64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1184:
bool test_add_f32_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1199:
bool test_add_f64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1214:
bool test_sub_float_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("5.5", &dbg.base);
Float b = FloatFromStr("1.25", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1215:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("5.5", &dbg.base);
Float b = FloatFromStr("1.25", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1231:
bool test_sub_int_rhs_no_leak(void) {
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:1248:
bool test_sub_u64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("5.5", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1263:
bool test_sub_i64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("5.5", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1278:
bool test_sub_f32_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("5.5", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1293:
bool test_sub_f64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("5.5", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1308:
bool test_mul_int_rhs_no_leak(void) {
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:1325:
bool test_mul_u64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1340:
bool test_mul_i64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1355:
bool test_mul_f32_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1370:
bool test_mul_f64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1.5", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1385:
bool test_div_int_rhs_no_leak(void) {
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:1402:
bool test_div_u64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1417:
bool test_div_i64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1432:
bool test_div_f32_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Math.c:1447:
bool test_div_f64_rhs_no_leak(void) {
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float a = FloatFromStr("1", &dbg.base);
Float r = FloatInit(&dbg.base);- In
Convert.c:105:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("1234500e-2", ALLOCATOR_OF(&alloc));
Int result_value = IntInit(ALLOCATOR_OF(&alloc));
Str text = StrInit(ALLOCATOR_OF(&alloc));- In
Convert.c:125:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("123.45", ALLOCATOR_OF(&alloc));
Int result_value = IntFrom(99, ALLOCATOR_OF(&alloc));- In
Convert.c:142:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("-42", ALLOCATOR_OF(&alloc));
Int result_value = IntFrom(99, ALLOCATOR_OF(&alloc));- In
Convert.c:159:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("-123.45", ALLOCATOR_OF(&alloc));
Str text = FloatToStr(&value);- In
Convert.c:183:
alloc.base.retry_limit = 5;
Float value = FloatFromStr("-123.45", ALLOCATOR_OF(&alloc));
ok = float_try_to_str(&text, &value, ALLOCATOR_OF(&alloc));- In
Convert.c:202:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr(FLOAT_TEST_VERY_LARGE_ONES, ALLOCATOR_OF(&alloc));
Str text = FloatToStr(&value);- In
Convert.c:218:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("1.2300e3", ALLOCATOR_OF(&alloc));
Str text = FloatToStr(&value);- In
Convert.c:230:
bool test_float_from_str_invalid(void) {
WriteFmt("Testing FloatFromStr invalid format handling\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Convert.c:234:
DefaultAllocator alloc = DefaultAllocatorInit();
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:248:
bool test_float_from_str_null(void) {
WriteFmt("Testing FloatFromStr NULL handling\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Convert.c:252:
DefaultAllocator alloc = DefaultAllocatorInit();
FloatFromStr((Zstr)NULL, ALLOCATOR_OF(&alloc));
DefaultAllocatorDeinit(&alloc);
return false;- In
Convert.c:279:
DefaultAllocator alloc = DefaultAllocatorInit();
Float zero = FloatFromStr("0", &alloc.base);
Float neg = FloatFromStr("-7.5", &alloc.base);
Float product = FloatInit(&alloc.base);- In
Convert.c:280:
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:282:
Float neg = FloatFromStr("-7.5", &alloc.base);
Float product = FloatInit(&alloc.base);
Float canon = FloatFromStr("0", &alloc.base);
bool ok = FloatMul(&product, &zero, &neg);- In
Convert.c:459:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("3.14", &alloc.base);
Str text = FloatToStr(&value);- In
Convert.c:481:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("0.001", &alloc.base);
Str text = FloatToStr(&value);- In
Convert.c:500:
// 1e2 keeps significand 1 with exponent 2, exercising the >= 0 zero loop.
Float value = FloatFromStr("1e2", &alloc.base);
Str text = FloatToStr(&value);- In
Convert.c:515:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("3.14", &alloc.base);
Float b = FloatFromStr("3.14", &alloc.base);- In
Convert.c:516:
Float a = FloatFromStr("3.14", &alloc.base);
Float b = FloatFromStr("3.14", &alloc.base);
bool ok = float_hash(&a, 0) == float_hash(&b, 0);- In
Convert.c:536:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("1", &alloc.base); // significand 1, exp 0
Float b = FloatFromStr("1e256", &alloc.base); // significand 1, exp 256
- In
Convert.c:537:
Float a = FloatFromStr("1", &alloc.base); // significand 1, exp 0
Float b = FloatFromStr("1e256", &alloc.base); // significand 1, exp 256
// Construction guards: same magnitude-1 significand, exponents differ only
- In
Convert.c:557:
DefaultAllocator alloc = DefaultAllocatorInit();
Float a = FloatFromStr("1", &alloc.base); // exp 0
Float b = FloatFromStr("1e1", &alloc.base); // exp 1
- In
Convert.c:558:
Float a = FloatFromStr("1", &alloc.base); // exp 0
Float b = FloatFromStr("1e1", &alloc.base); // exp 1
bool built_ok = (FloatExponent(&a) == 0) && (FloatExponent(&b) == 1);- In
Convert.c:713:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float v = FloatFromStr("1e3", &dbg.base); // exponent 3 > 0 -> pow10
Int r = IntInit(&dbg.base);- In
Convert.c:735:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float v = FloatFromStr("12e4", &dbg.base); // significand 12, exp 4
Int r = IntFrom(999999999u, &dbg.base); // pre-populated dest
- In
Convert.c:757:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float v = FloatFromStr("150e-1", &dbg.base); // 15.0, exact integer 15
Int r = IntFrom(777u, &dbg.base); // pre-populated dest
- In
Convert.c:783:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float v = FloatFromStr("1.5", &dbg.base); // significand 15, exponent -1
Int r = IntFrom(777u, &dbg.base); // pre-populated dest
- In
Convert.c:826:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float v = FloatFromStr("12.5", &dbg.base);
Str out = StrInit(&dbg.base);- In
Convert.c:841:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float v = FloatFromStr("1200", &dbg.base); // exponent >= 0 arm
Str out = StrInit(&dbg.base);- In
Convert.c:863:
DebugAllocator dbg = DebugAllocatorInitWith(LEAK_CFG);
Float v = FloatFromStr("99999", &dbg.base); // pre-populated target
bool ok = FloatTryFromStr(&v, "3.14159");- In
Access.c:17:
Float zero = FloatInit(&alloc.base);
Float value = FloatFromStr("0.001", &alloc.base);
bool result = FloatIsZero(&zero);- In
Access.c:33:
DefaultAllocator alloc = DefaultAllocatorInit();
Float neg = FloatFromStr("-42", &alloc.base);
Float pos = FloatFromStr("42", &alloc.base);
Float zero = FloatFromStr("-0.0", &alloc.base);- In
Access.c:34:
Float neg = FloatFromStr("-42", &alloc.base);
Float pos = FloatFromStr("42", &alloc.base);
Float zero = FloatFromStr("-0.0", &alloc.base);- In
Access.c:35:
Float neg = FloatFromStr("-42", &alloc.base);
Float pos = FloatFromStr("42", &alloc.base);
Float zero = FloatFromStr("-0.0", &alloc.base);
bool result = FloatIsNegative(&neg);- In
Access.c:53:
DefaultAllocator alloc = DefaultAllocatorInit();
Float value = FloatFromStr("12.34", &alloc.base);
bool result = FloatExponent(&value) == -2;- In
Write.c:646:
Str output = StrInit(&alloc);
bool success = true;
Float exact = FloatFromStr("1234567890.012345", alloc_base);
Float sci = FloatFromStr("12345.67", alloc_base);
Float short_v = FloatFromStr("1.2", alloc_base);- In
Write.c:647:
bool success = true;
Float exact = FloatFromStr("1234567890.012345", alloc_base);
Float sci = FloatFromStr("12345.67", alloc_base);
Float short_v = FloatFromStr("1.2", alloc_base);- In
Write.c:648:
Float exact = FloatFromStr("1234567890.012345", alloc_base);
Float sci = FloatFromStr("12345.67", alloc_base);
Float short_v = FloatFromStr("1.2", alloc_base);
StrAppendFmt(&output, "{}", exact);- In
Write.c:1981:
Str output = StrInit(&alloc);
bool ok = true;
Float v = FloatFromStr("1.0", alloc_base);
StrAppendFmt(&output, "{e}", v);- In
Write.c:2001:
Str output = StrInit(&alloc);
bool ok = true;
Float v = FloatFromStr("0.0", alloc_base);
StrAppendFmt(&output, "{.0e}", v);- In
Write.c:2023:
Str output = StrInit(&alloc);
bool ok = true;
Float v = FloatFromStr("0.0", alloc_base);
StrAppendFmt(&output, "{.3e}", v);- In
Write.c:2044:
Str output = StrInit(&alloc);
bool ok = true;
Float v = FloatFromStr("12.0", alloc_base);
StrAppendFmt(&output, "{.2e}", v);- In
Write.c:2064:
Str output = StrInit(&alloc);
bool ok = true;
Float v = FloatFromStr("12345.67", alloc_base);
StrAppendFmt(&output, "{e}", v);- In
Write.c:2714:
bool success = true;
Float val = FloatFromStr("12", alloc_base);
Str out;- In
Write.c:2736:
bool success = true;
Float val = FloatFromStr("12", alloc_base);
Str out;- In
Write.c:2759:
bool success = true;
Float val = FloatFromStr("1.5", alloc_base);
Str out;- In
Write.c:2781:
bool success = true;
Float val = FloatFromStr("1.5", alloc_base);
Str out;- In
Write.c:2803:
bool success = true;
Float val = FloatFromStr("1.25", alloc_base);
Str out;- In
Write.c:2951:
Str out = StrInit(&alloc);
Float v = FloatFromStr("1.0", &alloc.base);
StrAppendFmt(&out, "{e}", v);- In
Write.c:2971:
Str out = StrInit(&alloc);
Float v = FloatFromStr("0.001", &alloc.base);
StrAppendFmt(&out, "{e}", v);- In
Write.c:2990:
Str out = StrInit(&alloc);
Float v = FloatFromStr("1e12", &alloc.base);
StrAppendFmt(&out, "{e}", v);- In
Write.c:3633:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str out = StrInit(&alloc);
Float v = FloatFromStr("12345.67", alloc_base);
StrAppendFmt(&out, "{e}", v);- In
Write.c:3652:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str out = StrInit(&alloc);
Float v = FloatFromStr("12345.67", alloc_base);
StrAppendFmt(&out, "{.2e}", v);- In
Write.c:3677:
Allocator *alloc_base = ALLOCATOR_OF(&alloc);
Str out = StrInit(&alloc);
Float v = FloatFromStr("1.2", alloc_base);
StrAppendFmt(&out, "XX");- In
Write.c:4000:
// "1.2" has 1 fractional digit; {.5} requests 5 -> 4 zeros are padded.
Float f = FloatFromStr("1.2", alloc_base);
StrAppendFmt(&out, "{.5}", f);
ok = ok && (ZstrCompare(StrBegin(&out), "1.20000") == 0);- In
Write.c:4005:
StrClear(&out);
Float g = FloatFromStr("3.14", alloc_base);
StrAppendFmt(&out, "{.6}", g);
ok = ok && (ZstrCompare(StrBegin(&out), "3.140000") == 0);- In
Write.c:5266:
Allocator *ab = ALLOCATOR_OF(&alloc);
Str out = StrInit(&alloc);
Float v = FloatFromStr("12345.67", ab);
StrAppendFmt(&out, "{e}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1.234567e+04") == 0);- In
Write.c:5270:
bool ok = (ZstrCompare(StrBegin(&out), "1.234567e+04") == 0);
StrClear(&out);
Float w = FloatFromStr("0.001234", ab);
StrAppendFmt(&out, "{e}", w);
ok = ok && (ZstrCompare(StrBegin(&out), "1.234e-03") == 0);- In
Write.c:5290:
Allocator *ab = ALLOCATOR_OF(&alloc);
Str out = StrInit(&alloc);
Float v = FloatFromStr("1.0", ab);
StrAppendFmt(&out, "{e}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1e+00") == 0);- In
Write.c:5305:
Allocator *ab = ALLOCATOR_OF(&alloc);
Str out = StrInit(&alloc);
Float v = FloatFromStr("2.0", ab);
StrAppendFmt(&out, "{e}", v);
bool ok = (ZstrCompare(StrBegin(&out), "2e+00") == 0);- In
Write.c:5319:
static bool test_float_decimal_no_leak(void) {
DBG_BEGIN(dbg, out);
Float v = FloatFromStr("1234567890.012345", &dbg.base);
StrAppendFmt(&out, "{}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1234567890.012345") == 0);- In
Write.c:5331:
Allocator *ab = ALLOCATOR_OF(&alloc);
Str out = StrInit(&alloc);
Float v = FloatFromStr("3.14159", ab);
StrAppendFmt(&out, "{.2}", v);
bool ok = (ZstrCompare(StrBegin(&out), "3.14") == 0);- In
Write.c:5350:
Allocator *ab = ALLOCATOR_OF(&alloc);
Str out = StrInit(&alloc);
Float v = FloatFromStr("5", ab);
StrAppendFmt(&out, "{.3}", v);
bool ok = (ZstrCompare(StrBegin(&out), "5.000") == 0);- In
Write.c:5361:
static bool test_float_sci_no_leak(void) {
DBG_BEGIN(dbg, out);
Float v = FloatFromStr("12345.67", &dbg.base);
StrAppendFmt(&out, "{e}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1.234567e+04") == 0);- In
Write.c:5374:
Allocator *ab = ALLOCATOR_OF(&alloc);
Str out = StrInit(&alloc);
Float v = FloatFromStr("1.5", ab);
StrAppendFmt(&out, "{}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1.5") == 0);- In
Write.c:5393:
Allocator *ab = ALLOCATOR_OF(&alloc);
Str out = StrInit(&alloc);
Float v = FloatFromStr("1.5", ab);
StrAppendFmt(&out, "AB");
StrAppendFmt(&out, "{>6}", v);- In
Write.c:5492:
bool test_leak_write_float_default_freed(void) {
HeapAllocator fa = HeapAllocatorInit();
Float f = FloatFromStr("12345678901234567890123456789012345678901234567890.5", ALLOCATOR_OF(&fa));
LEAK_WRITE_PRELUDE();
ok = ok && StrAppendFmt(&out, "{}", f) && (StrLen(&out) > 0);- In
Write.c:5517:
// up in dbg's live count.
HeapAllocator fa = HeapAllocatorInit();
Float v = FloatFromStr("12345.67", ALLOCATOR_OF(&fa));
Str out = StrInit(adbg);- In
Write.c:5543:
HeapAllocator fa = HeapAllocatorInit();
Float v = FloatFromStr("0.0", ALLOCATOR_OF(&fa));
Str out = StrInit(adbg);- In
Write.c:5569:
HeapAllocator fa = HeapAllocatorInit();
Float v = FloatFromStr("3.14159", ALLOCATOR_OF(&fa));
Str out = StrInit(adbg);- In
Write.c:5596:
HeapAllocator fa = HeapAllocatorInit();
Float v = FloatFromStr("42", ALLOCATOR_OF(&fa));
Str out = StrInit(adbg);- In
Write.c:5702:
bool test_leak_write_float_freed(void) {
HeapAllocator va = HeapAllocatorInit();
Float v = FloatFromStr("2.718281828", ALLOCATOR_OF(&va));
LEAK_WRITE_PRELUDE();
ok = ok && StrAppendFmt(&out, "{}", v) && (StrLen(&out) > 0);- In
Read.c:2848:
// Seed with a heap-backed Float (wide significand) so the old significand
// storage is visible in dbg's live count before the reassignment.
Float value = FloatFromStr("987654321098765432109876543210.5", adbg);
Zstr input = "2.5";
Last updated on