Skip to content

std::remainder(x,y) and std::remquo(x, y, z) are not optimized at the compilation time when (x, y) is constant #99497

@k-arrows

Description

@k-arrows

Consider the following example.
https://godbolt.org/z/94qo7q4vd

#include <cmath>

double f1() 
{
  return std::fmod(-5.0, 3.0);
}

double f2() 
{
  return std::remainder(-5.0, 3.0);
}

double f3()
{
  int quo;
  return std::remquo(-5.0, 3.0, &quo);
}

The above f2() is optimized when -ffast-math is enabled.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions