math: re-evaluate float precision namespacing approach #1134

Open
opened 2024-01-06 19:22:33 +00:00 by emidoots · 0 comments
emidoots commented 2024-01-06 19:22:33 +00:00 (Migrated from github.com)

Right now some math functions take a parameter, e.g. math.foo(f32) while other times they are described with a suffix e.g. math.Vec4h for half-precision f16 vector.

A better approach might be a global namespace per precision, e.g.:

const math16 = math.f16;
const math32 = math.f32;
math32.foo();
var v = math16.vec4(0, 0, 0, 0);

While that is worth considering... In any case, we should be consistent and not mix a type parameter foo(f32) and suffixes Vec4h.

Right now some math functions take a parameter, e.g. `math.foo(f32)` while other times they are described with a suffix e.g. `math.Vec4h` for half-precision f16 vector. A better approach might be a global namespace per precision, e.g.: ```zig const math16 = math.f16; const math32 = math.f32; math32.foo(); var v = math16.vec4(0, 0, 0, 0); ``` While that is worth considering... In any case, we should be consistent and not mix a type parameter `foo(f32)` and suffixes `Vec4h`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach#1134
No description provided.