From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.redhat.com (Postfix) with ESMTP id D743D3F20E for ; Wed, 16 Oct 2002 17:21:47 -0400 (EDT) Received: (from mail@localhost) by int-mx1.corp.redhat.com (8.11.6/8.11.6) id g9GLLlc04835 for axp-list@listman.redhat.com; Wed, 16 Oct 2002 17:21:47 -0400 Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with SMTP id g9GLLlf04831 for ; Wed, 16 Oct 2002 17:21:47 -0400 Received: from tes-mail.jpl.nasa.gov (tes-mail.jpl.nasa.gov [137.78.33.77]) by mx1.redhat.com (8.11.6/8.11.6) with SMTP id g9GL16w16428 for ; Wed, 16 Oct 2002 17:01:06 -0400 Received: by tes-mail.jpl.nasa.gov (Postfix, from userid 1001) id 60D7E6F61; Wed, 16 Oct 2002 14:21:42 -0700 (PDT) To: AXP-LIST@redhat.com, axp-list@redhat.com Subject: Re: g77 real size Message-Id: <20021016212142.60D7E6F61@tes-mail.jpl.nasa.gov> Date: Wed, 16 Oct 2002 14:21:42 -0700 (PDT) From: chu@tes-mail.jpl.nasa.gov (Eugene Chu) 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.0.1 Precedence: bulk Reply-To: axp-list@redhat.com List-Help: List-Post: List-Subscribe: , List-Id: Linux and Red Hat on Alpha processors List-Unsubscribe: , List-Archive: Arkadiy Chapkis wrote: >Sorry for the off-topic, I just wonder if there's a switch for g77 to >make a double precision number out of real fp number (not defined, used >by default). The piece of code > > a=1. > b=a+1./1e12 > c=b-a > write(*,*) c > end > >compiled with g77 cuts off everything after 8 digits left of point. >Since what's left are 8 zeros, the result is 0. > >I got the (almost) right result using Compaq fort with -real_size 64, >but don't know that there's something equivalent in g77. I wish to know the answer to this as well, but I think it's "no"; I did not see that option in g77. I need the capability for something else, but if you're writing this data out to a text file (or terminal), you should probably use an explicit format specification with something like g16.7 for single precision and g26.17 for double precision. Otherwise, there is no guarantee that you won't get mostly zeros even with double precision. As you've already found out, as the magnitude of the value gets smaller, the free-format output starts turning into zeros, effectively losing precision. This will happen using this output format even with double presicion variables, which sort of defeats the purpose of using double precision in the first place. eyc