Jonathan Bailey on Wed, 03 Dec 2003 12:02:05 -0600


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [Cialug] PHP Acting weird


I do have that later in the script. My problem is that the unrounded
number is incorrect.

> $tax = round( $subtotal*$taxrate ,2);
>
>
> --- Jonathan Bailey <jonathan@xxxxxxxxx> wrote:
>> Here's my problem:
>>
>> $subtotal = 16.95
>> $taxrate = 0.06
>>
>> $tax = $subtotal*$taxrate
>>
>> The correct (unrounded) number should be:
>> 1.017
>>
>> PHP Outputs:
>> 1.10175
>>
>> Both $subtotal and $taxrate are floats. How do I make it give me correct
>> output?
>>
>>
>>
>> Jon
>>
>> _______________________________________________
>> Cialug mailing list
>> Cialug@xxxxxxxxxx
>> http://cialug.org/mailman/listinfo/cialug
>
>
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/
> _______________________________________________
> Cialug mailing list
> Cialug@xxxxxxxxxx
> http://cialug.org/mailman/listinfo/cialug
>

_______________________________________________
Cialug mailing list
Cialug@xxxxxxxxxx
http://cialug.org/mailman/listinfo/cialug