https://bugs.kde.org/show_bug.cgi?id=484426
Bug ID: 484426
Summary: aarch64: 0.5 gets rounded to 0
Classification: Developer tools
Product: valgrind
Version: 3.16.1
Platform: Debian stable
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
SUMMARY
Running the following program with 0.5 as the argument outputs 1 when run
without valgrind and 0 when run with valgrind
#include <iostream>
#include <cmath>
int main(int argc, char** argv)
{
float value = std::stof(argv[1]);
std::cout << std::round(value) << "\n";
}
I compiled the program with the following command: g++ ./main.cpp -o
rounding_test
I also tried different optimization levels, but didn't find them to make a
difference.
OBSERVED RESULT
When run under valgrind the program rounds 0.5 down to 0 instead of rounding up
to 1. Also -0.5 seems to round to -0 instead of -1.
EXPECTED RESULT
Rounding 0.5 should match the normal behavior and round up to 1
SOFTWARE/OS VERSIONS
Debian GNU/Linux 11 (bullseye) aarch64
Raspberry Pi 4 Model B Rev 1.4
--
You are receiving this mail because:
You are watching all bug changes.