SANEGLUE(3)                    Library Routines                    SANEGLUE(3)




NAME

       findfpcp,  s_num2dec,  s_dec2num, s_str2dec, s_dec2str, s_fabs, s_fneg,
       s_sqrt, s_rint, s_scalb, s_logb, s_copysign, s_nextfloat, s_nextdouble,
       s_nextextended,  s_log2, s_log, s_log1, s_exp2, s_exp, s_exp1, s_power,
       s_ipower, s_compound, s_annuity, s_tan, s_sin,  s_cos,  s_atan,  s_ran-
       domx,   s_classfloat,   s_classdouble,   s_classcomp,  s_classextended,
       s_signnum,  s_setexception,  s_testexception,  s_sethalt,   s_testhalt,
       s_setround,  s_getround,  s_setprecision, s_getprecision, s_setenviron-
       ment,  s_getenvironment,  s_procentry,   s_procexit,   s_gethaltvector,
       s_sethaltvector,  s_relation,  s_nan, s_inf, s_pi - ORCA/C interface to
       SANE (the Standard Apple Numerics Environment)


SYNOPSIS

       #include <sane.h>

       int findfpcp(void);
       void s_num2dec(DecForm *f, extended x, Decimal *d);
       extended s_dec2num(Decimal *d);
       void s_str2dec(char *s, short *ix, Decimal *d, short *vp);
       void s_dec2str(DecForm *f, Decimal *d, char *s);
       extended s_fabs(extended x);
       extended s_fneg(extended x);
       extended s_remainder(extended x, extended y, short *quo);
       extended s_sqrt(extended x);
       extended s_rint(extended x);
       extended s_scalb(short n, extended x);
       extended s_logb(extended x);
       extended s_copysign(extended x, extended y);
       extended s_nextfloat(extended x, extended y);
       extended s_nextdouble(extended x, extended y);
       extended s_nextextended(extended x, extended y);
       extended s_log2(extended x);
       extended s_log(extended x);
       extended s_log1(extended x);
       extended s_exp2(extended x);
       extended s_exp(extended x);
       extended s_exp1(extended x);
       extended s_power(extended x, extended y);
       extended s_ipower(extended x, short i);
       extended s_compound(extended r, extended n);
       extended s_annuity(extended r, extended n);
       extended s_tan(extended x);
       extended s_sin(extended x);
       extended s_cos(extended x);
       extended s_atan(extended x);
       extended s_randomx(extended *x);
       numclass s_classfloat(extended x);
       numclass s_classdouble(extended x);
       numclass s_classcomp(extended x);
       numclass s_classextended(extended x);
       int s_signnum(extended x);
       void s_setexception(exception e, long b);
       long s_testexception(exception e);
       void s_sethalt(exception e, long b);
       long s_testhalt(exception e);
       void s_setround(rounddir r);
       rounddir s_getround(void);
       void s_setprecision(roundpre p);
       roundpre s_getprecision(void);
       void s_setenvironment(environment e);
       void s_getenvironment(environment *e);
       void s_procentry(environment *e);
       void s_procexit(environment e);
       haltvector s_gethaltvector(void);
       void s_sethaltvector(haltvector v);
       relop s_relation(extended x, extended y);
       extended s_nan(unsigned char c);
       extended s_inf(void);
       extended s_pi(void);


