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



That was our original idea, the important thing was that you have to be
conscious of the number AFTER the decimal points. For example, adding
.0099999 to $27.00000000001 and truncating to 2 decimals would NOT give you
the desired result. (I know -- some would say well that's a given). The
method I mentioned, it makes NO difference  how many decimal points you are
dealing with.



Alan Shore

NBTY, Inc
(631) 244-2000 ext. 5019
AShore@xxxxxxxx


                                                                       
             Booth Martin                                              
             <booth@xxxxxxxxxx                                         
             om>                                                        To
             Sent by:                  RPG programming on the AS400 /  
             rpg400-l-bounces@         iSeries <rpg400-l@xxxxxxxxxxxx> 
             midrange.com                                               cc
                                                                       
                                                                   Subject
             01/18/2006 02:39          Re: Rounding Question           
             PM                                                        
                                                                       
                                                                       
             Please respond to                                         
              RPG programming                                          
              on the AS400 /                                           
                  iSeries                                              
             <rpg400-l@midrang                                         
                  e.com>                                               
                                                                       
                                                                       




Why not just add .0099999 and truncate?


Alan Shore wrote:
> We just went through almost the same scenario, only rounding up to the
next
> penny. For example, if the amount is $27.0200001, the result would be
> $27.03.
> The only time a rounding does NOT occur, is if the amount is to the
penny,
> for example $27.0200000, would be $27.02.
>
> The method I recommend is the following.
> Move the amount to a 0 decimal field
> then compare the 2 decimal to the 0 decimal
> I f the 2 decimal is greater than the 0 decimal, then add $1 to the 0
> decimal,
> for example
>
>
> D Amount          s              9  2
> D Amount0        s              9  0
>
> C                   eval      Amount0 = Amount
> C                    if            Amount > Amount0
> C                    eval     Amount0 = Amount0 + 1
> C                    endif
>
>
>
> Alan Shore
>
> NBTY, Inc
> (631) 244-2000 ext. 5019
> AShore@xxxxxxxx
>
>
>

>              Mike Wills

>              <koldark@xxxxxxxx

>              m>
To
>              Sent by:                  RPG programming on the AS400 /

>              rpg400-l-bounces@         iSeries <rpg400-l@xxxxxxxxxxxx>

>              midrange.com
cc
>

>
Subject
>              01/18/2006 02:06          Rounding Question

>              PM

>

>

>              Please respond to

>               RPG programming

>               on the AS400 /

>                   iSeries

>              <rpg400-l@midrang

>                   e.com>

>

>

>
>
>
>
> Hey, I want to round to the whole dollar. But I am not doing any
> calculation
> on the field, so the EVAL(H) won't work for me. Or will it?
> This is the line I need to modify: "output = %trim(output) + ',' + %char(
> NIBT.balance)". Any good ideas short of writing a subprocedure? The
> NIBT.balance is the dollar amount. This dumps to a CSV file.
>
> --
> Mike Wills
> koldark@xxxxxxxxx
> http://mikewills.name
> Want Gmail? Email koldark+gmail@xxxxxxxxx to get on my waiting list.
>
> "There are 10 types of people in the world: those who understand binary,
> and
> those who don't." -Unknown
> --
> 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.
>
>
>

--
-----------------------------------
Booth Martin
http://martinvt.com
-----------------------------------
--
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 ...

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.