[all-commits] [llvm/llvm-project] ffe04e: [libc][complex] implement different flavors of `cr...

Shourya Goel via All-commits all-commits at lists.llvm.org
Sat Nov 2 21:08:32 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ffe04e0351203524b212f850b48edf54dc5dbeb5
      https://github.com/llvm/llvm-project/commit/ffe04e0351203524b212f850b48edf54dc5dbeb5
  Author: Shourya Goel <shouryagoel10000 at gmail.com>
  Date:   2024-11-03 (Sun, 03 Nov 2024)

  Changed paths:
    M libc/config/linux/aarch64/entrypoints.txt
    M libc/config/linux/arm/entrypoints.txt
    M libc/config/linux/riscv/entrypoints.txt
    M libc/config/linux/x86_64/entrypoints.txt
    M libc/docs/complex.rst
    M libc/src/CMakeLists.txt
    M libc/src/__support/CMakeLists.txt
    A libc/src/__support/complex_type.h
    A libc/src/complex/CMakeLists.txt
    A libc/src/complex/cimag.h
    A libc/src/complex/cimagf.h
    A libc/src/complex/cimagf128.h
    A libc/src/complex/cimagf16.h
    A libc/src/complex/cimagl.h
    A libc/src/complex/creal.h
    A libc/src/complex/crealf.h
    A libc/src/complex/crealf128.h
    A libc/src/complex/crealf16.h
    A libc/src/complex/creall.h
    A libc/src/complex/generic/CMakeLists.txt
    A libc/src/complex/generic/cimag.cpp
    A libc/src/complex/generic/cimagf.cpp
    A libc/src/complex/generic/cimagf128.cpp
    A libc/src/complex/generic/cimagf16.cpp
    A libc/src/complex/generic/cimagl.cpp
    A libc/src/complex/generic/creal.cpp
    A libc/src/complex/generic/crealf.cpp
    A libc/src/complex/generic/crealf128.cpp
    A libc/src/complex/generic/crealf16.cpp
    A libc/src/complex/generic/creall.cpp
    M libc/test/src/CMakeLists.txt
    A libc/test/src/complex/CImagTest.h
    A libc/test/src/complex/CMakeLists.txt
    A libc/test/src/complex/CRealTest.h
    A libc/test/src/complex/cimag_test.cpp
    A libc/test/src/complex/cimagf128_test.cpp
    A libc/test/src/complex/cimagf16_test.cpp
    A libc/test/src/complex/cimagf_test.cpp
    A libc/test/src/complex/cimagl_test.cpp
    A libc/test/src/complex/creal_test.cpp
    A libc/test/src/complex/crealf128_test.cpp
    A libc/test/src/complex/crealf16_test.cpp
    A libc/test/src/complex/crealf_test.cpp
    A libc/test/src/complex/creall_test.cpp

  Log Message:
  -----------
  [libc][complex] implement different flavors of `creal` and `cimag` functions (#113300)

I have commented out the test for `neg_zero`(creal) because : 

1. real(neg_zero + 0.0i) equals zero. 
2. real(neg_zero - 0.0i) equals neg_zero.

I am not sure if this is the intended behaviour. 

[EDIT]
I have updated tests for `neg_zero` (creal) to be : 

```
    EXPECT_FP_EQ(func(CFPT(neg_zero - zero * 1.0i)), neg_zero);
    EXPECT_FP_EQ(func(CFPT(neg_zero + zero * 1.0i)), zero);
```

because all three [gcc, clang and GNU MPC] also give the same result. 
https://godbolt.org/z/hxhcn6aof
and it seems that it is indeed the correct behaviour since Imaginary
types are not supported yet, refer #113671



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list