DESCRIPTION

       The lsaneglue library contains code to  let  you  call  SANE  functions
       directly  from  ORCA/C.  To avoid namespace conflicts with <math.h>, it
       was necessary to change <sane.h>.  Thus, all  SANE  functions  are  now
       prefixed  with  s_.   (For  example,  annuity became s_annuity, and sin
       became s_sin.)  This lets you choose easily between the SANE and  ISO/C
       implementations of the same function.

       Below is a brief overview of the functions in lsaneglue.  This overview
       does not replace, however, proper documentation.  To  fully  understand
       SANE, you will need the Apple Numerics Manual.  SANE is also introduced
       in the Apple IIgs Toolbox Reference, Volume 2", Chapter 18.

       It is important that the file <sane.h> is used  as  the  reference  for
       constants  used  for  rounding  direction,  rounding  precision, number
       classes, ordering relations, formatting styles, NaN codes, and for set-
       tine and testing exceptions,

       In the following list, page numbers refer to the Apple Numerics Manual.

       findfpcp
              This function is specific to the lsaneglue library;  it  is  not
              part of SANE proper and is not documented elsewhere.

              findfpcp  will  find  an FPE (Innovative Systems' Floating Point
              Engine) or NC (Number Cruncher) card and return the slot  number
              in which it resides.  If a card is not found, it will return -1.

              You can use the output of this function as the argument for  the
              ORCA/C  setfpeslot(3)  routine, which is used when having ORCA/C
              create code for  the  FPE/NC  directly  (through  the  directive
              #pragma float 1 1).

       s_num2dec
              Converts extended number x to a SANE decimal record, I.  (pp 28)

       s_dec2num
              Converts SANE decimal record f to an extended number. (pp 28f)

       s_str2dec
              Converts string s to a SANE decimal record, d.  (pp 30f)

       s_dec2str
              Convert a SANE decimal record d to a string.  (pp 31ff)

       s_fabs Returns the absolute value of x.  (pp 49)

       s_fneg Reverses the sign of x.  (pp 49)

       s_remainder
              Returns the remainder x / y.  (pp 46f)

       s_sqrt Returns the square root of x.  (pp 46)

       s_rint Round x to integer in current rounding direction. (pp 47)

       s_scalb
              Returns (x times 2^n). (pp 50)

       s_logb Computes binary exponent of normalized x.  (pp 50)

       s_copysign
              Returns y with sign of x.  (pp 49)

       s_nextfloat
              Returns next float number after x in direction of y.  (pp 50)

       s_nextdouble
              Returns next double number after x in direction of y.  (pp 50)

       s_nextextended
              Returns next extended number after x in direction of y.  (pp 50)

       s_log2 Returns the base-2 logarithm of x.  (pp 62)

       s_log  Returns base-e (natural) logarithm of x.  (pp 62)

       s_log1 Returns base-e (natural) logarithm of (x+1). (pp 62)

       s_exp2 Returns base-2 exponantial of x (2^x). (pp 63f)

       s_exp  Returns base-e (natural) exponantial of x (x^e). (pp 63f)

       s_exp1 Returns  base-e  (natural)  exponantial  of x minus 1 (x^e - 1).
              (pp 63f)

       s_power
              Returns x^y.  (pp 63f)

       s_ipower
              Returns x^i.  (pp 63f)

       s_compound
              Compute compound (1+r)^n. (pp 64f)

       s_annuity
              Compute annuity (1-(1+r)^n)/r. (pp 65)

       s_tan  Returns tangent of x.  (pp 67f)

       s_sin  Returns sine of x.  (pp 67)

       s_cos  Returns cosine of x.  (pp 67)

       s_atan Returns arctangent of x.  (pp 67f)

       s_randomx
              Returns a pseudorandom integer value with seed x.  (pp 67)

       s_classfloat
              Returns classification of float x.  (pp 44)

       s_classdouble
              Returns classification of double x.  (pp 44)

       s_classcomp
              Returns classification of comp x.  (pp 44)

       s_classextended
              Returns classification of extended x.  (pp 44)

       s_signnum
              Returns sign of x; zero if positive, 1 if negative. (pp 44)

       s_setexception
              Clear or set SANE exceptions. (pp 54ff)

       s_testexception
              Check whether SANE exception is currently set. (pp 54ff)

       s_sethalt
              Clear or set SANE exception halts. (pp 54ff)

       s_testhalt
              Check whether SANE exception halt is currently set. (pp 54ff)

       s_setround
              Set SANE rounding direction. (pp 52f)

       s_getround
              Get SANE rounding direction. (pp 52f)

       s_setprecision
              Set SANE rounding precision. (pp 53)

       s_getprecision
              Get SANE rounding precision. (pp 53)

       s_setenvironment
              Set SANE environment word. (pp 57)

       s_getenvironment
              Get SANE environment word. (pp 57)

       s_procentry
              Save SANE environment word, then default it. (pp 57)

       s_procexit
              Restore SANE environment word, then signal exceptions. (pp 57)

       s_gethaltvector
              Get SANE halt vector. (pp 54)

       s_sethaltvector
              Set SANE halt vector. (pp 54)

       s_relation
              Returns relation of x to y.  (pp 49)

       s_nan  Returns NaN of type c.

       s_inf  Returns +INF (Infinity).

       s_pi   Returns pi (3.141592653589793238512808959).


SANE TOOLKIT ERRORS

       The fclass functions should return the sign of the passed number in  n-
       bit  and Y. They do not report the sign at all, though, which has to be
       considered a bug.  s_signnum has been rewritten to not rely on  fclassx
       any more.


LEGALITIES

       This  library  and  the accompanying source code are hereby placed into
       the Public Domain. There is no warranty, express  or  implied,  on  the
       performance of the library or source code. The author is not liable for
       any damage that may occur as a direct or indirect result of  using  the
       library or source code.


AUTHOR

       Soenke Behrens <sbehrens@bigfoot.com>
       September 1997


SEE ALSO

       Apple  Computers, Inc, Apple Numerics Manual.  Addison-Wesley, 2nd Edi-
       tion. 1988.  ISBN 0-201-17738-2.

       Apple Comuters, Inc, Apple IIgs Toolbox Reference, Volume 2.   Addison-
       Wesley. 1988.  ISBN 0-201-17747-1.  (Chapter 18.)



GNO                            21 September 1997                   SANEGLUE(3)

Man(1) output converted with man2html