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)! I adjusted it to add your new test to the existing tests in t/primitive-misc.t rather than adding a new file. I've also changed it so that the brackets are added only for the complex case. Notes to all: * if you do add a new file, you need to add it to MANIFEST as well. That was why the PR failed the release tests, which check that everything is either in MANIFEST or is skipped in MANIFEST.SKIP. You can run those yourself locally with RELEASE_TESTING=1 prove -l xt * if you do make a PR, please check it does in fact pass the CI, which due to the above this didn't. * when making a PR, please make a new local branch rather than using your master branch - as it is, you'll need to `git reset --hard HEAD^^` to erase your commits before doing a `git pull --rebase` to get my updated ones Above all those points though, please do make PRs! It's hugely valuable and makes PDL better for everyone. It's only that bearing the above points in mind will make my life a bit easier :-) I've merged the adjusted PR, and it will be in the next PDL. That shouldn't be too much longer, as I've nearly finished separating out the externally-dependent modules as discussed elsewhere. Best regards, Ed ________________________________ From: Luis Mochan <moc...@icf.unam.mx> Sent: 08 December 2024 8:03 PM To: Ed . <ej...@hotmail.com> Cc: pdl-devel <pdl-devel@lists.sourceforge.net>; perldl <pdl-gene...@lists.sourceforge.net> Subject: approx fails for complex types 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_REAL(...) in Primitive.pd, but I guess the macro would have to be checked and I don't know if it might have produced other errors elsewhere. Best regards, Luis -- o W. Luis Mochán, | tel:(52)(777)329-1734 /<(*) Instituto de Ciencias Físicas, UNAM | fax:(52)(777)317-5388 `>/ /\ Av. Universidad s/n CP 62210 | (*)/\/ \ Cuernavaca, Morelos, México | moc...@fis.unam.mx /\_/\__/ GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16 C2DF 5F0A C52B 791E B9EB
_______________________________________________ pdl-devel mailing list pdl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pdl-devel