For Programmers: Free Programming Magazines  


Home > Archive > PHP Questions and Answers > April 2007 > RE: [PHP-DEV] Re: [fw-general] Re: [PHP-DEV] ZF 0.8.0 Unit Tests behaving different o









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author RE: [PHP-DEV] Re: [fw-general] Re: [PHP-DEV] ZF 0.8.0 Unit Tests behaving different o
Dmitry Stogov

2007-04-18, 3:57 am

Tricky code - tricky result. Do you think php-5.1 result is perfect? :)

BTW the difference is in implementation of %G format specifier.

It seems, now it tries to produce the shortest string representation of
float (I cannot remember why), but this is not conformed to POSIX
specification

Linux man:
g,G The double argument is converted in style f or e (or F or E =
for
G conversions). The precision specifies the number of
signifi-
cant digits. If the precision is missing, 6 digits are
given;
if the precision is zero, it is treated as 1. Style e =
is
used
if the exponent from its conversion is less than -4 or
greater
than or equal to the precision. Trailing zeros are =
removed
from
the fractional part of the result; a decimal point appears
only
if it is followed by at least one digit.

Probably it should be fixed.

Thanks. Dmitry.

> -----Original Message-----
> From: Sebastian Nohn [mailto:sebastian@nohn.net]=20
> Sent: Tuesday, April 17, 2007 10:16 PM
> To: Dmitry Stogov
> Cc: 'Thomas Weidner'; 'Antony Dovgal'; 'Zend Framework=20
> General'; ilia@php.net; php-qa@lists.php.net; internals@lists.php.net
> Subject: Re: [PHP-DEV] Re: [fw-general] Re: [PHP-DEV] ZF=20
> 0.8.0 Unit Tests behaving different on PHP 5.2.1 and PHP 5.2.2-dev
>=20
>=20
> Dmitry Stogov wrote:
>=20
> because they=20
>=20
> <?php
> $a =3D 6900000000;
> $b =3D $a."";
> printf("%d", $a); echo "\n";
> printf("%d", $b); echo "\n";
> ?>
>=20
> PHP 5.2.1:
>=20
> -1689934592
> 2147483647
>=20
> PHP 5.2.2:
>=20
> -1689934592
> 6
>=20
> - Sebastian
>=20
> --=20
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>=20

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com