title: PHP function for float or double comarision (bccomp and gmp_cmp)
body: <p>PHP Suggested to use these function for floating point number comparison [<a href="http://php.net/manual/en/language.types.float.php" rel="nofollow">here</a>]</p>
  
  <p><a href="http://php.net/manual/en/function.bccomp.php" rel="nofollow">bccomp</a> — Compare two arbitrary precision numbers</p>
  
  <p><strong><code>int bccomp ( string $left_operand , string $right_operand [, int $scale ] )</code></strong></p>
  
  <p><a href="http://php.net/manual/en/function.gmp-cmp.php" rel="nofollow">gmp_cmp</a> — Compare numbers</p>
  
  <p><strong><code>int gmp_cmp ( resource $a , resource $b )</code></strong></p>
  
  <p>I used <strong>bccomp</strong> but I cant still get correct result:</p>
  
  <pre><code>&lt;?php
  $n1 = bcdiv(1, 2.36, 4);
  $n2 = bcdiv(4237288, 10000000, 4);
  echo bccomp( $n1, $n2, 4); // 0! must be 1
  
  echo "&lt;br&gt;\n";
  var_dump(bcdiv(1, 2.36, 4)); // string(6) "0.4237" 
  
  echo "&lt;br&gt;\n";
  var_dump(bcdiv(4237288, 10000000, 4)); // string(6) "0.4237" 
  
  ?&gt;
  </code></pre>
  
  <p>So far, I knew that the result of 1/2.36 is equal to (0.4237288135593220338983050847457627118644067796610169491525423728813559322033898305084745762711864406......)</p>
  
  <p>Then, how to I know that the number of decimals is great like this?</p>
  
  <p>The possible solution: </p>
  
  <pre><code>$n1 = bcdiv(1, 2.36, 400);
  $n2 = bcdiv(4237288, 10000000, 400);
  echo bccomp( $n1, $n2, 400); //1
  </code></pre>
  
  <p>I think this solution is till not more usable.</p>
  
  <p><strong>Any suggestion?</strong></p>