Skip to content

Atanh returning values slightly outside the specified error bound #570

Description

@MattyMuir

Describe the bug
The Sleef_atanhd1_u10purec function is returning values with an error of slightly more than 1ULP for arguments around 10^-17.

I've also experienced similar issues with other atanh functions, such as Sleef_atanhd4_u10avx2. This may affect others also.

Command lines and logs
I built SLEEF using

cmake -G Ninja -D CMAKE_C_COMPILER="C:/Program Files/LLVM/bin/clang.exe" -D SLEEF_BUILD_GNUABI_LIBS=OFF -D SLEEF_BUILD_TESTS=OFF -B ./build
cd build
cmake --build .

Configure log: CMakeConfigureLog.txt
Build log: cmake_build_log.txt

To Reproduce
Here's a minimal reproducer

#include <iostream>

#include <sleef-config.h>
#include <sleef.h>

int main()
{
    double x = 8.0e-17;
    double y = Sleef_atanhd1_u10purec(x);
    if (y < x)
        std::cout << "Error!\n";
}

The CMake used to build this example is

cmake_minimum_required(VERSION 3.13)
project(sleefAtanhMinimal)
add_executable(sleefAtanhMinimal main.cpp)

target_link_libraries(sleefAtanhMinimal PUBLIC "C:/Users/matty/Desktop/sleef/build/lib/sleef.lib")
target_include_directories(sleefAtanhMinimal PUBLIC "C:/Users/matty/Desktop/sleef/build/include")

(I just hardcoded the paths to SLEEF for simplicity)
And I built using the commands

cmake -G Ninja -D CMAKE_C_COMPILER="C:/Program Files/LLVM/bin/clang.exe" -D CMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang.exe" -B ./build
cd build
cmake --build .

Expected behavior
I expected that "Error!" would not be printed to the console. Since atanh(x) > x for all positive x, by returning a value strictly less than x, it's produced a result more than 1ULP away from the exact value.

Environment

  • Building natively
  • Architecture: x86_64
  • OS: Windows 10 Home version 22H2 build 19045.4780
  • CMake Version: 3.26.3
  • Makefile Generator: Ninja
  • Compiler: Clang version 18.1.6, target x86_64-pc-windows-msvc

I'm more than happy to provide any other information you need.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions