×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Are you already doing this in RPG and want to move to SQL? or is this new stuff?

I believe the first step is to decide granularity; is there a desire to get finer than n/32's?
In that case you could adjust/round the decimal to a multiple of .03125
(For instance, where your decimal is .nnnnn: .nnnnnn /.03125 = x, an integer.) Your fraction will be x/32.
Lowering the answer to its lowest common denominator is a loop of:
While remainder of x/2 = 0, divide top & bottom by 2.

On 12/21/2016 11:00 AM, Gerald Magnuson wrote:
I am looking for a sql function that would turn a decimal number to a
fraction.

I found the following, for ORACLE... and tried to make it work for DB2 for
i...
but I am not nearly capable for that...
https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:410098200346123548


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.