| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Does this give correct results on the current PL/I? TIA. CM: PROC OPTIONS (MAIN); DCL (A, B, Z) FLOAT (18) COMPLEX; A = 1.234567Q0+9.87654Q0I; B = 5.67890Q0+3.4567890Q0I; PUT SKIP LIST (REAL(A)*REAL(B) - IMAG(A)*IMAG(B), IMAG(A)*REAL(B) + REAL(A)*IMAG(B)); Z = A*B; PUT SKIP LIST (Z); A = A*B; PUT SKIP LIST (A); END CM; |
|
#2
| |||
| |||
| robin wrote: > Does this give correct results on the current PL/I? TIA. > > CM: PROC OPTIONS (MAIN); > DCL (A, B, Z) FLOAT (18) COMPLEX; > > A = 1.234567Q0+9.87654Q0I; B = 5.67890Q0+3.4567890Q0I; > PUT SKIP LIST (REAL(A)*REAL(B) - IMAG(A)*IMAG(B), > IMAG(A)*REAL(B) + REAL(A)*IMAG(B)); > Z = A*B; > PUT SKIP LIST (Z); > A = A*B; > PUT SKIP LIST (A); > END CM; Which compilers allow Q for exponents? Otherwise, what do you consider correct? -- glen |
|
#3
| |||
| |||
| glen herrmannsfeldt wrote: > robin wrote: >> Does this give correct results on the current PL/I? TIA. >> >> CM: PROC OPTIONS (MAIN); >> DCL (A, B, Z) FLOAT (18) COMPLEX; >> >> A = 1.234567Q0+9.87654Q0I; B = 5.67890Q0+3.4567890Q0I; >> PUT SKIP LIST (REAL(A)*REAL(B) - IMAG(A)*IMAG(B), >> IMAG(A)*REAL(B) + REAL(A)*IMAG(B)); >> Z = A*B; >> PUT SKIP LIST (Z); >> A = A*B; >> PUT SKIP LIST (A); >> END CM; > > Which compilers allow Q for exponents? > > Otherwise, what do you consider correct? All three answers should be the same. -- John W. Kennedy "Never try to take over the international economy based on a radical feminist agenda if you're not sure your leader isn't a transvestite." -- David Misch: "She-Spies", "While You Were Out" |
|
#4
| |||
| |||
| robin wrote: > Does this give correct results on the current PL/I? TIA. > > CM: PROC OPTIONS (MAIN); > DCL (A, B, Z) FLOAT (18) COMPLEX; > > A = 1.234567Q0+9.87654Q0I; B = 5.67890Q0+3.4567890Q0I; > PUT SKIP LIST (REAL(A)*REAL(B) - IMAG(A)*IMAG(B), > IMAG(A)*REAL(B) + REAL(A)*IMAG(B)); > Z = A*B; > PUT SKIP LIST (Z); > A = A*B; > PUT SKIP LIST (A); > END CM; > > Personal PL/I for OS/2 gives: -2.71301322937600000E+0001 6.03555206313630000E+0001 -2.71301322937600000E+0001+6.03555206313630000E+000 1I -2.01625317271468673E+0002+6.03555206313630000E+000 1I Here is the relevant code: ; 8 Z = A*B; 000001a7 db 2d 20 00 00 00 fld tbyte ptr @CBE5 000001ad db 6d 90 fld tbyte ptr [ebp-070h]; A 000001b0 d9 c1 fld st(1) 000001b2 d8 c9 fmul st(0),st(1) 000001b4 db 2d 30 00 00 00 fld tbyte ptr @CBE6 000001ba db 6d a0 fld tbyte ptr [ebp-060h]; A 000001bd d9 c1 fld st(1) 000001bf d8 c9 fmul st(0),st(1) 000001c1 de c3 faddp st(3),st(0) 000001c3 d9 ca fxch st(2) 000001c5 db bd 60 ff ff ff fstp tbyte ptr [ebp-0a0h]; Z 000001cb de ca fmulp st(2),st(0) 000001cd de ca fmulp st(2),st(0) 000001cf de e1 fsubrp st(1),st(0) 000001d1 db bd 50 ff ff ff fstp tbyte ptr [ebp-0b0h]; Z ; 10 A = A*B; 00000278 db 2d 20 00 00 00 fld tbyte ptr @CBE5 0000027e db 6d 90 fld tbyte ptr [ebp-070h]; A 00000281 d9 c1 fld st(1) 00000283 d8 c9 fmul st(0),st(1) 00000285 db 6d a0 fld tbyte ptr [ebp-060h]; A 00000288 db 2d 30 00 00 00 fld tbyte ptr @CBE6 0000028e dc c9 fmul st(1),st(0) 00000290 d9 ca fxch st(2) 00000292 de c1 faddp st(1),st(0) 00000294 d9 c0 fld st(0) 00000296 db 7d a0 fstp tbyte ptr [ebp-060h]; A 00000299 de cb fmulp st(3),st(0) 0000029b de c9 fmulp st(1),st(0) 0000029d de e1 fsubrp st(1),st(0) 0000029f db 7d 90 fstp tbyte ptr [ebp-070h]; A Methinks you have uncovered a bug. |
|
#5
| |||
| |||
| "James J. Weinkam" <jjw@cs.sfu.ca> wrote in message news:yf5mj.39941$fj2.4344@edtnps82... > robin wrote: > > Does this give correct results on the current PL/I? TIA. > > > > CM: PROC OPTIONS (MAIN); > > DCL (A, B, Z) FLOAT (18) COMPLEX; > > > > A = 1.234567Q0+9.87654Q0I; B = 5.67890Q0+3.4567890Q0I; > > PUT SKIP LIST (REAL(A)*REAL(B) - IMAG(A)*IMAG(B), > > IMAG(A)*REAL(B) + REAL(A)*IMAG(B)); > > Z = A*B; > > PUT SKIP LIST (Z); > > A = A*B; > > PUT SKIP LIST (A); > > END CM; > > > > > Personal PL/I for OS/2 gives: > Thanks, I know this, and originally reported this bug about a decade ago. I'm hoping that someone will try it on a later compiler than that. Early VA compiler also suffered from this bug. > -2.71301322937600000E+0001 6.03555206313630000E+0001 > -2.71301322937600000E+0001+6.03555206313630000E+000 1I > -2.01625317271468673E+0002+6.03555206313630000E+000 1I > Methinks you have uncovered a bug. The bug is that the partial result is stored in the real part of the first operand, destroying it, before its value has been used in the second part of the complex multiplication. |
|
#6
| |||
| |||
| "glen herrmannsfeldt" <gah@ugcs.caltech.edu> wrote in message news:K4mdnQTjg-TsNwranZ2dnUVZ_tKinZ2d@comcast.com... > robin wrote: > > Does this give correct results on the current PL/I? TIA. > > > > CM: PROC OPTIONS (MAIN); > > DCL (A, B, Z) FLOAT (18) COMPLEX; > > > > A = 1.234567Q0+9.87654Q0I; B = 5.67890Q0+3.4567890Q0I; > > PUT SKIP LIST (REAL(A)*REAL(B) - IMAG(A)*IMAG(B), > > IMAG(A)*REAL(B) + REAL(A)*IMAG(B)); > > Z = A*B; > > PUT SKIP LIST (Z); > > A = A*B; > > PUT SKIP LIST (A); > > END CM; > > Which compilers allow Q for exponents? From PL/I for OS/2 onwards in 1994, D = double precision, Q = extended (or quadruple) precision. [Saves having to write out non-significant zeros for constants with few leading digits.] Perhaps it was in some earlier IBM versions [don't have an earlier manual handy to check]. |
|
#7
| |||
| |||
| On 01/20/08 05:51 pm, robin wrote: > Does this give correct results on the current PL/I? TIA. > > CM: PROC OPTIONS (MAIN); > DCL (A, B, Z) FLOAT (18) COMPLEX; > > A = 1.234567Q0+9.87654Q0I; B = 5.67890Q0+3.4567890Q0I; > PUT SKIP LIST (REAL(A)*REAL(B) - IMAG(A)*IMAG(B), > IMAG(A)*REAL(B) + REAL(A)*IMAG(B)); > Z = A*B; > PUT SKIP LIST (Z); > A = A*B; > PUT SKIP LIST (A); > END CM; Run using: 5655-H31 IBM(R) Enterprise PL/I for z/OS V3.R6.M0 (Built:20071127) ***************** TOP OF DATA ********************* -2.71301322937600000E+01 6.03555206313630000E+01 -2.71301322937600000E+01+6.03555206313630000E+01I -2.71301322937600000E+01+6.03555206313630000E+01I ***************** BOTTOM OF DATA ****************** [Note: The last character on lines 2, 3 is uppper case 'i' not a '1'.] Anything more that you'd like to see? Carl |
|
#8
| |||
| |||
| robin wrote: > "glen herrmannsfeldt" <gah@ugcs.caltech.edu> wrote in message > news:K4mdnQTjg-TsNwranZ2dnUVZ_tKinZ2d@comcast.com... >> robin wrote: >>> Does this give correct results on the current PL/I? TIA. >>> >>> CM: PROC OPTIONS (MAIN); >>> DCL (A, B, Z) FLOAT (18) COMPLEX; >>> >>> A = 1.234567Q0+9.87654Q0I; B = 5.67890Q0+3.4567890Q0I; >>> PUT SKIP LIST (REAL(A)*REAL(B) - IMAG(A)*IMAG(B), >>> IMAG(A)*REAL(B) + REAL(A)*IMAG(B)); >>> Z = A*B; >>> PUT SKIP LIST (Z); >>> A = A*B; >>> PUT SKIP LIST (A); >>> END CM; >> Which compilers allow Q for exponents? > > From PL/I for OS/2 onwards in 1994, D = double precision, > Q = extended (or quadruple) precision. [Saves having to > write out non-significant zeros for constants with few leading > digits.] Perhaps it was in some earlier IBM versions [don't have an > earlier manual handy to check]. Copied from FORTRAN. -- John W. Kennedy "You can, if you wish, class all science-fiction together; but it is about as perceptive as classing the works of Ballantyne, Conrad and W. W. Jacobs together as the 'sea-story' and then criticizing _that_." -- C. S. Lewis. "An Experiment in Criticism" |
|
#9
| |||
| |||
| "John W. Kennedy" <jwkenne@attglobal.net> wrote in message news:479ce67e$0$6338$607ed4bc@cv.net... > robin wrote: > > "glen herrmannsfeldt" <gah@ugcs.caltech.edu> wrote in message > > news:K4mdnQTjg-TsNwranZ2dnUVZ_tKinZ2d@comcast.com... > >> robin wrote: > >>> Does this give correct results on the current PL/I? TIA. > >>> > >>> CM: PROC OPTIONS (MAIN); > >>> DCL (A, B, Z) FLOAT (18) COMPLEX; > >>> > >>> A = 1.234567Q0+9.87654Q0I; B = 5.67890Q0+3.4567890Q0I; > >>> PUT SKIP LIST (REAL(A)*REAL(B) - IMAG(A)*IMAG(B), > >>> IMAG(A)*REAL(B) + REAL(A)*IMAG(B)); > >>> Z = A*B; > >>> PUT SKIP LIST (Z); > >>> A = A*B; > >>> PUT SKIP LIST (A); > >>> END CM; > >> Which compilers allow Q for exponents? > > > > From PL/I for OS/2 onwards in 1994, D = double precision, > > Q = extended (or quadruple) precision. [Saves having to > > write out non-significant zeros for constants with few leading > > digits.] Perhaps it was in some earlier IBM versions [don't have an > > earlier manual handy to check]. > > Copied from FORTRAN. The "D" certainly was. The Q is new. |
|
#10
| |||
| |||
| "CG" <Carl.Gehr.ButNoSPAMStuff5@MCGCG.Com> wrote in message news:d10d7$479cc869$d06620ed$30872@FUSE.NET... > On 01/20/08 05:51 pm, robin wrote: > > Does this give correct results on the current PL/I? TIA. > > > > CM: PROC OPTIONS (MAIN); > > DCL (A, B, Z) FLOAT (18) COMPLEX; > > > > A = 1.234567Q0+9.87654Q0I; B = 5.67890Q0+3.4567890Q0I; > > PUT SKIP LIST (REAL(A)*REAL(B) - IMAG(A)*IMAG(B), > > IMAG(A)*REAL(B) + REAL(A)*IMAG(B)); > > Z = A*B; > > PUT SKIP LIST (Z); > > A = A*B; > > PUT SKIP LIST (A); > > END CM; > > Run using: > > 5655-H31 IBM(R) Enterprise PL/I for z/OS V3.R6.M0 (Built:20071127) > > ***************** TOP OF DATA ********************* > -2.71301322937600000E+01 6.03555206313630000E+01 > -2.71301322937600000E+01+6.03555206313630000E+01I > -2.71301322937600000E+01+6.03555206313630000E+01I > ***************** BOTTOM OF DATA ****************** > > [Note: The last character on lines 2, 3 is uppper case 'i' not a '1'.] as expected, because the values are complex. > Anything more that you'd like to see? Thanks. Looks like it may have been fixed. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.