comparison packages/language/c/libm/current/src/double/ieee754-api/w_sqrt.c @ 0:3111d98ba7b3 ecos-v1_1-release

Initial commit of eCos version 1.1
author jlarmour
date Tue, 11 May 1999 11:16:07 +0000
parents
children 443894e2e912
comparison
equal deleted inserted replaced
-1:000000000000 0:3111d98ba7b3
1 //===========================================================================
2 //
3 // w_sqrt.c
4 //
5 // Part of the standard mathematical function library
6 //
7 //===========================================================================
8 //####COPYRIGHTBEGIN####
9 //
10 // -------------------------------------------
11 // The contents of this file are subject to the Cygnus eCos Public License
12 // Version 1.0 (the "License"); you may not use this file except in
13 // compliance with the License. You may obtain a copy of the License at
14 // http://sourceware.cygnus.com/ecos
15 //
16 // Software distributed under the License is distributed on an "AS IS"
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
18 // License for the specific language governing rights and limitations under
19 // the License.
20 //
21 // The Original Code is eCos - Embedded Cygnus Operating System, released
22 // September 30, 1998.
23 //
24 // The Initial Developer of the Original Code is Cygnus. Portions created
25 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved.
26 // -------------------------------------------
27 //
28 //####COPYRIGHTEND####
29 //===========================================================================
30 //#####DESCRIPTIONBEGIN####
31 //
32 // Author(s): jlarmour@cygnus.co.uk
33 // Contributors: jlarmour@cygnus.co.uk
34 // Date: 1998-02-13
35 // Purpose:
36 // Description:
37 // Usage:
38 //
39 //####DESCRIPTIONEND####
40 //
41 //===========================================================================
42
43 // CONFIGURATION
44
45 #include <pkgconf/libm.h> // Configuration header
46
47 // Include the Math library?
48 #ifdef CYGPKG_LIBM
49
50 // Derived from code with the following copyright
51
52
53 /* @(#)w_sqrt.c 1.3 95/01/18 */
54 /*
55 * ====================================================
56 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
57 *
58 * Developed at SunSoft, a Sun Microsystems, Inc. business.
59 * Permission to use, copy, modify, and distribute this
60 * software is freely granted, provided that this notice
61 * is preserved.
62 * ====================================================
63 */
64
65 /*
66 * wrapper sqrt(x)
67 */
68
69 #include "mathincl/fdlibm.h"
70
71 double sqrt(double x) /* wrapper sqrt */
72 {
73 #ifdef CYGSEM_LIBM_COMPAT_IEEE_ONLY
74 return __ieee754_sqrt(x);
75 #else
76 double z;
77 z = __ieee754_sqrt(x);
78 if(cyg_libm_get_compat_mode() == CYGNUM_LIBM_COMPAT_IEEE || isnan(x)) return z;
79 if(x<0.0) {
80 return __kernel_standard(x,x,26); /* sqrt(negative) */
81 } else
82 return z;
83 #endif
84 }
85
86 #endif // ifdef CYGPKG_LIBM
87
88 // EOF w_sqrt.c