[php] fout in round functie?

Pagina: 1
Acties:
  • 27 views sinds 30-01-2008

  • TangLeFuzZ
  • Registratie: Juni 2001
  • Laatst online: 23-08 15:45
Hey,

probeer dit eens uit:

PHP:
1
2
    $test1 = round(1.905, 2);
    $test2 = round(9.405, 2);


Uit de var $test1 zal 1.91 komen, maar uit de var $test2 komt 9.40 :?

Weet iemand misschien waar dit door komt?

  • drm
  • Registratie: Februari 2001
  • Laatst online: 09-06-2025

drm

f0pc0dert

http://www.php.net/manual/en/function.round.php

Lees de user notes even door :) Wordt e.e.a. uitgelegd over floating point storage. en daarmee de oorzaak van dit verschijnsel :)

Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz


Dit topic is gesloten.