Changes a decimal number to a fraction within a given accuracy Examples: dec2frac(%pi,.1) num = 22 den = 7 dec2frac(%pi,.001) num = 106 den = 333 dec2frac(11/19,.001) num = 11 den = 19

Hello David, This function already exists in Scilab: Have a look at rat() Regards Samuel

1. If I cannot find a function immediately, then it might as well not exist. This is one of the problems with Scilab documentation. For example, the following search terms do not get the proper function: dec frac dec2frac When I type if 'rat' the response is 'Floating point rational approximation' which is not a useful description of what I am looking for. I want to convert a decimal number to a fraction. 2. Who said posts in the file exchange have to complement functions in Scilab ?!?

Great work! Regards Nelson

Hi there, I would like to make a check the accuracy on the number of the decimals after the comma, in a matriz. For example I will divide 1 number by another and the result will approximate to 0, it will be like 0.999999934757613 I want the calculation check to be as accurate as 9 points after the comma, so in my calculation the program will check while x <= 0.0000000001 ...run the following code... ANd it will stop when the accuracy reach 9 digits close to 1. Is there a command like this in scilab, i remember at R, this command is epsolon i believe... thank you!

I'm new to SciLab and using it at home to do Linear Algebra homework. In the classroom we are using MatLab which can be configured to show decimal values in fraction format via command "format rat". Since I couldn't find a way to do the same in SciLab I was looking for a way to decimals converted to fraction in SciLab. Where can I get this "dec2frac" function that David Adams posted here? (I was looking for some link to download but didn't find any). How do I install and use it in SciLab? Also, about the native rat() function, how can I use it? The documentation is cryptic and didn't help at all.