[comp.lang.fortran] complex*32?

ndeng@EULER.BERKELEY.EDU (02/12/90)

Is there any machine/compiler in the unix world or IBM world which can handle
the complex*32 format and can deal with data range of 10e-200 to 10e+200?
Any pointer will be greatly appreciated.

Please reply to this account.

Nan Deng
ndeng@euler.berkeley.edu

mac@harris.cis.ksu.edu (Myron A. Calhoun) (02/12/90)

In article <9002120228.AA19489@euler.Berkeley.EDU> ndeng@EULER.BERKELEY.EDU writes:
>
>Is there any machine/compiler in the unix world or IBM world which can handle
>the complex*32 format and can deal with data range of 10e-200 to 10e+200?
                       ^^^
These are UNrelated questions, and the second is easily answered:

10^200 ~= (10^3)^67 ~= (2^10)^67 = 2^670   and   670 < 2^10

Thus any machine which which
  * allocates ten bits (plus a sign bit) to the exponent and
  * uses powers of two for its internal binary representation for
         floating point numbers
or
  * allocates eight bits (plus a sign bit) to the exponent and
  * uses powers of sixteen.....
will handle a range of 10e-200 to 10e+200. 

I've never used one (I can type!-), but I vaguely recall the
Macintosh meets the first set of criteria.  I also recall that
the old IBM 360/370 used powers of sixteen, but only allocated
six bits (plus a sign bit) to the exponent, thus limiting its
range to about
16^64 = (2^4)^64 = 2^256 ~= (2^10)^25.6 ~= (10^3)^25.6 ~= 10^76

Also, I question ANYONE'S need for 32 bytes * 8 bits/byte minus
12 (bits for exponent and two signs) = 244 bits ~= 74 digits
of precision!  If I remember correctly:
   if one knew the value of PI to 50 digits,
   if one knew the radius of the whole universe EXACTLY, and
   if one used both to calculate the diameter of the universe,
   then adding a 51st digit to PI and recalculating the diameter would
        not give a value enough larger to slip a playing card between them.

So I find it hard to believe such precision is necessary.

But I've been wrong before and will undoubtedly be wrong again!
--Myron.
--
#-------------------------------------------------------------------------
# Myron A. Calhoun, Ph.D. E.E.; Associate Professor   (913) 539-4448 home
# INTERNET: mac@harris.cis.ksu.edu   (129.130.10.2)         532-6350 work
# UUCP: ...{rutgers, texbell}!ksuvax1!harry!mac             532-7004 fax

ghe@mist.cs.orst.edu (Guangliang He) (02/13/90)

In article <1990Feb12.140657.28884@deimos.cis.ksu.edu> mac@harris.cis.ksu.edu (Myron A. Calhoun) writes:
|
|Also, I question ANYONE'S need for 32 bytes * 8 bits/byte minus
|12 (bits for exponent and two signs) = 244 bits ~= 74 digits
|of precision!  If I remember correctly:
|   if one knew the value of PI to 50 digits,
|   if one knew the radius of the whole universe EXACTLY, and
|   if one used both to calculate the diameter of the universe,
|   then adding a 51st digit to PI and recalculating the diameter would
|        not give a value enough larger to slip a playing card between them.
|
|So I find it hard to believe such precision is necessary.
|
|But I've been wrong before and will undoubtedly be wrong again!
|--Myron.

But life isn't that simple. When you are solving a large dimension ill 
conditioned matrix problems, the round-off error will be significant. 
Then the more precision really helps.

ghe@mist.cs.orst.edu

mac@harris.cis.ksu.edu (Myron A. Calhoun) (02/13/90)

In article <1990Feb12.140657.28884@deimos.cis.ksu.edu> mac@harris.cis.ksu.edu (Myron A. Calhoun) writes:

  [many lines deleted]

>   if one knew the value of PI to 50 digits,
>   if one knew the radius of the whole universe EXACTLY, and
>   if one used both to calculate the diameter of the universe,
                                      ^^^^^^^^
I hope it was obvious I meant CIRCUMFERENCE!

  [more lines deleted]

>But I've been wrong before and will undoubtedly be wrong again!

