From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18786 invoked by alias); 24 Jul 2004 12:00:10 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 18691 invoked from network); 24 Jul 2004 12:00:04 -0000 Received: from unknown (HELO mail.ukfsn.org) (217.158.120.143) by sourceware.org with SMTP; 24 Jul 2004 12:00:04 -0000 Received: from localhost (lucy.ukfsn.org [127.0.0.1]) by mail.ukfsn.org (Postfix) with ESMTP id 8E060E6D5B; Sat, 24 Jul 2004 12:57:42 +0100 (BST) Received: from mail.ukfsn.org ([127.0.0.1]) by localhost (lucy.ukfsn.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 09773-07; Sat, 24 Jul 2004 12:57:42 +0100 (BST) Received: from localhost (dsl-80-42-129-220.access.uk.tiscali.com [80.42.129.220]) by mail.ukfsn.org (Postfix) with ESMTP id 4FBBDE6D53; Sat, 24 Jul 2004 12:57:42 +0100 (BST) Received: by localhost with local (Exim 3.35 #1 (Debian)) id 1BoL88-0001ED-00; Sat, 24 Jul 2004 12:55:56 +0100 To: "Joe Hughes" Cc: gcc-help@gcc.gnu.org Subject: Re: Int cast / floating point isuses References: <410163AF.8000307@comcast.net> From: Brian Gough Date: Sat, 24 Jul 2004 12:00:00 -0000 In-Reply-To: "Joe Hughes"'s message of "Fri, 23 Jul 2004 15:14:55 -0400" Message-ID: <878yd9vctv.fsf@network-theory.co.uk> X-SW-Source: 2004-07/txt/msg00237.txt.bz2 "Joe Hughes" writes: > I'm stumped as to what is causing this error to occur for int cast, > especially when lrint and trunc seem to work properly. > > Any insight anyone has would be much appreciated. The default with gcc on x86 is to use 80-bit extended precision registers, compared with 64-bit on the other architecture. It gives a differently rounded result in this case, since the underlying binary representation is on the borderline between -79.937384... and -79.9373839999... Use the rint type functions to round to the nearest integer reliably. -- Brian Gough Network Theory Ltd, Publishing "An Introduction to GCC" --- http://www.network-theory.co.uk/