Re: Problem with calculation....

From: Date: Tue, 23 May 2000 16:00:48 +0000
Subject: Re: Problem with calculation....
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-371@lists.php.net to get a copy of this message
"Jan Dvorak" <jan.dvorak@veda.cz> wrote in message news:392AA3FF.898EBFF6@veda.cz... > Scott, > > That's a large number of steps you're doing, > so you should use the full precision there is > in the floating-point numbers. > > I think you should base the iterative calculation > on the raw previous result rather than the rounded-up value. > Store the results rounded up, but let the calculation go through > with the full precision. > > You'll be surprised how different the results can be. The problem with that is that the results would then not accurately reflect actual payments on a mortgage. When a mortgage is amortized, the results are rounded to the nearest cent for each month. So to be accurate I must do the same. (I did initially allow full floating point numbers, but when I compared the results to an actual amortization table they were off by the second or third month, and by the time I got to the 360th month I was off by almost $3.) Thanks for the input, though. Scott scottn@pnx1.com

« previous php.general (#371) next »