Re: What I can to do with old PL/1 code?



First of all, thank you very much, Bob!
Bob Lidral писал(а):

> MZN wrote:
> > I have an old program running on S370 a lot of years ago. It have deal
> > with complex numerical computations and its volume about 10000 lines.
> >
> > I have IBM Visual Age PL/1 compiler, but it gives wrong results. Using
> > compatibility mode makes situation slightly better only. Step by step
> > debug with hand checking shows that I need to do some senseless
> > exchanging lines of code, or write code by another manner (sometimes).
> > So, I'm almost completely sure, that that compiler has errors. It's can
> > be proved by my another (smaller) program, that had the same behavior
> > until I rewrote it to Fortran. I cannot do the same here, due to size
> > and semantic complexity. Some features couldn't be reproduced in
> > Fortran.
>
> It's not clear exactly what your problem is, but your description raises
> some questions. It's also possible the compiler does not have errors.
>
> First, what do you mean by "wrong results"? Are you comparing them
> against previous results obtained a lot of years ago on an S370? Or are
> they theoretically wrong? That is, are they just different from those
> produced by old runs or are they different from expected results using
> mathematical analysis?

They are wrong in both senses. I have old results, unfortunately as
hard copy (computer paper), so I can compare.
>
> Second, when you say "complex numerical computations", do you mean using
> the FLOAT BINARY data type?
I declared variables as FLOAT(16)
>
> If changing the order of arithmetic operations changes the results, the
> difference may be due to roundoff error or other known computational
> issues related to limitations on precision and representation of real
> numbers. In such cases, translating to Fortran may or may not help
> because Fortran has mostly the same operator precedences as PL/I so it
> evaluates expressions in mostly the same order.
Yes, I suspect that this is due to roundoff error, but I have no
knowledge enough in order to prevent it. And it's big work too. Fortran
helped me in very similar, but smaller program.
>
> In addition to compatibility mode, you might try recompiling with
> different levels of optimization. Some compilers will change the order
> of arithmetic operations in "unsafe" ways for certain (usually higher)
> levels of optimization. In this context, "unsafe" means the compiler
> changes the order of operations in such a way that roundoff error or
> cumulative loss of precision may occur or may be worse than without
> reordering. This is not just a PL/I issue; some Fortran compilers do it
> as well.
I used all optimization modes.
>
> Also, the S360/S370 binary floating point implementation did not have
> the same binary precision for all floating point numbers. This is a
> hardware issue and would be the same for all supported languages.
> Basically, the S360/S370 floating point representation used a
> hexadecimal base (base-16) representation for floating point rather than
> a binary base. This is why IBM 360/370 PL/I floating point declarations
> usually declare variables as having a precision of 21 (single) or 53
> (double) bits.
I understand that, but all algorithms are very clear, but a complex
too.
>
> S360 single precision floating point numbers are stored in 32-bit words
> with a leading sign bit followed by a 7-bit biased base-16 exponent.
> The low-order 24 bits contain the normalized hexadecimal mantissa (in 6
> 4-bit hexadecimal digits). Thus, the mantissa value is adjusted so the
> high-order hexadecimal digit is non-zero; i.e., in the range 1 - 15 (or,
> in binary, in the range 0001 - 1111). Note this means that when the
> high-order hexadecimal digit is 1, the 3 high-order binary digits must
> be zero so the representation of the value would contain only 21
> significant binary digits.
>
> This is reflected in source-level declarations. Although
> single-precision floating point on S360/S370 systems contain 6
> hexadecimal digits for a total of 24 bits, the hexadecimal
> representation cannot guarantee more than 21 of those 24 bits will be
> significant. Since PL/I's FLOAT BINARY precision is specified in binary
> digits, declaring a variable FLOAT BINARY(24) on an S360/S370 system
> would require the compiler to allocate two words (64 bits) for the value
> because it would need to increase the precision in order to guarantee
> the full 24 significant bits for all represented values.
As I wrote before, I use FLOAT(16)
>
> Similarly, although double-precision S360/S370 floating point uses 14
> hexadecimal digits (or 56 bits), it can only guarantee that 53 of those
> bits will be significant for all represented values.
>
> During computations, this means that the _binary_ precision of the
> result of any single-precision arithmetic operation will vary between 21
> and 24 significant bits, depending on the value. For long or
> complicated computations this will produce roundoff errors and
> propagated loss of precision that may be different from those produced
> either by a strict 21-bit binary precision or by a strict 24-bit binary
> precision representation.
>
> The IEEE floating point standard prescribes a binary representation so
> some long or involved computations will produce different results using
> IEEE representation than those produced using S360/S370 representation.
> This would be true for any legacy S360/S370 application in any language.
>
> > So, I try to find another way. I see Liant compiler and contact with
> > them, but have one response only during to week. Have somebody
> > experience with that compiler?
>
> I've used the Liant compiler, but not for many years. The information
> you've provided seems insufficient to determine whether switching to
> another compiler would change the results in the way you need.
>
> > At the same time, I knew about Open VMS PL/1 compiler for Alpha
> > computers. I think now I could buy such computer for a modest price,
> > but what about compiler? Going to Kednos site and seen Hobbyist
> > license, I do not understand how I can get it. Also, can somebody to
> > tell about features of that compiler? Or, may be, such way isn't good?
>
> Before switching to any other compiler, it might be a good idea to run a
> test. You indicate you have a smaller program that exhibits the same
> (or similar) erroneous behavior. I'd suggest testing any compiler using
> that smaller program before making the change.
Unfortunately, now I have a double Opteron machine with Windows 64 bit,
and IBM PL/I compiler doesn't install. I'll try to install Windows XP
32 bit (as virtual machine) and do that, but work looks very hard.
>
>
> Bob Lidral
> lidral at alum dot mit dot edu

.



Relevant Pages

  • Re: Rounding of the double
    ... John von Neumann suggested that only fixed-point integers should be used because floating ... If you choose your representation as double, then you have to live with the consequences. ... you can never get precision in any computation on a computer than involves ... MVP Tips:http://www.flounder.com/mvp_tips.htm- Hide quoted text - ...
    (microsoft.public.vc.mfc)
  • Re: Subplot frustration
    ... an artifice of ML's representation of the internal handle as a default Double... ... converting to decimal representations of floating point numbers. ... to a decimal string with no loss of precision. ... My other supposition is that the "handle graphics" package was a product not developed inside TMW, but that again is an assumption. ...
    (comp.soft-sys.matlab)
  • Re: tqli recipe
    ... >> yes and if you use an optimiziong compiler it will horribly fail because ... first expression yields false when, with the correct precision, it ... More modern languages designed for floating point work provide ...
    (sci.math.num-analysis)
  • Re: simple question on long_float/short_float
    ... Each compiler provides various "kinds" of floating point types. ... digits of precision and a range that covers 10**30. ... This trend to update computer languages every few years seems to result in a language first starting as simple, with the basic features, then it gets more and more complicated and bloated as more features are stuffed in it to make it more cool and modern. ...
    (comp.lang.ada)
  • Re: Will too many paradigms addle my brain.
    ... i.e. that a subclass should define a subtype. ... it's represented as an integer or as a floating point object. ... Most of the time I don't want to specify the precision explicitly, ... representation, and exact infinities are primarily used to provide ...
    (comp.lang.functional)