History log of /llvm-project/libc/src/complex/cimag.h (Results 1 – 1 of 1)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4
# ffe04e03 03-Nov-2024 Shourya Goel <shouryagoel10000@gmail.com>

[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. re

[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

show more ...