Sigh.  Wrong again.  And so soon, too!-)
--Myron.
--
#-------------------------------------------------------------------------
# Myron A. Calhoun, Ph.D. E.E.; Associate Professor   (913) 539-4448 home
# INTERNET: mac@harris.cis.ksu.edu   (129.130.10.2)         532-6350 work
# UUCP: ...{rutgers, texbell}!ksuvax1!harry!mac             532-7004 fax

holiday@boulder.Colorado.EDU (Matthew Holiday) (02/13/90)

In article <1990Feb12.140657.28884@deimos.cis.ksu.edu> Myron Calhoun writes:

> ...I vaguely recall the Macintosh meets the first set of criteria.
>
> Also, I question ANYONE'S need for 32 bytes * 8 bits/byte minus
> 12 (bits for exponent and two signs) = 244 bits ~= 74 digits
> of precision!

The Mac (using Language Systems FORTRAN for MPW) offers COMPLEX*20 or
COMPLEX*24, the only difference being that the latter has four bytes
of padding for the math chip.  This means that 80 bits are available
for each of the real and imaginary parts.

Note that the 32 bytes Myron refers to are really split between the
real and imaginary parts, i.e., each is only represented by 16 bytes.
This means you get about 34 digits, minus all the ones eaten up by
the growth of roundoff error.



Matt Holiday                    | "If it were done, when 'tis done,
holiday@tigger.colorado.edu     |  Then 'twere well it were done quickly."
University of Colorado, Boulder |               -- Macbeth I.vii

khb@chiba.Eng.Sun.COM (Keith Bierman - SPD Advanced Languages) (02/13/90)

	Sun users can get this effect with 

	 	double complex foo

	the usual ieee double precision range caveats apply.

	f77v1.2 and beyond.




--
Keith H. Bierman    |*My thoughts are my own. !! kbierman@Eng.Sun.COM
It's Not My Fault   | MTS --Only my work belongs to Sun* kbierman%eng@sun.com
I Voted for Bill &  | Advanced Languages/Floating Point Group            
Opus                | "When the going gets Weird .. the Weird turn PRO"

"There is NO defense against the attack of the KILLER MICROS!"
			Eugene Brooks

khb@chiba.Eng.Sun.COM (Keith Bierman - SPD Advanced Languages) (02/13/90)

Ah, follow up.

Spelling is
		double complex
	 	complex*16

IEEE double is large enough that quad precision (*32) isn't needed. I
neglected to be specific in my previous posting. _roughly_ speaking
ieee dp is good from 10**-308 to 10**+308. 

There are a bunch of weasel words which should be invoked, but those
can be found in the Floating Point Programmer's Guide (Sun) or the
IEEE spec (global engineering ?), etc.

Sorry for taking up two slots for one answer.

--
Keith H. Bierman    |*My thoughts are my own. !! kbierman@Eng.Sun.COM
It's Not My Fault   | MTS --Only my work belongs to Sun* kbierman%eng@sun.com
I Voted for Bill &  | Advanced Languages/Floating Point Group            
Opus                | "When the going gets Weird .. the Weird turn PRO"

"There is NO defense against the attack of the KILLER MICROS!"
			Eugene Brooks

jlg@lambda.UUCP (Jim Giles) (02/14/90)

From article <KHB.90Feb12174730@chiba.Eng.Sun.COM>, by khb@chiba.Eng.Sun.COM (Keith Bierman - SPD Advanced Languages):
> [... complex*32 vs. complex*16 ...]
> IEEE double is large enough that quad precision (*32) isn't needed. [...]

That's rather a broad claim.  Seems to me that the only people qualified
to determine whether quad precision is needed are the folks who might
need it - the users.  On the Cray _single_ precision floats are 64-bits
(8-bytes) long.  So, complex*16 is the _single_ precision complex type
on Cray hardware.  Some extended precision beyond that is often needed.

J. Giles

khb@chiba.Eng.Sun.COM (Keith Bierman - SPD Advanced Languages) (02/14/90)

In article <14238@lambda.UUCP> jlg@lambda.UUCP (Jim Giles) writes:

   That's rather a broad claim.  Seems to me that the only people qualified
   to determine whether quad precision is needed are the folks who

Agreed. The orignal poster only provided dynamic range requirement
information, so I thought the claim was valid.

