Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libm / common / s_fdim.c
blob61a4908f30422b8079daa639245ebc801d935272
1 /* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
3 * Permission to use, copy, modify, and distribute this software
4 * is freely granted, provided that this notice is preserved.
5 */
6 /*
7 FUNCTION
8 <<fdim>>, <<fdimf>>---positive difference
9 INDEX
10 fdim
11 INDEX
12 fdimf
14 SYNOPSIS
15 #include <math.h>
16 double fdim(double <[x]>, double <[y]>);
17 float fdimf(float <[x]>, float <[y]>);
19 DESCRIPTION
20 The <<fdim>> functions determine the positive difference between their
21 arguments, returning:
22 . <[x]> - <[y]> if <[x]> > <[y]>, or
23 @ifnottex
24 . +0 if <[x]> <= <[y]>, or
25 @end ifnottex
26 @tex
27 . +0 if <[x]> $\leq$ <[y]>, or
28 @end tex
29 . NAN if either argument is NAN.
30 A range error may occur.
32 RETURNS
33 The <<fdim>> functions return the positive difference value.
35 PORTABILITY
36 ANSI C, POSIX.
40 #include "fdlibm.h"
42 #ifndef _DOUBLE_IS_32BITS
44 #ifdef __STDC__
45 double fdim(double x, double y)
46 #else
47 double fdim(x,y)
48 double x;
49 double y;
50 #endif
52 if (__fpclassifyd(x) == FP_NAN) return(x);
53 if (__fpclassifyd(y) == FP_NAN) return(y);
55 return x > y ? x - y : 0.0;
58 #endif /* _DOUBLE_IS_32BITS */