Q
Q
Quiz2012-05-14 12:04:26
PHP
Quiz, 2012-05-14 12:04:26

floating point difference

$d = 9705.94 - 9702.73;
print_r($d);

> 3.2100000000009 

WTF!?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
sl_bug, 2012-05-14
@sl_bug

habrahabr.ru/post/112953/

Q
Quiz, 2012-05-14
@Quiz

Pleased with the position “I don’t know myself, but I’ll downvote the question.”

L
LastDragon, 2012-05-14
@LastDragon

> What is the solution?
Look towards bcmath (http://ru2.php.net/bcmath)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question