[LLVMbugs] [Bug 20537] New: duration_cast has rounding bug converting long double seconds to long long nanoseconds
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Aug 4 16:51:50 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20537
Bug ID: 20537
Summary: duration_cast has rounding bug converting long double
seconds to long long nanoseconds
Product: libc++
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: vlovich at gmail.com
CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
Classification: Unclassified
Created attachment 12856
--> http://llvm.org/bugs/attachment.cgi?id=12856&action=edit
Sample code demonstrating rounding bug
Converting from floating-point seconds to nanoseconds, there is a demonstrable
rounding bug. It looks like converting from floating-point seconds to integral
nanoseconds uses division by 1e-9 instead of multiplication by 1e9 which causes
rounding error when the floating-point storage is long double.
Sample code attached.
This problem does not appear to occur in gcc/libstdc++.
--
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/20140804/4f8387bf/attachment.html>
More information about the llvm-bugs
mailing list