japaric / fpa Goto Github PK
View Code? Open in Web Editor NEWFixed Point Arithmetic
License: Apache License 2.0
Fixed Point Arithmetic
License: Apache License 2.0
Hi @japaric, from looking through the code it appears there aren't any 64 bit representations. Is that true, or am I reading it wrong? There's a lot of macro magic going on so maybe I'm missing it.
I'm looking for a fixed point implementation for a game physics engine I'm working on, and of the several options fpa appears to be the only one with any built-in trig support.
Any plans to support trigonometry (sin,cos,tan,asin,acos,atan) and other common math functions?
Something like libfixmath
As a vectoring-mode cordic is already implemented, a rotation-mode cordic should be easy to do and compute sin/cos....
I use this in many places in my programs. You could also add all the way up to I0F64 - I64F0 once u128 and i128 are stabilized in the coming months
Is there any functions for calculating a vectors magnitude and angle in this library?
I tried using polar() but the results are not what I expected. The following code prints 0.7375122532248497, but it should be 1.41... :
extern crate fpa;
use fpa::I3F29;
fn main() {
let x = I3F29(1_i32).unwrap();
let y = I3F29(1_i32).unwrap();
let (a, _) = x.polar(y);
println!("{}", a);
}
I've also tried different values, but I never get a value that would be the magnitude of the vector.
Thanks for this library!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.