OSDN Git Service

Add POSIX compliant errno assignments to log functions.
[mingw/mingw-org-wsl.git] / mingwrt / mingwex / math / log10_generic.sx
1 /*
2  * log10_generic.sx
3  *
4  * Generic wrapper for implementation entry stubs for each of the log10(),
5  * log10l(), and log10f() functions.
6  *
7  * $Id$
8  *
9  * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
10  * Copyright (C) 2016, MinGW.org Project
11  *
12  * Adapted from original code written by J. T. Conklin <jtc@netbsd.org>,
13  * with modifications by Ulrich Drepper <drepper@cygnus.com>, to improve
14  * accuracy in the computation of log10(x) as x --> 1.0.  This wrapper
15  * provides only definitions for derivation of the implementations by
16  * inclusion of the log_generic.sx source file.
17  *
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining a
20  * copy of this software and associated documentation files (the "Software"),
21  * to deal in the Software without restriction, including without limitation
22  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
23  * and/or sell copies of the Software, and to permit persons to whom the
24  * Software is furnished to do so, subject to the following conditions:
25  *
26  * The above copyright notice and this permission notice (including the next
27  * paragraph) shall be included in all copies or substantial portions of the
28  * Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
35  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
36  * DEALINGS IN THE SOFTWARE.
37  *
38  */
39 #undef ___function
40
41 /* Each of the log10(), log10f(), and log10l() functions returns a common
42  * (base-10) logarithm; this may be computed directly, using either the FYL2X,
43  * or the FYL2X1P instruction, by setting the scaling factor (y) to the common
44  * logarithm of two.
45  */
46 #define __fldy  fldlg2
47
48 /* The first step is to identify the primary entry point name, and associated
49  * back-end names, for each of the three supported functions, (each of which
50  * to be assembled separately, using a GCC command of the form:
51  *
52  *    gcc -c -D_<function>_source log10_generic.sx -o <function>.o
53  *
54  * to create the three entry stubs, with appropriate mappings to the back-end
55  * implementation provided by log_generic.sx
56  */
57 #if defined _log10_source
58 # define ___function     _log10         /* log10() function entry point name */
59 # define ___x87cvt     ___x87cvt        /* return value conversion helper */
60 # define __fldx           fldl          /* FLD instruction to load x value */
61
62 #elif defined _log10l_source
63 # define ___function     _log10l        /* log10l() function entry point name */
64 # define __fldx           fldt          /* FLD instruction to load x value */
65
66 #elif defined _log10f_source
67 # define ___function     _log10f        /* log10f() function entry point name */
68 # define ___x87cvt     ___x87cvtf       /* return value conversion helper */
69 # define __fldx           flds          /* FLD instruction to load x value */
70 #endif
71
72 /* Actual implementation of the entry point stubs, in terms of the preceding
73  * definitions, is delegated to the log_generic.sx source file.
74  */
75 #include "log_generic.sx"
76
77 /* vim: set autoindent filetype=asm formatoptions=croql: */
78 /* $RCSfile$: end of file */