Skip to content

Commit d0ad3bf

Browse files
author
Steve Wishnousky
authored
Add 19041 printf behavior changes
In Windows 10 19041, there is a change to the printf floating point behavior in the Universal C Runtime so that it conforms with IEEE 754.
1 parent b53735d commit d0ad3bf

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

docs/c-runtime-library/reference/printf-printf-l-wprintf-wprintf-l.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ Line one
101101

102102
The console is not supported in Universal Windows Platform (UWP) apps. The standard stream handles that are associated with the console, **stdin**, **stdout**, and **stderr**, must be redirected before C run-time functions can use them in UWP apps. For additional compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
103103

104+
> [!IMPORTANT]
105+
> As of Windows 10 19041, the printf family of functions will print exactly representable floating point numbers according to the IEEE 754 rules for rounding. In previous versions of Windows, exactly representable floating point numbers ending in '5' would always round up, whereas IEEE 754 states that they must round to the closest even digit (also known as "Banker's Rounding"). For example, both 1.5 and 2.5 should round to 2, whereas previously 1.5 would round to 2 and 2.5 would round to 3. This only affects exactly representable numbers, so 2.35 (which, when represented in memory, is closer to 2.35000000000000008) will continue to round up to 2.4. In addition, rounding done by these functions now respect the floating point rounding mode set via [fesetenv](fesetenv1.md). Previously, rounding always chose FE_TONEAREST behavior. This change only affects programs that have been built with Visual Studio 2019 16.2 and later. To use the legacy floating point rounding behavior, link with [legacy_stdio_float_rounding.obj](../../c-runtime-library/link-options.md).
106+
104107
## Example
105108

106109
```C

0 commit comments

Comments
 (0)