1# 2#Copyright (c) 1990 The Regents of the University of California. 3#All rights reserved. 4# 5#Redistribution and use in source and binary forms are permitted 6#provided that the above copyright notice and this paragraph are 7#duplicated in all such forms and that any documentation, 8#and/or other materials related to such 9#distribution and use acknowledge that the software was developed 10#by the University of California, Berkeley. The name of the 11#University may not be used to endorse or promote products derived 12#from this software without specific prior written permission. 13#THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14#IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16# 17@node machine,,syscalls,Top 18@chapter NEC V70 Specific Functions 19 20The NEC V70 has machine instructions for fast IEEE floating-point 21arithmetic, including operations normally provided by the library. 22 23When you use the @file{/usr/include/fastmath.h} header file, the 24names of several library math functions are redefined to call the 25@code{fastmath} routine (using the corresponding V70 machine instructions) 26whenever possible. 27 28For example, 29@example 30 31#include <fastmath.h> 32 33double sqsin(x) 34double x; 35@{ 36 return sin(x*x); 37@} 38 39@end example 40expands into the code 41@example 42 43@dots{} 44double sqsin(x) 45double x; 46@{ 47 return fast_sin(x*x); 48@} 49 50@end example 51 52The library has an entry @code{fast_sin} which uses the machine 53instruction @code{fsin.l} to perform the operation. Note that the 54built-in instructions cannot set @code{errno} 55in the same way that the C coded functions do. Refer to a V70 56instruction manual to see how errors are generated and handled. 57 58Also, the library provides true @code{float} entry points. The 59@code{fast_sinf} entry point really performs a @code{fsin.s} 60operation. Because of this, the instructions are only useful when 61using code compiled with an ANSI C compiler. The prototypes 62and definitions for the floating-point versions of the math library 63routines are only defined if compiling a module with an ANSI C 64compiler. 65 66@page 67@section Entry points 68The functions provided by @file{fastmath.h} are 69@example 70 71 double fast_sin(double); /* fsin.l */ 72 double fast_cos(double); /* fcos.l */ 73 double fast_tan(double); /* ftan.l */ 74 double fast_asin(double); /* fasin.l */ 75 double fast_acos(double); /* facos.l */ 76 double fast_atan(double); /* fatan.l */ 77 double fast_sinh(double); /* fsinh.l */ 78 double fast_cosh(double); /* fcosh.l */ 79 double fast_tanh(double); /* ftanh.l */ 80 double fast_asinh(double); /* fasinh.l */ 81 double fast_acosh(double); /* facosh.l */ 82 double fast_atanh(double); /* fatanh.l */ 83 double fast_fabs(double); /* fabs.l */ 84 double fast_sqrt(double); /* fsqrt.l */ 85 double fast_exp2(double); /* fexp2.l */ 86 double fast_exp10(double); /* fexp10.l */ 87 double fast_expe(double); /* fexpe.l */ 88 double fast_log10(double); /* flog10.l */ 89 double fast_log2(double); /* flog2.l */ 90 double fast_loge(double); /* floge.l */ 91 92 float fast_sinf(float); /* fsin.s */ 93 float fast_cosf(float); /* fcos.s */ 94 float fast_tanf(float); /* ftan.s */ 95 float fast_asinf(float); /* fasin.s */ 96 float fast_acosf(float); /* facos.s */ 97 float fast_atanf(float); /* fatan.s */ 98 float fast_sinhf(float); /* fsinh.s */ 99 float fast_coshf(float); /* fcosh.s */ 100 float fast_tanhf(float); /* ftanh.s */ 101 float fast_asinhf(float); /* fasinh.s */ 102 float fast_acoshf(float); /* facosh.s */ 103 float fast_atanhf(float); /* fatanh.s */ 104 float fast_fabsf(float); /* fabs.s */ 105 float fast_sqrtf(float); /* fsqrt.s */ 106 float fast_exp2f(float); /* fexp2.s */ 107 float fast_exp10f(float); /* fexp10.s */ 108 float fast_expef(float); /* fexpe.s */ 109 float fast_log10f(float); /* flog10.s */ 110 float fast_log2f(float); /* flog2.s */ 111 float fast_logef(float); /* floge.s */ 112 113@end example 114 115 116