• Bruce Dawson's avatar
    Workaround VS/UCRT fmod bug · 4bd1215c
    Bruce Dawson authored
    Recent versions of the Windows Universal CRT changed the behavior of
    fmod for when the first parameter is negative. In particular, a result
    of negative zero became positive zero. This is rarely critical but it
    causes test failures and may effect some JS test suites or web pages.
    
    The fix is to modify Modulo to check for a result of 0 when the first
    parameter is negative and change the result to -0. That fixes four of
    the five test failures and the fifth one is fixed by comparing the
    results against Modulo instead of std::fmod.
    
    Bug: chromium:915045
    Change-Id: Ia4490ec98361a37006d6c338acd33f959fa3ccea
    Reviewed-on: https://chromium-review.googlesource.com/c/1383091
    Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
    Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#58377}
    4bd1215c
utils.h 36.6 KB