comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » double precision complex #s
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: double precision complex #s [message #4042 is a reply to message #3960] Mon, 17 April 1995 00:00 Go to previous messageGo to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
agraps@netcom.com (Amara Graps) writes:

> psharer@eos.arc.nasa.gov (Peter J. Sharer) writes:

>> I am using the complex declaration for an array of complex numbers,
>> but am running into a problem with floating point overflows in a
>> polynomial calculation. Does anyone know of a way to create a complex
>> variable with double precision?

>> Thanks for your help,

>> Peter Sharer


> Peter,

> Try handling the real and imaginary parts this way (it's
> convoluted, but it works :) )

> IDL> a = [1,2,3]
> IDL> b = [4,5,6]
> IDL> c = complex(a,b)
> IDL> print, c
> ( 1.00000, 4.00000)( 2.00000, 5.00000)( 3.00000,
> 6.00000)

> To get double precision reals, use some of the rules of complex algebra,

> IDL> print, double(abs((c+conj(c))/2.0))
> 1.0000000 2.0000000 3.0000000

> To get double precision imaginary, use idl's imaginary function,

> IDL> print, double(imaginary(c))
> 4.0000000 5.0000000 6.0000000

> (There are more zeros than what's being printed here, but you get the
> idea.)

Uhhh, sorry to disappoint you, but simply taking a single precision number and
converting it to double precision does not mean that it has double precision
accuracy.

Fear not, IDL v4.0 will have a DCOMPLEX data type.

Bill Thompson
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Student version of IDL
Next Topic: problem converting FORTRAN to IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 01:03:27 PDT 2025

Total time taken to generate the page: 0.24173 seconds