R: [PHP-GTK] GTK and doubleval
| From: | Dimitri Giardina | Date: | Thu, 11 Sep 2003 10:03:07 +0000 |
| Subject: | R: [PHP-GTK] GTK and doubleval | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-3862@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
these stranges italians ;)
(under win32).
$a = 41.490; (without apices)
$b = 12.50;
C:\tmp>php provafx.php (with apices, without gtk)
53.99
C:\tmp>php provafx.php (with apices, with gtk)
53
C:\tmp>php provafx.php (without apices, without gtk)
53.99
C:\tmp>php provafx.php (without apices, with gtk)
53,99
wow...
i think it's a problem in localizing/printing float numbers.
Dimitri Giardina
> -----Messaggio originale-----
> Da: SIMONE COSCI [mailto:simone@interworld.it]
> Inviato: giovedì 11 settembre 2003 12.05
> A: php-gtk-general@lists.php.net
> Oggetto: [PHP-GTK] GTK and doubleval
>
>
> Hello,
> I' ve found a problem about Variables Types using GTK...
> Try this code using GTK and without them, I' ve different result ...
> I have 2 strings (from DB) $a and $b that represent double values
> ... if I call gettype($a) return String ...
> I have to cast the Strings in Doubles and add $a to $b obtaining $t ...
> Without GTK the result is correct ... 53.99 ...
> if I Uncomment the dl() (loading GTK classes) the result become
> 53 (gtk trim decimals ?)
> Try with doubleval() ... same result ...
>
> /*
> if (!class_exists('gtk')) {
> if (strtoupper(substr(PHP_OS, 0,3) == 'WIN')){
> dl('php_gtk.dll') or Die("dll not found");
> define("BAR","\\");
> define("LFCR","\r\n");
> }else{
> dl('php_gtk.so') or Die("so not found");
> define("BAR","/");
> define("LFCR","\n");
> }
> }
> */
> $a = "41.490";
> $b = "12.50";
> $a = floatval($a);
> $b = floatval($b);
> $t = $a + $b;
> echo floatval($t);
> //gtk::main();
>
> Someone can help ?
>
> Tnx
>
> Simone
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (MingW32)
Comment: For info see http://www.gnupg.org
iEYEARECAAYFAj9gSFcACgkQjbCncHBsBCKxKwCfTIsqi3OGq+yYWYLouQp0r0iT
E2UAoLgR2FzODC4H+ujS/r1rSpZWBNMO
=Cd55
-----END PGP SIGNATURE-----