llvm/llvm-project

basic properties of floor and ceiling function

Open

#76 438 ouverte le 27 déc. 2023

Voir sur GitHub
 (12 commentaires) (0 réactions) (1 assigné)C++ (10 782 forks)batch import
floating-pointgood first issuellvm:optimizationsmissed-optimization

Métriques du dépôt

Stars
 (26 378 stars)
Métriques de merge PR
 (Merge moyen 1j 2h) (1 000 PRs mergées en 30 j)

Description

There are other formulas that hold, but I'll list the basic ones. https://alive2.llvm.org/ce/z/dQgZ84

If I understand correctly, these transformations require nnan flag.

Original functions:

#include <cmath>

bool src1(float x)
{
  return std::floor(x) <= x;
}

bool src2(float x)
{
  return x <= std::ceil(x);
}

bool src3(float x)
{
  return std::ceil(x) == -std::floor(-x);
}

bool src4(float x)
{
  return std::floor(x) == -std::ceil(-x);
}

Guide contributeur