On Sun, 19 May 2013 13:24:49 +0000, Robert AH Prins wrote:
>On 2013-05-19 09:40, Uwe Oswald wrote:
>> Hi @ll,
>>
>> has someone ever tried to extract fields SMF30DDS and SMF30DDR (long floating
>> point hex) or any field in REXX? There are a couple of F2"something" routines
>> out there but it seems that none of them produce the right value. Has
>> somebody a REXX example for me? Anything would be very appreciated since it
>> might bring me further.
>
>This code coming from Michel Castelein & Jim Connelly might be of some use
>
...
Eek! Clearly the author's brain was rotted by excessive exposure to
Assembler programming. Why not simply:
/* This REXX exec computes a S/370 floating-point's value ...
e.g. X'C1280000' represents -2.5
*/
castelein:
parse arg Float
numeric digits ( length( Float ) % 0.4 ) /* 1 / log( 256 ) */
parse var Float Hexponent 2 Mantissa
sign = 1 - c2d( Hexponent ) % 128 * 2
Hexponent = c2d( bitand( Hexponent, '7F'x ) ) - 64
Hexponent = Hexponent - 2 * length( Mantissa )
Dec = sign * 16 ** Hexponent * c2d( Mantissa )
say c2x( Float ) Dec
return( Dec )
The problem of decimal to HFP is a nightmare, relatively. I'd be
tempted to use iteration to find a root of the HFP to decimal function.
-- gil
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN