lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. |
2 | * | ||||
3 | * Permission to use, copy, modify, and distribute this software | ||||
4 | * is freely granted, provided that this notice is preserved. | ||||
5 | */ | ||||
6 | |||||
7 | #include "math.h" | ||||
8 | #include "math_private.h" | ||||
9 | |||||
10 | double fdim(double x, double y) | ||||
11 | { | ||||
12 | int c = __fpclassify(x); | ||||
13 | if (c == FP_NAN || c == FP_INFINITE) | ||||
14 | return HUGE_VAL; | ||||
15 | |||||
16 | return x > y ? x - y : 0.0; | ||||
17 | } | ||||
18 | libm_hidden_def(fdim) |