Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65751 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31068 invoked from network); 10 Feb 2013 07:52:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Feb 2013 07:52:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=remi@fedoraproject.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=remi@fedoraproject.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fedoraproject.org from 212.27.42.5 cause and error) X-PHP-List-Original-Sender: remi@fedoraproject.org X-Host-Fingerprint: 212.27.42.5 smtp5-g21.free.fr Linux 2.6 Received: from [212.27.42.5] ([212.27.42.5:34838] helo=smtp5-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/E1-20900-CC157115 for ; Sun, 10 Feb 2013 02:52:47 -0500 Received: from dixsept.famillecollet.com (unknown [82.241.130.121]) by smtp5-g21.free.fr (Postfix) with ESMTP id 5766ED480D7 for ; Sun, 10 Feb 2013 08:52:38 +0100 (CET) Message-ID: <511751C5.1020906@fedoraproject.org> Date: Sun, 10 Feb 2013 08:52:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: PHP Internals References: <511666DE.8080809@fedoraproject.org> <51172819.4000806@sugarcrm.com> <51174790.8040805@fedoraproject.org> In-Reply-To: <51174790.8040805@fedoraproject.org> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] double val to long val conversion issue From: remi@fedoraproject.org (Remi Collet) One more test (to get rid of compiler optimization) int main (int argc, char *argv[]) { double d; if (argc>1 && sscanf(argv[1], "%lg", &d)) { printf(" double=%.20lg\n", d); printf(" signed=%lx\n", (long)d); printf("unsigned=%lx\n", (unsigned long)d); } return 0; } On x86_64 (so, with or without -O2) $ gcc -O2 -Wall math2.c -o math2 && ./math2 9223372036854775807 double=9223372036854775808 signed=8000000000000000 unsigned=8000000000000000 On ppc64 $ gcc -O2 -Wall math2.c -o math2 && ./math2 9223372036854775807 double=9223372036854775808 signed=0x7fffffffffffff unsigned=8000000000000000 Remi.