[llvm-bugs] [Bug 51542] New: Clang on Windows: under FE_UPWARD printf(“%.1f\n”, 0.0) prints 0.1 instead of 0.0

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 19 09:57:03 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51542

            Bug ID: 51542
           Summary: Clang on Windows: under FE_UPWARD printf(“%.1f\n”,
                    0.0) prints 0.1 instead of 0.0
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: pavel.morozkin at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Sample code (t928.c):

#include <stdio.h>
#include <fenv.h>
#pragma fenv_access     (on)

int main(void)
{
        int i = fesetround( FE_UPWARD );
        if ( ! i )
        {
                printf( "%.1f\n", 0.0 );
        }
        return 0;
}

Invocation: clang t928.c -Wall -Wextra -std=c11 -ffp-model=strict -pedantic &&
./a.exe

Expected output: 0.0

Actual output: 0.1

Tool version: 12.0.0

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210819/1e91d8ba/attachment.html>


More information about the llvm-bugs mailing list