Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libm / common / s_fma.c
blob15c7d23f57287e6d790294a32bf8fe4f4a0e6d00
1 /*
2 FUNCTION
3 <<fma>>, <<fmaf>>---floating multiply add
4 INDEX
5 fma
6 INDEX
7 fmaf
9 SYNOPSIS
10 #include <math.h>
11 double fma(double <[x]>, double <[y]>, double <[z]>);
12 float fmaf(float <[x]>, float <[y]>, float <[z]>);
14 DESCRIPTION
15 The <<fma>> functions compute (<[x]> * <[y]>) + <[z]>, rounded as one ternary
16 operation: they compute the value (as if) to infinite precision and round once
17 to the result format, according to the rounding mode characterized by the value
18 of FLT_ROUNDS. That is, they are supposed to do this: see below.
20 RETURNS
21 The <<fma>> functions return (<[x]> * <[y]>) + <[z]>, rounded as one ternary
22 operation.
24 BUGS
25 This implementation does not provide the function that it should, purely
26 returning "(<[x]> * <[y]>) + <[z]>;" with no attempt at all to provide the
27 simulated infinite precision intermediates which are required. DO NOT USE THEM.
29 If double has enough more precision than float, then <<fmaf>> should provide
30 the expected numeric results, as it does use double for the calculation. But
31 since this is not the case for all platforms, this manual cannot determine
32 if it is so for your case.
34 PORTABILITY
35 ANSI C, POSIX.
39 #include "fdlibm.h"
41 #if !HAVE_FAST_FMA
43 #ifndef _DOUBLE_IS_32BITS
45 #ifdef __STDC__
46 double fma(double x, double y, double z)
47 #else
48 double fma(x,y)
49 double x;
50 double y;
51 double z;
52 #endif
54 /* Implementation defined. */
55 return (x * y) + z;
58 #endif /* _DOUBLE_IS_32BITS */
60 #endif /* !HAVE_FAST_FMA */