Rounding sort of ....
Bruce Easton
bruce at stn.com
Thu Aug 23 15:51:44 PDT 2018
I just noticed that you didn't say 'leave whole numbers' for both cases.
If you truly want it to only round in the second case (when cents are le
.50), then you'll need to test each case:
Then: n(3,.2)=frac(4)
If: n lt ".51"
Then: 4=4-".01"; aa(10,.0)=4; 4=aa
If: n ge ".51"
Then: 4=4+"1"
--Bruce
On 8/23/18 6:36 PM, Bruce Easton via Filepro-list wrote:
> Yes. (I'm assuming when you say 'and leave whole numbers' that you
> mean whole dollars since you also mentioned cents.)
>
> You should be able to do it on one line using a dummy field as an
> intermediate result - let's say your field in question is field #4:
>
> Then: 4=4-".01"; aa(10,.0)=4; 4=aa
>
> --Bruce
>
> On 8/23/18 4:34 PM, flowersoft--- via Filepro-list wrote:
>> On a 10,.2 field?
>> -----Original Message-----
>> From: Kenneth Brody via Filepro-list <filepro-list at lists.celestial.com>
>> To: filePro Mailing List <filepro-list at lists.celestial.com>
>> Sent: Sat, Aug 4, 2018 7:09 pm
>> Subject: Re: Rounding sort of ....
>>
>> On 3/6/2018 6:47 PM, Wayne Smith via Filepro-list wrote:
>>> I have a client that wants to take a whole 10,.2 number and if the
>>> cents
>>> are ge .51 add a 1.00 to the total calculation.
>>>
>>> if the cents are le .50 then take away cents and leave whole numbers.
>>>
>>> I have tried some simple things ....in input.prc with no luck ...the
>>> list
>>> is very slow ....one of you brains out there must know a simple math
>>> trick
>>> in fp to solve this ....thanks ahead of time.
>> Yes, I know this is another "oldie"...
>>
>> Since they want the .50 to round down, rather than up, simply subtract a
>> penny from the amount, and let filePro's rounding take care of the rest.
>>
>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
More information about the Filepro-list
mailing list