[flang] [llvm] [flang] Optimize `acospi` precision (PR #152869)

Connector Switch via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 11 07:49:08 PDT 2025


c8ef wrote:

> > > Please could you add a test for f128 like in your issue.
> > 
> > 
> > I can do this, but I'm concerned it might break the AIX build bot. It seems they use a different fp format. We may need to add separate fp numbers based on the target triple to address this? (Or simply omit the f128 test...
> 
> Try `! REQUIRES: flang-supports-f128-math` in the lit test. For example see `test/Lower/Intrinsics/acos_complex16.f90`.

I'm actually referring to the following case:

```c++
#include "llvm/ADT/APFloat.h"
#include "llvm/Support/raw_ostream.h"

int main() {
  llvm::APFloat pi(llvm::APFloat::IEEEquad(),
                   "0.318309886183790671537767526745028724");
  pi.print(llvm::errs());
  llvm::APFloat pi_ppc(llvm::APFloat::PPCDoubleDouble(),
                       "0.318309886183790671537767526745028724");
  pi_ppc.print(llvm::errs());
}
// 0.318309886183790671537767526745028737
// 0.31830988618379067153776752674503
```

They have different rounding, so an exact match is difficult. I chose to match the common prefix instead. It should work on all build bots now.

https://github.com/llvm/llvm-project/pull/152869


More information about the llvm-commits mailing list