Matlab rat function in C language
-
29-10-2019 - |
Question
Do you know how to make a rational approximation of a decimal number in C (similar to rat Matlab function)?
Update
If we want a P/Q approximation of a double number number, a quick fix could be:
int factor=1000000;
P=floor(number*factor);
Q=factor;
The error is less than (number/factor), which is negligible.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow