Re: Problem with HUGE floating values and fmod
| From: | Curt Zirzow | Date: | Fri, 17 Feb 2006 20:39:31 +0000 |
| Subject: | Re: Problem with HUGE floating values and fmod | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230665@lists.php.net to get a copy of this message | ||
On Fri, Feb 17, 2006 at 06:48:13PM -0000, Marco Almeida wrote:
> Hi there,
>
> I'm trying to calculate check digits for a payment system, using the ISO
> 7064 (MOD 97-10) algorithm, wich is, already translated to PHP:
>
> $check=98-fmod(($num*100),97);
>
> Where $num is a huge number...
>
> Example: 90150123123400043211 should have check digit 51
> In windows calculator: 98 - ( (90150123123400043211 * 100) mod 97) works OK
> and I get 51 as result
>
> In PHP I get 13...
You will need to use GMP or BCMath to do math operations numbers
that size.
See:
http://php.net/language.types.integer.php
Curt.
--
cat .signature: No such file or directory