[Pdl-devel] [moc...@fis.unam.mx: Re: approx fails for complex types]

2024-12-08 Thread Luis Mochán
- Forwarded message from Luis Mochán - Date: Sun, 08 Dec 2024 20:17:06 -0600 From: Luis Mochán To: "Ed ." Subject: Re: approx fails for complex types User-Agent: K-9 Mail for Android Hi Ed, I realized that afterwards, it is a common risk of macro expansions. I was in some hurry and did

Re: [Pdl-devel] approx fails for complex types

2024-12-08 Thread Ed .
Hi Luis, There's nothing wrong with the expansion of the macro, but there was something wrong with the code I wrote, which was for real types: value = a * b*b; /* correct */ but for complex values: value = a * b*b+c*c; /* wrong, I meant a * (b*b+c*c) */ Thank you for the pull request (#507)!

[Pdl-devel] approx fails for complex types

2024-12-08 Thread Luis Mochan
Hi All, I found a mysterious error when comparing complex types. For instance, pdl> p approx(i,5*i) 1 pdl> p approx(5*i,i) 0 i.e., i is close to 5i (wrong) but 5i is not close to i (correct). I found a (provisional?) fix, by simply using parenthesis around PDL_IF_GENTYPE_RE