Question about method code line in Rexx.nrx

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Question about method code line in Rexx.nrx

Jason Martin
  /** Make a Rexx object directly from an int.  */
  -- We fastpath commoners
  -- chars is set to null only for negatives less than -9, and
  -- we then ensure will layout correctly by setting suitable digits
  method Rexx(num=int)
    super(); exp=0; form=DefaultForm
    if num<=9 then if num>=-9 then do   -- very common single digit case
      mant=char[1]
      select
        when num>0 then do
          mant[0]=char(int('0')+num); chars=mant

Is int('0')+ needed in last code line? It has to be only digits 1 to 9 right?

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Question about method code line in Rexx.nrx

Dave Woodman

Perhaps this is to format the result using the DIGITS setting?

 

I seem to remember some references to this procedure in the min & max built-ins.

 

                Dave.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Jason Martin
Sent: 14 June 2015 07:02
To: IBM Netrexx
Subject: [Ibm-netrexx] Question about method code line in Rexx.nrx

 

  /** Make a Rexx object directly from an int.  */

  -- We fastpath commoners

  -- chars is set to null only for negatives less than -9, and

  -- we then ensure will layout correctly by setting suitable digits

  method Rexx(num=int)

    super(); exp=0; form=DefaultForm

    if num<=9 then if num>=-9 then do   -- very common single digit case

      mant=char[1]

      select

        when num>0 then do

          mant[0]=char(int('0')+num); chars=mant

 

Is int('0')+ needed in last code line? It has to be only digits 1 to 9 right?




Avast logo

This email has been checked for viruses by Avast antivirus software.
www.avast.com



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Loading...