1 | @node machine,,syscalls,Top |
---|
2 | @chapter NEC V70 Specific Functions |
---|
3 | |
---|
4 | The NEC V70 has machine instructions for fast IEEE floating-point |
---|
5 | arithmetic, including operations normally provided by the library. |
---|
6 | |
---|
7 | When you use the @file{/usr/include/fastmath.h} header file, the |
---|
8 | names of several library math functions are redefined to call the |
---|
9 | @code{fastmath} routine (using the corresponding V70 machine instructions) |
---|
10 | whenever possible. |
---|
11 | |
---|
12 | For example, |
---|
13 | @example |
---|
14 | |
---|
15 | #include <fastmath.h> |
---|
16 | |
---|
17 | double sqsin(x) |
---|
18 | double x; |
---|
19 | @{ |
---|
20 | return sin(x*x); |
---|
21 | @} |
---|
22 | |
---|
23 | @end example |
---|
24 | expands into the code |
---|
25 | @example |
---|
26 | |
---|
27 | @dots{} |
---|
28 | double sqsin(x) |
---|
29 | double x; |
---|
30 | @{ |
---|
31 | return fast_sin(x*x); |
---|
32 | @} |
---|
33 | |
---|
34 | @end example |
---|
35 | |
---|
36 | The library has an entry @code{fast_sin} which uses the machine |
---|
37 | instruction @code{fsin.l} to perform the operation. Note that the |
---|
38 | built-in instructions cannot call @code{matherr} or set @code{errno} |
---|
39 | in the same way that the C coded functions do. Refer to a V70 |
---|
40 | instruction manual to see how errors are generated and handled. |
---|
41 | |
---|
42 | Also, the library provides true @code{float} entry points. The |
---|
43 | @code{fast_sinf} entry point really performs a @code{fsin.s} |
---|
44 | operation. Because of this, the instructions are only useful when |
---|
45 | using code compiled with an ANSI C compiler. The prototypes |
---|
46 | and definitions for the floating-point versions of the math library |
---|
47 | routines are only defined if compiling a module with an ANSI C |
---|
48 | compiler. |
---|
49 | |
---|
50 | @page |
---|
51 | @section Entry points |
---|
52 | The functions provided by @file{fastmath.h} are |
---|
53 | @example |
---|
54 | |
---|
55 | double fast_sin(double); /* fsin.l */ |
---|
56 | double fast_cos(double); /* fcos.l */ |
---|
57 | double fast_tan(double); /* ftan.l */ |
---|
58 | double fast_asin(double); /* fasin.l */ |
---|
59 | double fast_acos(double); /* facos.l */ |
---|
60 | double fast_atan(double); /* fatan.l */ |
---|
61 | double fast_sinh(double); /* fsinh.l */ |
---|
62 | double fast_cosh(double); /* fcosh.l */ |
---|
63 | double fast_tanh(double); /* ftanh.l */ |
---|
64 | double fast_asinh(double); /* fasinh.l */ |
---|
65 | double fast_acosh(double); /* facosh.l */ |
---|
66 | double fast_atanh(double); /* fatanh.l */ |
---|
67 | double fast_fabs(double); /* fabs.l */ |
---|
68 | double fast_sqrt(double); /* fsqrt.l */ |
---|
69 | double fast_exp2(double); /* fexp2.l */ |
---|
70 | double fast_exp10(double); /* fexp10.l */ |
---|
71 | double fast_expe(double); /* fexpe.l */ |
---|
72 | double fast_log10(double); /* flog10.l */ |
---|
73 | double fast_log2(double); /* flog2.l */ |
---|
74 | double fast_loge(double); /* floge.l */ |
---|
75 | |
---|
76 | float fast_sinf(float); /* fsin.s */ |
---|
77 | float fast_cosf(float); /* fcos.s */ |
---|
78 | float fast_tanf(float); /* ftan.s */ |
---|
79 | float fast_asinf(float); /* fasin.s */ |
---|
80 | float fast_acosf(float); /* facos.s */ |
---|
81 | float fast_atanf(float); /* fatan.s */ |
---|
82 | float fast_sinhf(float); /* fsinh.s */ |
---|
83 | float fast_coshf(float); /* fcosh.s */ |
---|
84 | float fast_tanhf(float); /* ftanh.s */ |
---|
85 | float fast_asinhf(float); /* fasinh.s */ |
---|
86 | float fast_acoshf(float); /* facosh.s */ |
---|
87 | float fast_atanhf(float); /* fatanh.s */ |
---|
88 | float fast_fabsf(float); /* fabs.s */ |
---|
89 | float fast_sqrtf(float); /* fsqrt.s */ |
---|
90 | float fast_exp2f(float); /* fexp2.s */ |
---|
91 | float fast_exp10f(float); /* fexp10.s */ |
---|
92 | float fast_expef(float); /* fexpe.s */ |
---|
93 | float fast_log10f(float); /* flog10.s */ |
---|
94 | float fast_log2f(float); /* flog2.s */ |
---|
95 | float fast_logef(float); /* floge.s */ |
---|
96 | |
---|
97 | @end example |
---|
98 | |
---|
99 | |
---|