It is quite possible that a given application can require, say, 100
decimal digits but a narrow exponential range. Had that been the
question, I would have suggested a different answer ;>

   need it - the users.  On the Cray _single_ precision floats are 64-bits
   (8-bytes) long.  So, complex*16 is the _single_ precision complex type
   on Cray hardware.  Some extended precision beyond that is often needed.

True. And on the old Cyber machines words were 60-bits, so *Nbytes
isn't the most helpful notation.

Sorry for any confusion implied or caused.
--
Keith H. Bierman    |*My thoughts are my own. !! kbierman@Eng.Sun.COM
It's Not My Fault   | MTS --Only my work belongs to Sun* kbierman%eng@sun.com
I Voted for Bill &  | Advanced Languages/Floating Point Group            
Opus                | "When the going gets Weird .. the Weird turn PRO"

"There is NO defense against the attack of the KILLER MICROS!"
			Eugene Brooks

carroll@bcsaic.UUCP (Jeff Carroll) (02/14/90)

In article <KHB.90Feb12174730@chiba.Eng.Sun.COM> khb@chiba.Eng.Sun.COM (Keith Bierman - SPD Advanced Languages) writes:
>
>IEEE double is large enough that quad precision (*32) isn't needed. I
>neglected to be specific in my previous posting. _roughly_ speaking
>ieee dp is good from 10**-308 to 10**+308. 
>

	This reminds me of the answers I used to get from a certain
vendor of test equipment based in Palo Alto. When I thought of a
really creative application for one of their boxes, the salesman would
ask, "Why would you want to do THAT???"

	The WHOLE POINT is that some of us think that we *may need*
COMPLEX*32.

	But then, we probably won't be doing this work on Suns...

	Jeff Carroll
	carroll@atc.boeing.com

mcdonald@aries.scs.uiuc.edu (Doug McDonald) (02/16/90)

In article <20285@bcsaic.UUCP> carroll@bcsaic.UUCP (Jeff Carroll) writes:
>In article <KHB.90Feb12174730@chiba.Eng.Sun.COM> khb@chiba.Eng.Sun.COM (Keith Bierman - SPD Advanced Languages) writes:
>>
>>IEEE double is large enough that quad precision (*32) isn't needed. I
>>neglected to be specific in my previous posting. _roughly_ speaking
>>ieee dp is good from 10**-308 to 10**+308. 
>>
>
>	This reminds me of the answers I used to get from a certain
>vendor of test equipment based in Palo Alto. When I thought of a
>really creative application for one of their boxes, the salesman would
>ask, "Why would you want to do THAT???"
>
>	The WHOLE POINT is that some of us think that we *may need*
>COMPLEX*32.
>

I don't know about COMPLEX*32, but REAL*16 is most surely needed - 
I used to do classical mechanics of molecules. THE differential
equations are unstable - they generate chaotic solutions.
Errors for any reason, including roundoff, grow exponentially
with time (and number of integration steps, as these equations
need fixed step size integrators). Thus to double the length of time
you get "correct" answers, you must doubel the word length.
To get useful results you may NEED REAL*16, and to verify that
a computation for which REAL*8 is good enough by back-integration,
you need REAL*16.

Doug McDonald

revans@voodoo.ucsb.edu (02/17/90)

-Message-Text-Follows-
In article <20285@bcsaic.UUCP>, carroll@bcsaic.UUCP (Jeff Carroll) writes...
>In article <KHB.90Feb12174730@chiba.Eng.Sun.COM> khb@chiba.Eng.Sun.COM (Keith Bierman - SPD Advanced Languages) writes:
>>
>>IEEE double is large enough that quad precision (*32) isn't needed. I
>>neglected to be specific in my previous posting. _roughly_ speaking
>>ieee dp is good from 10**-308 to 10**+308. 
>>
>       .. material omitted ..
> 
>	The WHOLE POINT is that some of us think that we *may need*
>COMPLEX*32.

And some of us out here *know* we need COMPLEX*32.  There are a number of 
applications in my own field (seismology) where we thrash our machines
night and day to calculate pairs of quantities, take differences, and then
sum the residuals.  In principle, the differences can become vanishingly
small.  (And before anybody says it, there's a huge body of literature
out there in how to avoid/ameliorate/fine-tune these differencing processes,
but for some applications, we are just plain stuck with them).  COMPLEX*64
gives us sensible headroom in which to work ...

Russ

Signature - what me bother?