Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-899

[MSVC] pow (double (x), double (int (y))) and pow (double (x), int (y)) returns sometimes the different results on 64-bit MSVC

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: External
    • Labels:
      None
    • Environment:

      64-bit MSVC

    • Severity:
      Incorrect Behavior

      Description

      The 26.c.math test fails on 64-bit MSVC with the following assertions:

      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (-9.0, -8) = 2.32306e-08
      # CLAUSE: lib.c.math
      # LINE: 226
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (-9.0L, -8) = 2.32306e-08
      # CLAUSE: lib.c.math
      # LINE: 240
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (-9.0, -3) = -0.00137174, std::pow (-9.0, -3.0) = -0.00137174
      # CLAUSE: lib.c.math
      # LINE: 226
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (-9.0L, -3) = -0.00137174, std::pow (-9.0L, -3.0L) = -0.00137174
      # CLAUSE: lib.c.math
      # LINE: 240
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (-6.0, -9) = -9.9229e-08
      # CLAUSE: lib.c.math
      # LINE: 226
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (-6.0L, -9) = -9.9229e-08
      # CLAUSE: lib.c.math
      # LINE: 240
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (-6.0, -6) = 2.14335e-05
      # CLAUSE: lib.c.math
      # LINE: 226
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (-6.0L, -6) = 2.14335e-05
      # CLAUSE: lib.c.math
      # LINE: 240
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (-3.0, -9) = -5.08053e-05
      # CLAUSE: lib.c.math
      # LINE: 226
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (-3.0L, -9) = -5.08053e-05
      # CLAUSE: lib.c.math
      # LINE: 240
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (-3.0, -6) = 0.00137174, std::pow (-3.0, -6.0) = 0.00137174
      # CLAUSE: lib.c.math
      # LINE: 226
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (-3.0L, -6) = 0.00137174, std::pow (-3.0L, -6.0L) = 0.00137174
      # CLAUSE: lib.c.math
      # LINE: 240
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (3.0, -9) = 5.08053e-05
      # CLAUSE: lib.c.math
      # LINE: 226
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (3.0L, -9) = 5.08053e-05
      # CLAUSE: lib.c.math
      # LINE: 240
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (3.0, -6) = 0.00137174, std::pow (3.0, -6.0) = 0.00137174
      # CLAUSE: lib.c.math
      # LINE: 226
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (3.0L, -6) = 0.00137174, std::pow (3.0L, -6.0L) = 0.00137174
      # CLAUSE: lib.c.math
      # LINE: 240
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (6.0, -9) = 9.9229e-08
      # CLAUSE: lib.c.math
      # LINE: 226
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (6.0L, -9) = 9.9229e-08
      # CLAUSE: lib.c.math
      # LINE: 240
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (6.0, -6) = 2.14335e-05
      # CLAUSE: lib.c.math
      # LINE: 226
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (6.0L, -6) = 2.14335e-05
      # CLAUSE: lib.c.math
      # LINE: 240
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (9.0, -8) = 2.32306e-08
      # CLAUSE: lib.c.math
      # LINE: 226
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (9.0L, -8) = 2.32306e-08
      # CLAUSE: lib.c.math
      # LINE: 240
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (9.0, -3) = 0.00137174, std::pow (9.0, -3.0) = 0.00137174
      # CLAUSE: lib.c.math
      # LINE: 226
      
      # ASSERTION (S7) (4 lines):
      # TEXT: std::pow (9.0L, -3) = 0.00137174, std::pow (9.0L, -3.0L) = 0.00137174
      # CLAUSE: lib.c.math
      # LINE: 240
      

      The printed resulting values are the same, but actually they differs in one/two least significant digits.

      Since the problem in MSVC CRT, I suppose that the only way to get rid of these asserts is convert them to rw_warn() when _RWSTD_STRICT_ANSI is not #defined.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              farid Farid Zaripov
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified