mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
0.5.5 features (#1151)
0.5.5 Disallow multiple `_` in a row in digits, e.g. `1__000`. #1138. Fixed toposort example. Struct/union members now correctly rejects members without storage size #1147. `math::pow` will now correctly promote integer arguments. `math::pow` will now correctly promote integer arguments. Added `new_aligned` and `alloc_aligned` functions to prevent accidental under-alignment when allocating simd. Pointer difference would fail where alignment != size (structs etc) #1150. Add test that overalignment actually works for lists. Fixed array calculation for npot2 vectors. Use native aligned alloc on Windows and POSIX. Deprecates "offset". Simplification of the Allocator interface.
This commit is contained in:
committed by
GitHub
parent
b7f4fd9074
commit
7ea3d230bb
@@ -144,4 +144,24 @@ fn void! test_trunc() @test
|
||||
$assert @typeis(math::trunc(f), float);
|
||||
double[<5>] vec = { -123.9, 123.9, 0.9, -0.9, 0 };
|
||||
assert(math::trunc(vec) == double[<5>] { -123, 123, 0, 0, 0 });
|
||||
}
|
||||
|
||||
fn void! test_round_decimals() @test
|
||||
{
|
||||
double d = 0.532451241142;
|
||||
float d_f = 0.532451241142;
|
||||
assert(math::round_to_decimals(d, 2) == 0.53);
|
||||
assert(math::round_to_decimals(d, 5) == 0.53245);
|
||||
|
||||
assert(math::round_to_decimals(d_f, 2) == 0.53f);
|
||||
assert(math::round_to_decimals(d_f, 5) == 0.53245f);
|
||||
}
|
||||
|
||||
fn void! test() @test
|
||||
{
|
||||
double radians = math::deg_to_rad(45);
|
||||
float radians_f = (float)math::deg_to_rad(45);
|
||||
|
||||
assert(math::round_to_decimals(radians, 3) == 0.785);
|
||||
assert(math::round_to_decimals(radians_f, 3) == 0.785f);
|
||||
}
|
||||
Reference in New Issue
Block a user