Exact rational vector arithmetic.
rat-vec is slow but reliable. You can use it to get quickly and reliably implement geometric algorithms, then go back and smash your head into a wall trying to optimize them with filters and predicates and snap rounding and so on.
This library is built on top of bn.js
var vec =var toFloat =var add =var sub =var dot =
npm i rat-vec
rat-vec is an array of
Converts a vector of
n floating point numbers into an exact rational vector of
n+1 big ints.
vis a vector of floats,
big-rats or strings
Returns A rational vector of big integers
v is a rat-vec
Rounds a vector of big-rats into a
ris a vector of
Returns A vector of
n floats representing the closest representable vector
Returns The vector sum of
Returns The vector difference of
Returns The dot product of
Returns The scalar product of
s is a float, big-rat or string
a divided by the scalar
Linearly interpolate between
b with parameter
Compares the components of
b, returns an array of
0,+1,-1 whose components are the result of comparing each value.
Test if two rational vectors are equal.
Computes the component-wise maximum of
Computes the component-wise minimum of
Computes the component-wise product of
Computes the component-wise reciprocal of
Computes the component-wise quotient of
Computes the additive inverse of
Computes the component-wise absolute value of
(c) 2015, MIT License