From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by listman.redhat.com (Postfix) with ESMTP id 1371E2F6B0 for ; Fri, 29 Sep 2000 10:42:11 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.11.0/8.8.7) id e8TEgAr16774 for axp-list@listman.redhat.com; Fri, 29 Sep 2000 10:42:10 -0400 Received: from voicenet.com (mail11.voicenet.com [207.103.0.37]) by mail.redhat.com (8.11.0/8.8.7) with SMTP id e8TEgAD16770 for ; Fri, 29 Sep 2000 10:42:10 -0400 Received: (qmail 26076 invoked from network); 29 Sep 2000 14:42:09 -0000 Received: from dialpool0913-pri.voicenet.com (HELO voicenet.com) (209.71.88.13) by mail11.voicenet.com with SMTP; 29 Sep 2000 14:42:09 -0000 Message-ID: <39D4AA8B.B2025E56@voicenet.com> Date: Fri, 29 Sep 2000 09:43:23 -0500 From: Uncle George Organization: GatWorks X-Mailer: Mozilla 4.72 [en] (X11; I; Linux 2.2.16 alpha) X-Accept-Language: en MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: long->double->long goes negative References: <051DFF3BBA73D3119A5800A0C95BD021642E65@barracuda.api-networks.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0beta4 Precedence: bulk Reply-To: axp-list@redhat.com List-Id: Linux and Red Hat on Alpha processors I believe u missed the point. The conversion of a float to long/int should have the same sign. There does not appear to be any reason for it whatsoever. It just seems that there is a small set of +FP numbers that will result in negative integers. /gat Rick Gorton wrote: > I suggest that you peruse a copy of ieee754-1985, the ieee floating > point specification for a detailed description of why some of these > things can and do happen. You're working on the edge cases of IEEE, > and those are fairly tricky. A quick rule-of-thumb is that it is fair > to assume that any floating point value can vary by an amount equal to > the value of the least significant bit for any operation. > > /-- 0x7fffffff fffffffe > 0x7fffffff ffffffff > \-- 0x80000000 00000000 > > /-- 0x3fefffff ffffffff > 0x3ff00000 00000000 > \-- 0x3ff00000 00000001 > > Input Input + 0.0e0 > > There are other things which affect the result, such as an odd-even > when to add, and when not to. > Another thing you can look at is paranoia.c (from someplace on the net) > which I think has commentary in the code about what's happening. > Yeah, sometimes it's counter-intuitive. > > Rick > > _______________________________________________ > Axp-list mailing list > Axp-list@redhat.com > https://listman.redhat.com/mailman/listinfo/axp-list