× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Bob,

This would be a cool one to write... I don't have one but here's how I
would approach it:

1)  Determine what the finest level of measurement you want to return,
i.e. 8th, 16th, 32nd, 64th, etc.

2)  Create a run-time table of the decimal positions.  You only need to
do this for the range of > 0 and < 1.

3)  Strip the decimal value out of your field.

4)  Determine your rounding rules and round the remainder to the nearest
value found in the run-time table.  The position of the array will be
the top half of the fraction, the factor from 1) will be the bottom
half.

5) Divide the fraction down to the smallest valid argument ( 4/16 = 1/4,
etc. )

HTH,

Joel
http://www.rpgnext.com

On Fri, 2003-10-17 at 14:59, Bob O. wrote:
> Does anyone have an example of converting a decimal number to it's 
> fractional equivalent?
> 
> For example:  15.3750 = 15-3/8
> 
> The decimal field to convert is a 10/4 field.  Any help is appreciated.  
> Thanks in advance!
> 
> _________________________________________________________________
> Try MSN Messenger 6.0 with integrated webcam functionality! 
> http://www.msnmessenger-download.com/tracking/reach_webcam
> 
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.


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-2024 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.