const Meter = zigfp.FixedPoint(32, 1000); // millimeter precision meter units, using 32 bits
const position_1 = Meter.fromFloat(10); // 10m
const position_2 = position_1.add(Meter.fromFloat(0.01)); // add 1cm
const position_3 = position_2.add(Meter.fromFloat(0.09)); // add 9cm
const distance = position_3.sub(position_1);
std.debug.print("Distance = {}\n", .{ distance });
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Basic fixed point implementation in Zig.
License
ziglibs/zigfp
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Basic fixed point implementation in Zig.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Sponsor this project
Packages 0
No packages published