Skip to content

ziglibs/zigfp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZigFP - Fixed Point Arithmetic

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 });

About

Basic fixed point implementation in Zig.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages