1151497Sru/* Copyright (C) 2005 Free Software Foundation, Inc.
2151497SruThis file is part of the GNU C Library.
3151497Sru
4151497SruThe GNU C Library is free software; you can redistribute it and/or
5151497Srumodify it under the terms of the GNU Library General Public License as
6151497Srupublished by the Free Software Foundation; either version 2 of the
7151497SruLicense, or (at your option) any later version.
8151497Sru
9151497SruThe GNU C Library is distributed in the hope that it will be useful,
10151497Srubut WITHOUT ANY WARRANTY; without even the implied warranty of
11151497SruMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12151497SruLibrary General Public License for more details.
13151497Sru
14151497SruYou should have received a copy of the GNU Library General Public
15151497SruLicense along with the GNU C Library; see the file COPYING.LIB.  If
16151497Srunot, write to the Free Software Foundation, Inc., 675 Mass Ave,
17151497SruCambridge, MA 02139, USA.  */
18151497Sru
19151497Sru#ifdef HAVE_CONFIG_H
20151497Sru#include <config.h>
21151497Sru#endif
22151497Sru
23151497Sru#include <math.h>
24151497Sru
25151497Sru#ifdef NEED_DECLARATION_HYPOT
26151497Sru  double hypot(double, double);
27151497Sru#endif /* NEED_DECLARATION_HYPOT */
28151497Sru
29151497Srudouble groff_hypot(double x, double y)
30151497Sru{
31151497Sru  double result = hypot(x, y);
32151497Sru
33151497Sru#ifdef __INTERIX
34151497Sru  /* hypot() on Interix is broken */
35151497Sru  if (isnan(result) && !isnan(x) && !isnan(y))
36151497Sru    return 0.0;
37151497Sru#endif
38151497Sru
39151497Sru  return result;
40151497Sru}
41