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



On Fri, 2006-01-27 at 18:17 -0600, Joe Pluta wrote:
> This is a perfectly fine algorithm.  In the syntax we've been using to date,
> the actual answer for this class of problems is:
> 
>    int((x - delta) / y) * z
> 
> where delta is any sufficiently small number.  "Sufficiently small" simply
> means smaller than the smallest unit of measurement, in this case a penny.
> Thus this will ALWAYS work for any amount with a precision of .01 (or
> greater):
> 
>    Fee = %int( (650 - .001) / 500) * 4.00

Seems like 0.01 to 0.99 here would cause a fee of 0.  In fact, anything
up to 500?

%int( (500 - .001) / 500)
%int( 499.999 / 500)
%int( 0.999998 )
0 

How about (untested): 

feecount = %div($price / 500);
if %rem( $price / 500) > 0;
   feecount = feecount + 1;
endif;

fee = feecount * 4;





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.