source: trunk/libs/newlib/src/newlib/libm/common/s_fma.c @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.4 KB
Line 
1/*
2FUNCTION
3<<fma>>, <<fmaf>>---floating multiply add
4INDEX
5        fma
6INDEX
7        fmaf
8
9SYNOPSIS
10        #include <math.h>
11        double fma(double <[x]>, double <[y]>, double <[z]>);
12        float fmaf(float <[x]>, float <[y]>, float <[z]>);
13
14DESCRIPTION
15The <<fma>> functions compute (<[x]> * <[y]>) + <[z]>, rounded as one ternary
16operation:  they compute the value (as if) to infinite precision and round once
17to the result format, according to the rounding mode characterized by the value
18of FLT_ROUNDS.  That is, they are supposed to do this:  see below.
19
20RETURNS
21The <<fma>> functions return (<[x]> * <[y]>) + <[z]>, rounded as one ternary
22operation.
23
24BUGS
25This implementation does not provide the function that it should, purely
26returning "(<[x]> * <[y]>) + <[z]>;" with no attempt at all to provide the
27simulated infinite precision intermediates which are required.  DO NOT USE THEM.
28
29If double has enough more precision than float, then <<fmaf>> should provide
30the expected numeric results, as it does use double for the calculation.  But
31since this is not the case for all platforms, this manual cannot determine
32if it is so for your case.
33
34PORTABILITY
35ANSI C, POSIX.
36
37*/
38
39#include "fdlibm.h"
40
41#ifndef _DOUBLE_IS_32BITS
42
43#ifdef __STDC__
44        double fma(double x, double y, double z)
45#else
46        double fma(x,y)
47        double x;
48        double y;
49        double z;
50#endif
51{
52  /* Implementation defined. */
53  return (x * y) + z;
54}
55
56#endif /* _DOUBLE_IS_32BITS */
Note: See TracBrowser for help on using the repository browser.