Decimal Complex Data Representation 1289

General APL language issues

Decimal Complex Data Representation 1289

Postby petermsiegel on Thu Aug 13, 2015 4:48 am

I'm using the MAC version of 14.1 (very nice by the way) and found this:
Code: Select all
      ⎕FR←1287
      ⎕DR 4343.4
1287
      ⎕dr 3.3j5
1289
      long←(⍳1000),3.3J34
      ⎕dr long
1289 

This is very welcome, but I checked several manuals (but not EVERY manual and I think I verified they were for 14.1) and they all insist that complex numbers are still 64 bit.

Is the report of 128-bit complex (err, 128× 2, of course) correct?
petermsiegel
 
Posts: 98
Joined: Thu Nov 11, 2010 11:04 pm

Re: Decimal Complex Data Representation 1289

Postby Morten|Dyalog on Thu Aug 13, 2015 12:32 pm

Hi David! Yes, 1289 is correct, in the sense that a complex number is represented using two 64-bit DOUBLE precision floating-point numbers, to each element of a complex array requires 128 bits.

We made the design decision that "nobody would need quad precision decimal complex numbers" (if you are using complex numbers you are doing "engineering", or at least "irrational" math of some description). A result of this is that if you combine floats and complex numbers with ⎕FR=1287, your floats will be converted to 64-bit binary doubles (complex numbers with imaginary part = 0). Which means that:

⎕FR←1287
1E500,0J1
DOMAIN ERROR
1E500,0J1


... because 1E500 cannot be represented as a 64-bit complex number.
User avatar
Morten|Dyalog
 
Posts: 409
Joined: Tue Sep 09, 2008 3:52 pm


Return to Language

Who is online

Users browsing this forum: No registered users and 1 guest