[Info-vax] New VSI Roadmap (yipee!)

David Froble davef at tsoft-inc.com
Mon Mar 2 21:36:09 EST 2015


John Reagan wrote:
> On Monday, March 2, 2015 at 12:49:40 PM UTC-5, David Froble wrote:
> 
>> For forty years the use of D-float for US currency has worked, and 
>> worked well.  Any change would not provide any benefits.  So I ask:
>>
> 
> Then you've been lucky for 40 years or you've programmed in format-specific
> correction code.
> 
>> Should all the customers be subjected to an expense, possible errors, 
>> possible downtime, for no real gains?  Are you going to convince them to 
>> do this?
>>
> 
> You'll have to ask the laywers.
> 
>> The issue is a rounding function in the language, not what data type 
>> someone uses for currency.
> 
> And I don't think having it built into the language would make it any more
> efficient.

Maybe try the following yourself.

OpenVMS V8.3  on node AS800   2-MAR-2015 21:26:04.68  Uptime  48 18:15:47
AS800> sho lic/cha
VMS/LMF Charge Information for node AS800
This is a AlphaServer 800 5/500, hardware model type 1585

AS800> t z1.bas
1       Option Size = ( Integer Long, Real Double )

         Call Lib$Init_Timer()

         For Z% = 1% to 1000000%
                 Z = 12345.6789
                 Call NRound( Z , 2% )
         Next Z%

         Call Lib$Show_Timer()

         End
AS800> t z2.bas
1       Option Size = ( Integer Long, Real Double )

         On Error GoTo 90

         Call Lib$Init_Timer()

         For Z% = 1% to 1000000%
                 Z = Z% + .123
                 Z0 = FIX( ABS(Z) * 10.^2% + .500001 )
                 Z = ( Z0 / 10.^2% ) * SGN(Z)
         Next Z%

         Call Lib$Show_Timer()

         GoTo 99

90      Print ERL, ERR, ERT$(ERR)
         Print Z%
         Resume 99

99      End
AS800> t fls:nround.bas
100     !************************************************************
         !                    Round a Real Number
         !************************************************************
         !
         SUB NROUND ( Z , Z% )
         !
         !  Z            - Real value
         !  Z%           - Digits to right of decimal point
         !
         !************************************************************
         !
         OPTION SIZE=( INTEGER WORD , REAL DOUBLE )

200     Z0 = FIX( ABS(Z) * 10.^Z% + .500001 )           !  SCALE TO AN 
INTEGER
         Z = ( Z0 / 10.^Z% ) * SGN(Z)                    !  RESCALE, SET 
SIGN
                                                         !
999     SUBEND
AS800> run z1
  ELAPSED:    0 00:00:04.53  CPU: 0:00:04.53  BUFIO: 0  DIRIO: 0  FAULTS: 3
AS800> run z2
  ELAPSED:    0 00:00:00.22  CPU: 0:00:00.22  BUFIO: 0  DIRIO: 0  FAULTS: 0
AS800> run z1
  ELAPSED:    0 00:00:02.66  CPU: 0:00:02.65  BUFIO: 0  DIRIO: 0  FAULTS: 3
AS800> run z1
  ELAPSED:    0 00:00:03.12  CPU: 0:00:03.12  BUFIO: 0  DIRIO: 0  FAULTS: 3
AS800> run z1
  ELAPSED:    0 00:00:02.66  CPU: 0:00:02.67  BUFIO: 0  DIRIO: 0  FAULTS: 3

Perhaps note the difference in CPU time between calling the subroutine, 
and executing almost the same exact code inline.

Now, I'm assuming that a build in language function would be similar to 
inline code.  Perhaps that is my mistake.



More information about the Info-vax mailing list