From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15580 invoked by alias); 30 May 2019 17:08:50 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 15255 invoked by uid 89); 30 May 2019 17:08:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_50,KAM_SHORT,SPF_PASS autolearn=ham version=3.3.1 spammy=Tejas, tejas, _Float128, _float128 X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 May 2019 17:08:48 +0000 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "Cc" Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7D24EAF25; Thu, 30 May 2019 17:08:46 +0000 (UTC) From: Martin Jambor To: Tejas Joshi , gcc@gcc.gnu.org Cc: hubicka@ucw.cz Cc: Subject: Re: About GSOC. In-Reply-To: References: User-Agent: Notmuch/0.28.4 (https://notmuchmail.org) Emacs/26.2 (x86_64-suse-linux-gnu) Date: Thu, 30 May 2019 17:08:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2019-05/txt/msg00263.txt.bz2 Hi, On Thu, May 30 2019, Tejas Joshi wrote: > Hello. > I tried to check the values for significand words using _Float128 > using a test program with value larger than 64 bit. > Test program : > > int main () > { > _Float128 x = 18446744073709551617.5; (i.e. 2^64 + 1.5 which is > certainly longer than 64-bit) > _Float128 y = __builtin_roundf128 (x); > } Interesting, I was also puzzled for a moment. But notice that: int main () { _Float128 x = 18446744073709551617.5f128; _Float128 y = __builtin_roundf128 (x); } behaves as expected... the difference is of course the suffix pegged to the literal constant (see https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Floating-Types.html). I would also expect GCC to use a larger type if a constant does not fit into a double, but apparently that does not happen. I would have to check but it is probably the right behavior according to the standard. > > The lower words of significand (sig[1] and sig[0] for 64-bit system) > are still being zero. I haven't included the roundevenf128 yet but > inspecting this on real_round function. I figured out what was going on when I realized that in your testcase, sig[0] was equal to 0x8000000000000000 and so some precision has been lost. Then it was easy to guess that it was because it was represented in a narrower type. Hope this helps, Martin