; File:  E16.SANE
;
;
; Copyright Apple Computer, Inc. 1986-90
; All Rights Reserved
;
;
SIGDIGLEN GEQU $001C
IEEEDEFAULTENV GEQU $0000
FLOATDECIMAL GEQU $0000
FIXEDDECIMAL GEQU $0001
INVALID GEQU $0001
UNDERFLOW GEQU $0002
OVERFLOW GEQU $0004
DIVBYZERO GEQU $0008
INEXACT GEQU $0010
;-----------------------------------------------------------
; Tool Set and Function Numbers.
;-----------------------------------------------------------
SANEtsNum       gequ     $A              ; SANE tool set number

FPNum           gequ     $9              ; Function number for Arithmetic
DecStrNum       gequ     $A              ; Function number for Scanner/Formatter
ElemNum         gequ     $B              ; Function no. for Elementary functions

;-----------------------------------------------------------
; Operation code masks.
;-----------------------------------------------------------
FOADD           gequ     $00             ; add
FOSUB           gequ     $02             ; subtract
FOMUL           gequ     $04             ; multiply
FODIV           gequ     $06             ; divide
FOCMP           gequ     $08             ; compare, no exception from unordered
FOCPX           gequ     $0A             ; compare, signal invalid if unordered
FOREM           gequ     $0C             ; remainder
FOZ2X           gequ     $0E             ; convert to extended
FOX2Z           gequ     $10             ; convert from extended
FOSQRT          gequ     $12             ; square root
FORTI           gequ     $14             ; round to integral value
FOTTI           gequ     $16             ; truncate to integral value
FOSCALB         gequ     $18             ; binary scale
FOLOGB          gequ     $1A             ; binary log
FOCLASS         gequ     $1C             ; classify
FONEXT          gequ     $1E             ; next-after

FOSETENV        gequ     $01             ; set environment
FOGETENV        gequ     $03             ; get environment
FOSETHV         gequ     $05             ; set halt vector
FOGETHV         gequ     $07             ; get halt vector
FOD2B           gequ     $09             ; convert decimal to binary
FOB2D           gequ     $0B             ; convert binary to decimal
FONEG           gequ     $0D             ; negate
FOABS           gequ     $0F             ; absolute value
FOCPYSGN        gequ     $11             ; copy sign
; UNDEFINED     gequ     $13
FOSETXCP        gequ     $15             ; set exception
FOPROCENTRY     gequ     $17             ; procedure-entry
FOPROCEXIT      gequ     $19             ; procedure-exit
FOTESTXCP       gequ     $1B             ; test exception
; UNDEFINED     gequ     $1D
; UNDEFINED     gequ     $1F

;-----------------------------------------------------------
; Operand format masks.
;-----------------------------------------------------------
FFEXT           gequ     $000            ; extended -- 80-bit float
FFDBL           gequ     $100            ; double   -- 64-bit float
FFSGL           gequ     $200            ; single   -- 32-bit float
FFLNG           gequ     $300            ; longint  -- 32-bit integer                                                   
FFINT           gequ     $400            ; integer  -- 16-bit integer
FFCOMP          gequ     $500            ; comp     -- 64-bit integer
; UNDEFINED     gequ     $600
; UNDEFINED     gequ     $700

;-----------------------------------------------------------
; Class and sign inquiries.
;-----------------------------------------------------------
FCSNAN          gequ     $FC             ; -4: signaling NAN
FCQNAN          gequ     $FD             ; -3: quiet NAN
FCINF           gequ     $FE             ; -2: infinite
FCZERO          gequ     $FF             ; -1: zero
FCNORM          gequ     $00             ;  0: normal
FCDENORM        gequ     $01             ;  1: denormal

;-----------------------------------------------------------
; Exceptions.
;-----------------------------------------------------------
FBINVALID       gequ     $1
FBUFLOW         gequ     $2
FBOFLOW         gequ     $4
FBDIVZER        gequ     $8
FBINEXACT       gequ     $10

;-----------------------------------------------------------
; Elementary function operation code masks.
;-----------------------------------------------------------
FOLNX           gequ     $00             ; base-e log 
FOLOG2X         gequ     $02             ; base-2 log
FOLN1X          gequ     $04             ; ln (1 + x)
FOLOG21X        gequ     $06             ; log2 (1 + x)
FOEXPX          gequ     $08             ; base-e exponential  
FOEXP2X         gequ     $0A             ; base-2 exponential
FOEXP1X         gequ     $0C             ; exp (x) - 1
FOEXP21X        gequ     $0E             ; exp2 (x) - 1
FOXPWRI         gequ     $10             ; integer exponentiation
FOXPWRY         gequ     $12             ; general exponentiation
FOCOMPOUND      gequ     $14             ; compound
FOANNUITY       gequ     $16             ; annuity
FOATANX         gequ     $18             ; arctangent
FOSINX          gequ     $1A             ; sine
FOCOSX          gequ     $1C             ; cosine
FOTANX          gequ     $1E             ; tangent
FORANDX         gequ     $20             ; random

;-----------------------------------------------------------
; Scanner and formatter operation code masks.
;-----------------------------------------------------------
FOPSTR2DEC      gequ     0               ; Pascal string to decimal record
FOCSTR2DEC      gequ     2               ; C string (char stream) to dec. record
FODEC2STR       gequ     1               ; decimal record to (Pascal) string

;-----------------------------------------------------------
; NaN codes.  
;-----------------------------------------------------------
NANSQRT         gequ     1               ; Invalid square root such as sqrt(-1)
NANADD          gequ     2               ; Invalid addition such as +INF - +INF 
NANDIV          gequ     4               ; Invalid division such as 0/0 
NANMUL          gequ     8               ; Invalid multiply such as 0 * INF 
NANREM          gequ     9               ; Invalid rem or mod such as x REM 0 
NANASCBIN       gequ     17              ; Conversion of invalid ASCII string 
NANCOMP         gequ     20              ; Comp NaN converted to floating
NANZERO         gequ     21              ; Attempt to create a NaN with zero code
NANTRIG         gequ     33              ; Invalid argument to trig routine 
NANINVTRIG      gequ     34              ; Invalid arg to inverse trig routine 
NANLOG          gequ     36              ; Invalid argument to log routine 
NANPOWER        gequ     37              ; Invalid argument to x^i or x^y routine 
NANFINAN        gequ     38              ; Invalid argument to financial function 
            

relop_GREATERTHAN GEQU 0 ;
relop_LESSTHAN GEQU 1 ;
relop_EQUALTO GEQU 2 ;
relop_UNORDERED GEQU 3 ;

numclass_SNAN GEQU 0 ;
numclass_QNAN GEQU 1 ;
numclass_INFINITE GEQU 2 ;
numclass_ZERONUM GEQU 3 ;
numclass_NORMALNUM GEQU 4 ;
numclass_DENORMALNUM GEQU 5 ;

rounddir_TONEAREST GEQU 0 ;
rounddir_UPWARD GEQU 1 ;
rounddir_DOWNWARD GEQU 2 ;
rounddir_TOWARDZERO GEQU 3 ;

roundpre_EXTPRECISION GEQU 0 ;
roundpre_DBLPRECISION GEQU 1 ;
roundpre_FLOATPRECISION GEQU 2 ;

