[Info-vax] Roadmap
Dave Froble
davef at tsoft-inc.com
Sun Jan 6 22:55:07 EST 2019
On 1/6/2019 7:57 PM, Simon Clubley wrote:
> On 2019-01-06, Dave Froble <davef at tsoft-inc.com> wrote:
>>
>> Pick only one of two, performance or accuracy ....
>>
>
> Does VMS Basic support fixed point ?
>
> (I've never used VMS Basic, so I don't know the answer).
>
> Simon.
>
Please define "fixed-point".
DECIMAL is supported.
There can be user defined data types. Perhaps not with compiler
support, but with support provided by library routines.
Ok, no laughing, or I'll feel hurt. There is a large amount of this in
our app storage.
This is from RSTS days.
100 !************************************************************
! Map Real Number into DI String
!************************************************************
!
FUNCTION STRING DIIN( Z , Z% , ERROR% )
!
! Z - Real value
! Z% - Scale factor
! ERROR% - Completion status
!
! DIIN ret val - DI mapped string
!
!************************************************************
!
OPTION SIZE=( INTEGER WORD , REAL DOUBLE )
200 ON ERROR GOTO 900 ! Error trapping
ERROR% = 0% ! Clear error flag
Z0 = Z * 10^Z% + SGN(Z)*.500001 ! Scale to an
integer
Z1% = Z0 / 32768. ! High word value
Z2% = Z0 - 32768.*Z1% ! Low word value
DIIN = CVT%$(Z1%) + CVT%$(Z2%) ! Map into string
GOTO 999 ! Exit
!
900 ERROR% = ERR ! Set error flag
DIIN = STRING$(4%,0%) ! Set no value
RESUME 999 ! Exit
!
999 END FUNCTION
100 !************************************************************
! Un-map DI String to a real number
!************************************************************
!
FUNCTION DOUBLE DIOUT( Z$ , Z% )
!
! Z$ - DI mapped string
! Z% - Scale factor
!
! DIOUT - Real value
!
!************************************************************
!
OPTION SIZE=( INTEGER WORD , REAL DOUBLE )
200 Z = 32768. * CVT$%(Z$) + CVT$%(MID(Z$,3%,2%)) ! Unmap string
GOTO 300 UNLESS Z% ! Exit if not
scaled
Z = Z / 10.^Z% ! Scale value
CALL NROUND( Z , Z% ) ! Round value
!
300 DIOUT = Z ! Set Fn value
!
999 END FUNCTION
--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. E-Mail: davef at tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA 15486
More information about the Info-vax
mailing list