https://bugs.kde.org/show_bug.cgi?id=491667

            Bug ID: 491667
           Summary: std::fmin(val, NaN) should returns NaN on arm.
    Classification: Developer tools
           Product: valgrind
           Version: unspecified
          Platform: Other
                OS: Other
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: memcheck
          Assignee: jsew...@acm.org
          Reporter: meirav.grimb...@redis.com
  Target Milestone: ---

SUMMARY

fmin(NaN,-1) returns NaN on linux arm.
According to fmin documentation:
https://en.cppreference.com/w/cpp/numeric/math/fmin
Error handling
This function is not subject to any of the error conditions specified in
math_errhandling.

If the implementation supports IEEE floating-point arithmetic (IEC 60559),

* If one of the two arguments is NaN, the value of the other argument is
returned.
* Only if both arguments are NaN, NaN is returned.

STEPS TO REPRODUCE
program test.cpp

``
#include <cmath>
#include <iostream>

int main()
{
    std::cout << "fmin(NaN,-1) = " << std::fmin(NAN, -1) << '\n';
}

``
 g++ test.cpp


OBSERVED RESULT

valgrind ./a.out 
==9822== Memcheck, a memory error detector
==9822== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==9822== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==9822== Command: ./a.out
==9822== 
fmin(NaN,-1) = nan

EXPECTED RESULT

./a.out 
fmin(NaN,-1) = -1

SOFTWARE/OS VERSIONS
Was tested on dockers.
arch: armV8
1. linux jammy. valgrind version 18.1
2. linux apline. valgrind version 23

ADDITIONAL INFORMATION

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to