PHP returns incorrect total

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 53
Joined: Wed Oct 10, 2012 12:14 am

Wed Nov 07, 2012 10:51 pm

Floating-point data types like DOUBLE are approximate and do not represent exact numbers.

number_format($ may give you better results.

php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Thu Nov 08, 2012 8:23 am

It is better to use the bcmath function for math calculations.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Bing [Bot] and 4 guests