| Commit | Line | Data |
|---|---|---|
| 4d3e9548 | 1 | /* Copyright (C) 2005, 2009 Free Software Foundation, Inc. |
| 465b256c JR |
2 | This file is part of the GNU C Library. |
| 3 | ||
| 4 | The GNU C Library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Library General Public License as | |
| 4d3e9548 JL |
6 | published by the Free Software Foundation, either version 3 of the License, or |
| 7 | (at your option) any later version. | |
| 465b256c JR |
8 | |
| 9 | The GNU C Library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Library General Public License for more details. | |
| 13 | ||
| 4d3e9548 JL |
14 | You should have received a copy of the GNU Library General Public License |
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
| 465b256c JR |
16 | |
| 17 | #ifdef HAVE_CONFIG_H | |
| 18 | #include <config.h> | |
| 19 | #endif | |
| 20 | ||
| 21 | #include <math.h> | |
| 22 | ||
| 23 | #ifdef NEED_DECLARATION_HYPOT | |
| 24 | double hypot(double, double); | |
| 25 | #endif /* NEED_DECLARATION_HYPOT */ | |
| 26 | ||
| 27 | double groff_hypot(double x, double y) | |
| 28 | { | |
| 29 | double result = hypot(x, y); | |
| 30 | ||
| 31 | #ifdef __INTERIX | |
| 32 | /* hypot() on Interix is broken */ | |
| 33 | if (isnan(result) && !isnan(x) && !isnan(y)) | |
| 34 | return 0.0; | |
| 35 | #endif | |
| 36 | ||
| 37 | return result; | |
| 38 | } |