Scilab Home Page | Wiki | Bug Tracker | Forge | Mailing List Archives | Scilab Online Help | ATOMS
File : Details
Login with GitLab

Decimal to fraction

Changes a decimal number to a fraction
(0 downloads for this version - 0 downloads for all versions)
david adams
david adams
Supported Scilab Version
Creation Date
March 19, 2011
            Changes a decimal number to a fraction within a given accuracy


num = 22
den = 7

num = 106
den = 333

num = 11
den = 19

Files (0)
News (0)
Comments (5)     Leave a comment 
Comment from Samuel Gougeon -- March 22, 2011, 09:30:33 PM    
Hello David,
This function already exists in Scilab: Have a look at rat()
Comment from david adams -- March 22, 2011, 09:36:44 PM    
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:

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

2.  Who said posts in the file exchange have to complement functions in Scilab ?!?

Comment from Nelson Lombardo -- October 4, 2012, 10:49:15 PM    
Great work!
Comment from Felipe Santos -- October 22, 2015, 07:52:21 PM    
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 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 

thank you!
Comment from Wander Stabenow -- March 2, 2016, 04:04:05 AM    
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
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
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.
Leave a comment
You must register and log in before leaving a comment.
Login with GitLab
Email notifications
Send me email when this toolbox has changes, new files or a new release.
You must register and log in before setting up notifications.