note 47273 deleted from language.types.float by sean

From: Date: Tue, 09 Nov 2004 21:25:03 +0000
Subject: note 47273 deleted from language.types.float by sean
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-80321@lists.php.net to get a copy of this message
Note Submitter: onlineMarcus at hotmail dot com ---- Floating point numbers can't accurately be compared, as noted below (I suppose because of hidden precision). The programers of this manual should note this to keep php programmers from wasting development time! I had to cast the values to a string and then compare them: if ((string)$ordersSubtotal != (string)$subtotal){ etc. } I searched for this as a bug and found that it was reported. But, the report was tagged as "Bogus". It may not technically be a bug, but funtionally it is! Comparisons in all other types work! If the designers know this is an exception, then they should created a function just for floating point comparision and note it in the relative operator and type sections of this manual. ---- Reason: useless note

« previous php.notes (#80321) next »