note 95199 added to function.fmod

From: Date: Thu, 17 Dec 2009 22:14:59 +0000
Subject: note 95199 added to function.fmod
Groups: php.notes 
Request: Send a blank email to php-notes+get-164097@lists.php.net to get a copy of this message
@ linkboss at gmail dot com They are not the same if you are working with floats. The % operator converts the numbers into integers. One example taken from the comments page on Arithmetic Operators: (todd at magnifisites dot com) <?php $dividend = 7; $divisor = 2.4; print $dividend%$divisor; // prints 1 print fmod($dividend, $divisor); // prints 2.2 ?> Several other people have also commented on this "functionality" on the same page ( http://www.php.net/manual/en/language.operators.arithmetic.php). ---- Server IP: 87.124.86.41 Probable Submitter: 94.168.108.176 (proxied: 94.168.108.176) ---- Manual Page -- http://www.php.net/manual/en/function.fmod.php Edit -- https://master.php.net/note/edit/95199 Del: integrated -- https://master.php.net/note/delete/95199/integrated Del: useless -- https://master.php.net/note/delete/95199/useless Del: bad code -- https://master.php.net/note/delete/95199/bad+code Del: spam -- https://master.php.net/note/delete/95199/spam Del: non-english -- https://master.php.net/note/delete/95199/non-english Del: in docs -- https://master.php.net/note/delete/95199/in+docs Del: other reasons-- https://master.php.net/note/delete/95199 Reject -- https://master.php.net/note/reject/95199 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164097) next »