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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to