• PL/I

    From David Noon@2:257/609.5 to Fred Kantor on Sunday, January 07, 2001 12:36:52
    Hi Fred,

    Replying to a message of Fred Kantor to David Noon:

    Welcome to OS2PROG!

    If I may ask... IIRC, you mentioned that PL1 supported "arbitrary" precision.

    Up to limitations imposed by hardware and/or hardware emulation software. For fully arbitrary precision one must use an interpretive language, such as REXX, and pay the appropriate performance penalty at run time.

    Can PL1 support individual bit operations, and AND, OR,
    and XOR, like Java BigInteger, and also support log, complex numbers,
    etc, on such numbers?

    Yes. PL/I permits the declaration of individual bit variables and strings of bits up to 32767 bits long. These do not need to be on byte boundaries, but can
    be forced so by the ALIGNED attribute.

    There are operators for bitwise AND, OR, XOR and NOT applicable to bits and bit
    strings, plus intrinsic functions to perform the same operations on binary integers of various precisions. Thee functions are polymorphic, so one uses the
    same function name regardless of the arguments' precision(s).

    All variables of computational data types can be declared as REAL or COMPLEX, that latter obviously occupying two locations: one for the real part and one for the imaginary part. The standard mathematical library is somewhat larger than standard FORTRAN's and nearly all functions are polymorphic, supporting various levels of precision and either real or complex arguments.

    And can it support object oriented coding?

    Yes and no. The strict PL/I grammar does not support the bundling of functions to data structures to form object classes, but the compiler does implement this. The compiler architect has quietly distributed a document explaining how to go about this.

    Even without the lexical formalisms of OOP, adhering to strict PL/I grammar, one can usually implement an object oriented design in PL/I just by enforcing type matches in "method" calls to effect the bundling of the functions to data structures of the appropriate type. Inheritance is a bit tricky, though.

    Regards

    Dave
    <Team PL/I>

    --- FleetStreet 1.25.1
    * Origin: My other computer is an IBM S/390 (2:257/609.5)
  • From Fred Kantor@2:252/171 to David Noon on Thursday, January 11, 2001 23:37:00
    Hi Fred,
    Welcome to OS2PROG!

    Thank you!

    Can PL/I support individual bit operations, and AND, OR, and
    XOR, like Java BigInteger, and also support log, complex
    numbers, etc, on such numbers?

    Yes. PL/I permits the declaration of individual bit variables
    and strings of bits up to 32767 bits long. These do not need to
    be on byte boundaries, but can be forced so by the ALIGNED
    attribute.

    Does polymorphism of mathematical operations extend to apply to
    those long strings?

    And, can one manipulate single bit by address in such long string?

    ---
    ■ testing... ■
    * Origin: FONiX Info Systems * Berkshire UK * +44 1344 641625 (2:252/171)
  • From David Noon@2:257/609.5 to Fred Kantor on Saturday, January 13, 2001 11:02:30
    Hi Fred,

    Replying to a message of Fred Kantor to David Noon:

    Can PL/I support individual bit operations, and AND, OR, and
    XOR, like Java BigInteger, and also support log, complex
    numbers, etc, on such numbers?

    Yes. PL/I permits the declaration of individual bit variables
    and strings of bits up to 32767 bits long. These do not need to
    be on byte boundaries, but can be forced so by the ALIGNED
    attribute.

    Does polymorphism of mathematical operations extend to apply to
    those long strings?

    Not in general. The mathematical operations are optimized for the floating point hardware capabilities of the platform. In the case of OS/2 this means Intel 80x87 NPU and compatibles. Consequently, the precision of the built-in mathematical functions is usually limited to 10-byte extended precision.

    However, the bit manipulation operators will work on bit strings of that length. So, if you want to roll your own floating point format and produce mathematical operations up to 32K bits in precision then you can, provided you are prepared to start from AND, OR, XOR and NOT.

    And, can one manipulate single bit by address in such long string?

    Yes. The SUBSTR built-in function retrieves an individual bit or substring of bits; when used as a pseudo-variable it can modify an individual bit or substring of bits. This function can also be used to pass a substring of bits to a function or subroutine that has been coded to handle a bit-string argument. Again, the bit or substring need not be on a byte boundary.

    As one might expect, if the compiler cannot resolve the starting position and/or length of the substring at compile time there is a performance penalty. But if one is performing arithmetic on 32K bit numbers then one is more concerned with precision than speed.

    Regards

    Dave
    <Team PL/I>

    --- FleetStreet 1.25.1
    * Origin: My other computer is an IBM S/390 (2:257/609.5)