You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/fma-fmaf-fmal.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: "fma, fmaf, fmal"
3
-
description: "API reference for fma, fmaf, and fmal; which multiplies two values together, adds a third value, and then rounds the result, without losing any precision due to intermediary rounding."
3
+
description: "API reference for fma, fmaf, and fmal; which multiplies two values together, adds a third value, and then rounds the result, while only losing a small amount of precision due to intermediary rounding."
Multiplies two values together, adds a third value, and then rounds the result, without losing any precision due to intermediary rounding.
15
+
Multiplies two values together, adds a third value, and then rounds the result, while only losing a small amount of precision due to intermediary rounding.
16
16
17
17
## Syntax
18
18
@@ -63,7 +63,7 @@ The value to add.
63
63
64
64
## Return value
65
65
66
-
Returns `(x * y) + z`. The return value is then rounded using the current rounding format.
66
+
Returns approximately `(x * y) + z`. The return value is then rounded using the current rounding format, although in many cases, it returns incorrectly rounded results and thus the value may be inexact by up to half an ulp from the correct value.
67
67
68
68
Otherwise, may return one of the following values:
The following code generates this warning because variable `i` is only initialized if `b` is true; otherwise an uninitialized `i` is returned:
20
+
The following code generates this warning because variable `i` is only initialized if `b` is true:
22
21
23
22
```cpp
24
23
intf( bool b )
@@ -49,9 +48,7 @@ int f( bool b )
49
48
50
49
## Heuristics
51
50
52
-
Variables are also considered initialized when they're passed by reference to
53
-
another function. Thus, the following example would also consider `i` to be
54
-
initialized.
51
+
The following example shows that passing a variable to a function by reference causes the compiler to assume that it's initialized:
55
52
56
53
```cpp
57
54
voidinit( int& i );
@@ -66,18 +63,13 @@ int f( bool b )
66
63
{
67
64
i = 0;
68
65
}
69
-
return i; // i is assumed to be initialized by init(i)
66
+
return i; // i is assumed to be initialized because it's passed by reference to init()
70
67
}
71
68
```
72
69
73
-
This is to support the pattern of passing a pointer to a variable into
74
-
an initialization function.
70
+
This supports the pattern of passing a pointer to a variable into an initialization function.
75
71
76
-
Since many functions expect pointers to point to initialized data already, this
77
-
heuristic can lead to false negatives. [SAL annotations] such as `_In_` and
78
-
`_Out_` can be used to more precisely describe a function's behavior. For
79
-
example, in the following we call an external function that expects its argument
80
-
to already be initialized and the warning is still generated.
72
+
This heuristic can lead to false negatives because many functions expect pointers that point to initialized data. Use [SAL annotations](annotating-function-parameters-and-return-values.md), such as `_In_` and `_Out_`, to describe the function's behavior. The following example calls a function that expects its argument to be initialized, so a warning is generated:
81
73
82
74
```cpp
83
75
void use( _In_ int& i );
@@ -86,7 +78,7 @@ int f( bool b )
86
78
{
87
79
int i;
88
80
89
-
use(i); // uninitialized variable warning because of _In_ annotation on use
81
+
use(i); // uninitialized variable warning because of the _In_ annotation on use()
0 commit comments