Jump to content

A strange db calculation error


dodgyJim

Recommended Posts

Hiya,

I have a strange problem. In my db table I have a field called "shipping". It obviously holds a dollar amount.

I am looping through my products and calculating the shipping charges. This is where it gets interesting.

In the db I have an amount like 1.30, when I loop through the query and calculate (shipping * quantity) it screws the amount up.

Shipping = 1.30
Quantity = 2

2 x 1.30 is giving me 2.59999990463
Whatever happened to 2.60?

Any ideas?

cheers.
Link to comment
https://forums.phpfreaks.com/topic/5481-a-strange-db-calculation-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.