x - floor((x+3.14)/3.14)*3.14

Percentage Accurate: 31.0% → 54.3%
Time: 5.4s
Alternatives: 6
Speedup: 1.1×

Specification

?
\[-1.79 \cdot 10^{+308} \leq x \land x \leq 1.79 \cdot 10^{+308}\]
\[\begin{array}{l} \\ x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \end{array} \]
(FPCore (x) :precision binary64 (- x (* (floor (/ (+ x 3.14) 3.14)) 3.14)))
double code(double x) {
	return x - (floor(((x + 3.14) / 3.14)) * 3.14);
}
public static double code(double x) {
	return x - (Math.floor(((x + 3.14) / 3.14)) * 3.14);
}
def code(x):
	return x - (math.floor(((x + 3.14) / 3.14)) * 3.14)
function code(x)
	return Float64(x - Float64(floor(Float64(Float64(x + 3.14) / 3.14)) * 3.14))
end
function tmp = code(x)
	tmp = x - (floor(((x + 3.14) / 3.14)) * 3.14);
end
code[x_] := N[(x - N[(N[Floor[N[(N[(x + 3.14), $MachinePrecision] / 3.14), $MachinePrecision]], $MachinePrecision] * 3.14), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor  \cdot 3.14
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 31.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \end{array} \]
(FPCore (x) :precision binary64 (- x (* (floor (/ (+ x 3.14) 3.14)) 3.14)))
double code(double x) {
	return x - (floor(((x + 3.14) / 3.14)) * 3.14);
}
public static double code(double x) {
	return x - (Math.floor(((x + 3.14) / 3.14)) * 3.14);
}
def code(x):
	return x - (math.floor(((x + 3.14) / 3.14)) * 3.14)
function code(x)
	return Float64(x - Float64(floor(Float64(Float64(x + 3.14) / 3.14)) * 3.14))
end
function tmp = code(x)
	tmp = x - (floor(((x + 3.14) / 3.14)) * 3.14);
end
code[x_] := N[(x - N[(N[Floor[N[(N[(x + 3.14), $MachinePrecision] / 3.14), $MachinePrecision]], $MachinePrecision] * 3.14), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor  \cdot 3.14
\end{array}

Alternative 1: 54.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{-310}:\\ \;\;\;\;x - \left\lfloor \mathsf{fma}\left(x, x, -9.8596\right) \cdot \left({\left(x - 3.14\right)}^{-1} \cdot 0.3184713375796178\right)\right\rfloor \cdot 3.14\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x -2e-310)
   (-
    x
    (*
     (floor (* (fma x x -9.8596) (* (pow (- x 3.14) -1.0) 0.3184713375796178)))
     3.14))
   (fma
    (floor (/ (* (fma x x -9.8596) 0.3184713375796178) (- x 3.14)))
    -3.14
    x)))
double code(double x) {
	double tmp;
	if (x <= -2e-310) {
		tmp = x - (floor((fma(x, x, -9.8596) * (pow((x - 3.14), -1.0) * 0.3184713375796178))) * 3.14);
	} else {
		tmp = fma(floor(((fma(x, x, -9.8596) * 0.3184713375796178) / (x - 3.14))), -3.14, x);
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (x <= -2e-310)
		tmp = Float64(x - Float64(floor(Float64(fma(x, x, -9.8596) * Float64((Float64(x - 3.14) ^ -1.0) * 0.3184713375796178))) * 3.14));
	else
		tmp = fma(floor(Float64(Float64(fma(x, x, -9.8596) * 0.3184713375796178) / Float64(x - 3.14))), -3.14, x);
	end
	return tmp
end
code[x_] := If[LessEqual[x, -2e-310], N[(x - N[(N[Floor[N[(N[(x * x + -9.8596), $MachinePrecision] * N[(N[Power[N[(x - 3.14), $MachinePrecision], -1.0], $MachinePrecision] * 0.3184713375796178), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 3.14), $MachinePrecision]), $MachinePrecision], N[(N[Floor[N[(N[(N[(x * x + -9.8596), $MachinePrecision] * 0.3184713375796178), $MachinePrecision] / N[(x - 3.14), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -3.14 + x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-310}:\\
\;\;\;\;x - \left\lfloor \mathsf{fma}\left(x, x, -9.8596\right) \cdot \left({\left(x - 3.14\right)}^{-1} \cdot 0.3184713375796178\right)\right\rfloor  \cdot 3.14\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.999999999999994e-310

    1. Initial program 7.1%

      \[x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      2. div-invN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      3. lift-+.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      4. flip-+N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}}{x - \frac{7070651414971679}{2251799813685248}}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      5. div-invN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{x - \frac{7070651414971679}{2251799813685248}}\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      6. associate-*l*N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      7. lower-*.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      8. sub-negN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x + \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)\right)} \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      9. lower-fma.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\mathsf{fma}\left(x, x, \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)} \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      10. metadata-evalN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \mathsf{neg}\left(\color{blue}{\frac{49994111432041006387552372079041}{5070602400912917605986812821504}}\right)\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      11. metadata-evalN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \color{blue}{\frac{-49994111432041006387552372079041}{5070602400912917605986812821504}}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      12. lower-*.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \color{blue}{\left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      13. inv-powN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left(\color{blue}{{\left(x - \frac{7070651414971679}{2251799813685248}\right)}^{-1}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      14. lower-pow.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left(\color{blue}{{\left(x - \frac{7070651414971679}{2251799813685248}\right)}^{-1}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      15. lower--.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left({\color{blue}{\left(x - \frac{7070651414971679}{2251799813685248}\right)}}^{-1} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      16. metadata-eval56.3

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, -9.8596\right) \cdot \left({\left(x - 3.14\right)}^{-1} \cdot \color{blue}{0.3184713375796178}\right)\right\rfloor \cdot 3.14 \]
    4. Applied rewrites56.3%

      \[\leadsto x - \left\lfloor \color{blue}{\mathsf{fma}\left(x, x, -9.8596\right) \cdot \left({\left(x - 3.14\right)}^{-1} \cdot 0.3184713375796178\right)}\right\rfloor \cdot 3.14 \]

    if -1.999999999999994e-310 < x

    1. Initial program 47.4%

      \[x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      2. div-invN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      3. lift-+.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      4. flip-+N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}}{x - \frac{7070651414971679}{2251799813685248}}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      5. div-invN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{x - \frac{7070651414971679}{2251799813685248}}\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      6. associate-*l*N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      7. lower-*.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      8. sub-negN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x + \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)\right)} \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      9. lower-fma.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\mathsf{fma}\left(x, x, \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)} \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      10. metadata-evalN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \mathsf{neg}\left(\color{blue}{\frac{49994111432041006387552372079041}{5070602400912917605986812821504}}\right)\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      11. metadata-evalN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \color{blue}{\frac{-49994111432041006387552372079041}{5070602400912917605986812821504}}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      12. lower-*.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \color{blue}{\left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      13. inv-powN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left(\color{blue}{{\left(x - \frac{7070651414971679}{2251799813685248}\right)}^{-1}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      14. lower-pow.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left(\color{blue}{{\left(x - \frac{7070651414971679}{2251799813685248}\right)}^{-1}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      15. lower--.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left({\color{blue}{\left(x - \frac{7070651414971679}{2251799813685248}\right)}}^{-1} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      16. metadata-eval7.4

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, -9.8596\right) \cdot \left({\left(x - 3.14\right)}^{-1} \cdot \color{blue}{0.3184713375796178}\right)\right\rfloor \cdot 3.14 \]
    4. Applied rewrites7.4%

      \[\leadsto x - \left\lfloor \color{blue}{\mathsf{fma}\left(x, x, -9.8596\right) \cdot \left({\left(x - 3.14\right)}^{-1} \cdot 0.3184713375796178\right)}\right\rfloor \cdot 3.14 \]
    5. Taylor expanded in x around 0

      \[\leadsto \color{blue}{x - \frac{7070651414971679}{2251799813685248} \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor } \]
    6. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right)\right) \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor } \]
      2. metadata-evalN/A

        \[\leadsto x + \color{blue}{\frac{-7070651414971679}{2251799813685248}} \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-7070651414971679}{2251799813685248} \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor + x} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{-7070651414971679}{2251799813685248}} + x \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right)} \]
      6. lower-floor.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor }, \frac{-7070651414971679}{2251799813685248}, x\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{\frac{2251799813685248}{7070651414971679} \cdot \left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)}{x - \frac{7070651414971679}{2251799813685248}}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      8. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{\frac{2251799813685248}{7070651414971679} \cdot \left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)}{x - \frac{7070651414971679}{2251799813685248}}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \frac{2251799813685248}{7070651414971679}}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \frac{2251799813685248}{7070651414971679}}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\left({x}^{2} + \left(\mathsf{neg}\left(\frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)\right)\right)} \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\left(\color{blue}{x \cdot x} + \left(\mathsf{neg}\left(\frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)\right)\right) \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\left(x \cdot x + \color{blue}{\frac{-49994111432041006387552372079041}{5070602400912917605986812821504}}\right) \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      14. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right)} \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      15. lower--.f6448.3

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{\color{blue}{x - 3.14}}\right\rfloor , -3.14, x\right) \]
    7. Applied rewrites48.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 50.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{-77}:\\ \;\;\;\;\mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right)\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-310}:\\ \;\;\;\;x - \left\lfloor {\left(\frac{\frac{-9.8596 - \frac{\frac{97.21171216000002}{x} - 30.959144000000002}{x}}{x} + 3.14}{x}\right)}^{-1}\right\rfloor \cdot 3.14\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x -2.7e-77)
   (fma (floor (fma 0.3184713375796178 x 1.0)) -3.14 x)
   (if (<= x -2e-310)
     (-
      x
      (*
       (floor
        (pow
         (/
          (+
           (/
            (- -9.8596 (/ (- (/ 97.21171216000002 x) 30.959144000000002) x))
            x)
           3.14)
          x)
         -1.0))
       3.14))
     (fma
      (floor (/ (* (fma x x -9.8596) 0.3184713375796178) (- x 3.14)))
      -3.14
      x))))
double code(double x) {
	double tmp;
	if (x <= -2.7e-77) {
		tmp = fma(floor(fma(0.3184713375796178, x, 1.0)), -3.14, x);
	} else if (x <= -2e-310) {
		tmp = x - (floor(pow(((((-9.8596 - (((97.21171216000002 / x) - 30.959144000000002) / x)) / x) + 3.14) / x), -1.0)) * 3.14);
	} else {
		tmp = fma(floor(((fma(x, x, -9.8596) * 0.3184713375796178) / (x - 3.14))), -3.14, x);
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (x <= -2.7e-77)
		tmp = fma(floor(fma(0.3184713375796178, x, 1.0)), -3.14, x);
	elseif (x <= -2e-310)
		tmp = Float64(x - Float64(floor((Float64(Float64(Float64(Float64(-9.8596 - Float64(Float64(Float64(97.21171216000002 / x) - 30.959144000000002) / x)) / x) + 3.14) / x) ^ -1.0)) * 3.14));
	else
		tmp = fma(floor(Float64(Float64(fma(x, x, -9.8596) * 0.3184713375796178) / Float64(x - 3.14))), -3.14, x);
	end
	return tmp
end
code[x_] := If[LessEqual[x, -2.7e-77], N[(N[Floor[N[(0.3184713375796178 * x + 1.0), $MachinePrecision]], $MachinePrecision] * -3.14 + x), $MachinePrecision], If[LessEqual[x, -2e-310], N[(x - N[(N[Floor[N[Power[N[(N[(N[(N[(-9.8596 - N[(N[(N[(97.21171216000002 / x), $MachinePrecision] - 30.959144000000002), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + 3.14), $MachinePrecision] / x), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * 3.14), $MachinePrecision]), $MachinePrecision], N[(N[Floor[N[(N[(N[(x * x + -9.8596), $MachinePrecision] * 0.3184713375796178), $MachinePrecision] / N[(x - 3.14), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -3.14 + x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-77}:\\
\;\;\;\;\mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right)\\

\mathbf{elif}\;x \leq -2 \cdot 10^{-310}:\\
\;\;\;\;x - \left\lfloor {\left(\frac{\frac{-9.8596 - \frac{\frac{97.21171216000002}{x} - 30.959144000000002}{x}}{x} + 3.14}{x}\right)}^{-1}\right\rfloor  \cdot 3.14\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.7e-77

    1. Initial program 9.7%

      \[x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x - \left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}} \]
      2. sub-negN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}\right)\right) + x} \]
      4. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}}\right)\right) + x \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right)\right)} + x \]
      6. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right)} \]
      7. lift-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      8. clear-numN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{1}{\frac{\frac{7070651414971679}{2251799813685248}}{x + \frac{7070651414971679}{2251799813685248}}}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      9. associate-/r/N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot \left(x + \frac{7070651414971679}{2251799813685248}\right)}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      10. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right)}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot x + \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot \frac{7070651414971679}{2251799813685248}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot x + \color{blue}{\frac{2251799813685248}{7070651414971679}} \cdot \frac{7070651414971679}{2251799813685248}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot x + \color{blue}{1}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      14. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{7070651414971679}{2251799813685248}}, x, 1\right)}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(\color{blue}{\frac{2251799813685248}{7070651414971679}}, x, 1\right)\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      16. metadata-eval10.9

        \[\leadsto \mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , \color{blue}{-3.14}, x\right) \]
    4. Applied rewrites10.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right)} \]

    if -2.7e-77 < x < -1.999999999999994e-310

    1. Initial program 4.3%

      \[x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      2. div-invN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      3. lift-+.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      4. flip-+N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}}{x - \frac{7070651414971679}{2251799813685248}}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      5. associate-*l/N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}{x - \frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      6. clear-numN/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      7. lower-/.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      8. lower-/.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\color{blue}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      9. lower--.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\color{blue}{x - \frac{7070651414971679}{2251799813685248}}}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      10. lower-*.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\color{blue}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      11. sub-negN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\color{blue}{\left(x \cdot x + \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      12. lower-fma.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\color{blue}{\mathsf{fma}\left(x, x, \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      13. metadata-evalN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\mathsf{fma}\left(x, x, \mathsf{neg}\left(\color{blue}{\frac{49994111432041006387552372079041}{5070602400912917605986812821504}}\right)\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      14. metadata-evalN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\mathsf{fma}\left(x, x, \color{blue}{\frac{-49994111432041006387552372079041}{5070602400912917605986812821504}}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      15. metadata-eval4.3

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - 3.14}{\mathsf{fma}\left(x, x, -9.8596\right) \cdot \color{blue}{0.3184713375796178}}}\right\rfloor \cdot 3.14 \]
    4. Applied rewrites4.3%

      \[\leadsto x - \left\lfloor \color{blue}{\frac{1}{\frac{x - 3.14}{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}}}\right\rfloor \cdot 3.14 \]
    5. Taylor expanded in x around -inf

      \[\leadsto x - \left\lfloor \frac{1}{\color{blue}{-1 \cdot \frac{-1 \cdot \frac{-1 \cdot \frac{\frac{2499411177879333246441435816434822626729211414583438076751479681}{25711008708143844408671393477458601640355247900524685364822016} \cdot \frac{1}{x} - \frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992}}{x} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x} - \frac{7070651414971679}{2251799813685248}}{x}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
    6. Applied rewrites100.0%

      \[\leadsto x - \left\lfloor \frac{1}{\color{blue}{\frac{\frac{-9.8596 - \frac{\frac{97.21171216000002}{x} - 30.959144000000002}{x}}{x} + 3.14}{x}}}\right\rfloor \cdot 3.14 \]

    if -1.999999999999994e-310 < x

    1. Initial program 47.4%

      \[x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      2. div-invN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      3. lift-+.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      4. flip-+N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}}{x - \frac{7070651414971679}{2251799813685248}}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      5. div-invN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{x - \frac{7070651414971679}{2251799813685248}}\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      6. associate-*l*N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      7. lower-*.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      8. sub-negN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x + \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)\right)} \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      9. lower-fma.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\mathsf{fma}\left(x, x, \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)} \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      10. metadata-evalN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \mathsf{neg}\left(\color{blue}{\frac{49994111432041006387552372079041}{5070602400912917605986812821504}}\right)\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      11. metadata-evalN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \color{blue}{\frac{-49994111432041006387552372079041}{5070602400912917605986812821504}}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      12. lower-*.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \color{blue}{\left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      13. inv-powN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left(\color{blue}{{\left(x - \frac{7070651414971679}{2251799813685248}\right)}^{-1}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      14. lower-pow.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left(\color{blue}{{\left(x - \frac{7070651414971679}{2251799813685248}\right)}^{-1}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      15. lower--.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left({\color{blue}{\left(x - \frac{7070651414971679}{2251799813685248}\right)}}^{-1} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      16. metadata-eval7.4

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, -9.8596\right) \cdot \left({\left(x - 3.14\right)}^{-1} \cdot \color{blue}{0.3184713375796178}\right)\right\rfloor \cdot 3.14 \]
    4. Applied rewrites7.4%

      \[\leadsto x - \left\lfloor \color{blue}{\mathsf{fma}\left(x, x, -9.8596\right) \cdot \left({\left(x - 3.14\right)}^{-1} \cdot 0.3184713375796178\right)}\right\rfloor \cdot 3.14 \]
    5. Taylor expanded in x around 0

      \[\leadsto \color{blue}{x - \frac{7070651414971679}{2251799813685248} \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor } \]
    6. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right)\right) \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor } \]
      2. metadata-evalN/A

        \[\leadsto x + \color{blue}{\frac{-7070651414971679}{2251799813685248}} \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-7070651414971679}{2251799813685248} \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor + x} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{-7070651414971679}{2251799813685248}} + x \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right)} \]
      6. lower-floor.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor }, \frac{-7070651414971679}{2251799813685248}, x\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{\frac{2251799813685248}{7070651414971679} \cdot \left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)}{x - \frac{7070651414971679}{2251799813685248}}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      8. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{\frac{2251799813685248}{7070651414971679} \cdot \left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)}{x - \frac{7070651414971679}{2251799813685248}}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \frac{2251799813685248}{7070651414971679}}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \frac{2251799813685248}{7070651414971679}}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\left({x}^{2} + \left(\mathsf{neg}\left(\frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)\right)\right)} \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\left(\color{blue}{x \cdot x} + \left(\mathsf{neg}\left(\frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)\right)\right) \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\left(x \cdot x + \color{blue}{\frac{-49994111432041006387552372079041}{5070602400912917605986812821504}}\right) \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      14. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right)} \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      15. lower--.f6448.3

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{\color{blue}{x - 3.14}}\right\rfloor , -3.14, x\right) \]
    7. Applied rewrites48.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification50.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{-77}:\\ \;\;\;\;\mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right)\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-310}:\\ \;\;\;\;x - \left\lfloor {\left(\frac{\frac{-9.8596 - \frac{\frac{97.21171216000002}{x} - 30.959144000000002}{x}}{x} + 3.14}{x}\right)}^{-1}\right\rfloor \cdot 3.14\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 48.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{-103}:\\ \;\;\;\;\mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right)\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-310}:\\ \;\;\;\;x - \left\lfloor {\left(\frac{\frac{\frac{30.959144000000002}{x} - 9.8596}{x} + 3.14}{x}\right)}^{-1}\right\rfloor \cdot 3.14\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x -5.5e-103)
   (fma (floor (fma 0.3184713375796178 x 1.0)) -3.14 x)
   (if (<= x -2e-310)
     (-
      x
      (*
       (floor
        (pow (/ (+ (/ (- (/ 30.959144000000002 x) 9.8596) x) 3.14) x) -1.0))
       3.14))
     (fma
      (floor (/ (* (fma x x -9.8596) 0.3184713375796178) (- x 3.14)))
      -3.14
      x))))
double code(double x) {
	double tmp;
	if (x <= -5.5e-103) {
		tmp = fma(floor(fma(0.3184713375796178, x, 1.0)), -3.14, x);
	} else if (x <= -2e-310) {
		tmp = x - (floor(pow((((((30.959144000000002 / x) - 9.8596) / x) + 3.14) / x), -1.0)) * 3.14);
	} else {
		tmp = fma(floor(((fma(x, x, -9.8596) * 0.3184713375796178) / (x - 3.14))), -3.14, x);
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (x <= -5.5e-103)
		tmp = fma(floor(fma(0.3184713375796178, x, 1.0)), -3.14, x);
	elseif (x <= -2e-310)
		tmp = Float64(x - Float64(floor((Float64(Float64(Float64(Float64(Float64(30.959144000000002 / x) - 9.8596) / x) + 3.14) / x) ^ -1.0)) * 3.14));
	else
		tmp = fma(floor(Float64(Float64(fma(x, x, -9.8596) * 0.3184713375796178) / Float64(x - 3.14))), -3.14, x);
	end
	return tmp
end
code[x_] := If[LessEqual[x, -5.5e-103], N[(N[Floor[N[(0.3184713375796178 * x + 1.0), $MachinePrecision]], $MachinePrecision] * -3.14 + x), $MachinePrecision], If[LessEqual[x, -2e-310], N[(x - N[(N[Floor[N[Power[N[(N[(N[(N[(N[(30.959144000000002 / x), $MachinePrecision] - 9.8596), $MachinePrecision] / x), $MachinePrecision] + 3.14), $MachinePrecision] / x), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * 3.14), $MachinePrecision]), $MachinePrecision], N[(N[Floor[N[(N[(N[(x * x + -9.8596), $MachinePrecision] * 0.3184713375796178), $MachinePrecision] / N[(x - 3.14), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -3.14 + x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-103}:\\
\;\;\;\;\mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right)\\

\mathbf{elif}\;x \leq -2 \cdot 10^{-310}:\\
\;\;\;\;x - \left\lfloor {\left(\frac{\frac{\frac{30.959144000000002}{x} - 9.8596}{x} + 3.14}{x}\right)}^{-1}\right\rfloor  \cdot 3.14\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -5.50000000000000032e-103

    1. Initial program 9.4%

      \[x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x - \left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}} \]
      2. sub-negN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}\right)\right) + x} \]
      4. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}}\right)\right) + x \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right)\right)} + x \]
      6. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right)} \]
      7. lift-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      8. clear-numN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{1}{\frac{\frac{7070651414971679}{2251799813685248}}{x + \frac{7070651414971679}{2251799813685248}}}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      9. associate-/r/N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot \left(x + \frac{7070651414971679}{2251799813685248}\right)}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      10. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right)}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot x + \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot \frac{7070651414971679}{2251799813685248}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot x + \color{blue}{\frac{2251799813685248}{7070651414971679}} \cdot \frac{7070651414971679}{2251799813685248}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot x + \color{blue}{1}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      14. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{7070651414971679}{2251799813685248}}, x, 1\right)}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(\color{blue}{\frac{2251799813685248}{7070651414971679}}, x, 1\right)\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      16. metadata-eval10.5

        \[\leadsto \mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , \color{blue}{-3.14}, x\right) \]
    4. Applied rewrites10.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right)} \]

    if -5.50000000000000032e-103 < x < -1.999999999999994e-310

    1. Initial program 4.1%

      \[x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      2. div-invN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      3. lift-+.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      4. flip-+N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}}{x - \frac{7070651414971679}{2251799813685248}}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      5. associate-*l/N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}{x - \frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      6. clear-numN/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      7. lower-/.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      8. lower-/.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\color{blue}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      9. lower--.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\color{blue}{x - \frac{7070651414971679}{2251799813685248}}}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      10. lower-*.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\color{blue}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      11. sub-negN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\color{blue}{\left(x \cdot x + \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      12. lower-fma.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\color{blue}{\mathsf{fma}\left(x, x, \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      13. metadata-evalN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\mathsf{fma}\left(x, x, \mathsf{neg}\left(\color{blue}{\frac{49994111432041006387552372079041}{5070602400912917605986812821504}}\right)\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      14. metadata-evalN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\mathsf{fma}\left(x, x, \color{blue}{\frac{-49994111432041006387552372079041}{5070602400912917605986812821504}}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      15. metadata-eval4.1

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - 3.14}{\mathsf{fma}\left(x, x, -9.8596\right) \cdot \color{blue}{0.3184713375796178}}}\right\rfloor \cdot 3.14 \]
    4. Applied rewrites4.1%

      \[\leadsto x - \left\lfloor \color{blue}{\frac{1}{\frac{x - 3.14}{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}}}\right\rfloor \cdot 3.14 \]
    5. Taylor expanded in x around inf

      \[\leadsto x - \left\lfloor \frac{1}{\color{blue}{\frac{\left(\frac{7070651414971679}{2251799813685248} + \frac{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992}}{{x}^{2}}\right) - \frac{49994111432041006387552372079041}{5070602400912917605986812821504} \cdot \frac{1}{x}}{x}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\color{blue}{\frac{\left(\frac{7070651414971679}{2251799813685248} + \frac{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992}}{{x}^{2}}\right) - \frac{49994111432041006387552372079041}{5070602400912917605986812821504} \cdot \frac{1}{x}}{x}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      2. associate--l+N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\color{blue}{\frac{7070651414971679}{2251799813685248} + \left(\frac{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992}}{{x}^{2}} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504} \cdot \frac{1}{x}\right)}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      3. +-commutativeN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\color{blue}{\left(\frac{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992}}{{x}^{2}} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504} \cdot \frac{1}{x}\right) + \frac{7070651414971679}{2251799813685248}}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      4. unpow2N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\left(\frac{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992}}{\color{blue}{x \cdot x}} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504} \cdot \frac{1}{x}\right) + \frac{7070651414971679}{2251799813685248}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      5. associate-/r*N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\left(\color{blue}{\frac{\frac{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992}}{x}}{x}} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504} \cdot \frac{1}{x}\right) + \frac{7070651414971679}{2251799813685248}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      6. metadata-evalN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\left(\frac{\frac{\color{blue}{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992} \cdot 1}}{x}}{x} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504} \cdot \frac{1}{x}\right) + \frac{7070651414971679}{2251799813685248}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      7. associate-*r/N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\left(\frac{\color{blue}{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992} \cdot \frac{1}{x}}}{x} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504} \cdot \frac{1}{x}\right) + \frac{7070651414971679}{2251799813685248}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      8. associate-*r/N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\left(\frac{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992} \cdot \frac{1}{x}}{x} - \color{blue}{\frac{\frac{49994111432041006387552372079041}{5070602400912917605986812821504} \cdot 1}{x}}\right) + \frac{7070651414971679}{2251799813685248}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      9. metadata-evalN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\left(\frac{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992} \cdot \frac{1}{x}}{x} - \frac{\color{blue}{\frac{49994111432041006387552372079041}{5070602400912917605986812821504}}}{x}\right) + \frac{7070651414971679}{2251799813685248}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      10. div-subN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\color{blue}{\frac{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992} \cdot \frac{1}{x} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x}} + \frac{7070651414971679}{2251799813685248}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      11. lower-+.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\color{blue}{\frac{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992} \cdot \frac{1}{x} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x} + \frac{7070651414971679}{2251799813685248}}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      12. lower-/.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\color{blue}{\frac{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992} \cdot \frac{1}{x} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x}} + \frac{7070651414971679}{2251799813685248}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      13. lower--.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\frac{\color{blue}{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992} \cdot \frac{1}{x} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}}{x} + \frac{7070651414971679}{2251799813685248}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      14. associate-*r/N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\frac{\color{blue}{\frac{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992} \cdot 1}{x}} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x} + \frac{7070651414971679}{2251799813685248}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      15. metadata-evalN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\frac{\frac{\color{blue}{\frac{353490934737212534922304384685375867763364479839}{11417981541647679048466287755595961091061972992}}}{x} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x} + \frac{7070651414971679}{2251799813685248}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      16. lower-/.f64100.0

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\frac{\color{blue}{\frac{30.959144000000002}{x}} - 9.8596}{x} + 3.14}{x}}\right\rfloor \cdot 3.14 \]
    7. Applied rewrites100.0%

      \[\leadsto x - \left\lfloor \frac{1}{\color{blue}{\frac{\frac{\frac{30.959144000000002}{x} - 9.8596}{x} + 3.14}{x}}}\right\rfloor \cdot 3.14 \]

    if -1.999999999999994e-310 < x

    1. Initial program 47.4%

      \[x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      2. div-invN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      3. lift-+.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      4. flip-+N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}}{x - \frac{7070651414971679}{2251799813685248}}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      5. div-invN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{x - \frac{7070651414971679}{2251799813685248}}\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      6. associate-*l*N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      7. lower-*.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      8. sub-negN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x + \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)\right)} \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      9. lower-fma.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\mathsf{fma}\left(x, x, \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)} \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      10. metadata-evalN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \mathsf{neg}\left(\color{blue}{\frac{49994111432041006387552372079041}{5070602400912917605986812821504}}\right)\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      11. metadata-evalN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \color{blue}{\frac{-49994111432041006387552372079041}{5070602400912917605986812821504}}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      12. lower-*.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \color{blue}{\left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      13. inv-powN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left(\color{blue}{{\left(x - \frac{7070651414971679}{2251799813685248}\right)}^{-1}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      14. lower-pow.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left(\color{blue}{{\left(x - \frac{7070651414971679}{2251799813685248}\right)}^{-1}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      15. lower--.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left({\color{blue}{\left(x - \frac{7070651414971679}{2251799813685248}\right)}}^{-1} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      16. metadata-eval7.4

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, -9.8596\right) \cdot \left({\left(x - 3.14\right)}^{-1} \cdot \color{blue}{0.3184713375796178}\right)\right\rfloor \cdot 3.14 \]
    4. Applied rewrites7.4%

      \[\leadsto x - \left\lfloor \color{blue}{\mathsf{fma}\left(x, x, -9.8596\right) \cdot \left({\left(x - 3.14\right)}^{-1} \cdot 0.3184713375796178\right)}\right\rfloor \cdot 3.14 \]
    5. Taylor expanded in x around 0

      \[\leadsto \color{blue}{x - \frac{7070651414971679}{2251799813685248} \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor } \]
    6. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right)\right) \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor } \]
      2. metadata-evalN/A

        \[\leadsto x + \color{blue}{\frac{-7070651414971679}{2251799813685248}} \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-7070651414971679}{2251799813685248} \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor + x} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{-7070651414971679}{2251799813685248}} + x \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right)} \]
      6. lower-floor.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor }, \frac{-7070651414971679}{2251799813685248}, x\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{\frac{2251799813685248}{7070651414971679} \cdot \left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)}{x - \frac{7070651414971679}{2251799813685248}}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      8. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{\frac{2251799813685248}{7070651414971679} \cdot \left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)}{x - \frac{7070651414971679}{2251799813685248}}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \frac{2251799813685248}{7070651414971679}}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \frac{2251799813685248}{7070651414971679}}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\left({x}^{2} + \left(\mathsf{neg}\left(\frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)\right)\right)} \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\left(\color{blue}{x \cdot x} + \left(\mathsf{neg}\left(\frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)\right)\right) \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\left(x \cdot x + \color{blue}{\frac{-49994111432041006387552372079041}{5070602400912917605986812821504}}\right) \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      14. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right)} \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      15. lower--.f6448.3

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{\color{blue}{x - 3.14}}\right\rfloor , -3.14, x\right) \]
    7. Applied rewrites48.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification48.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{-103}:\\ \;\;\;\;\mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right)\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-310}:\\ \;\;\;\;x - \left\lfloor {\left(\frac{\frac{\frac{30.959144000000002}{x} - 9.8596}{x} + 3.14}{x}\right)}^{-1}\right\rfloor \cdot 3.14\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 44.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{-154}:\\ \;\;\;\;\mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right)\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-310}:\\ \;\;\;\;x - \left\lfloor {\left(\frac{3.14 - \frac{9.8596}{x}}{x}\right)}^{-1}\right\rfloor \cdot 3.14\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x -2.4e-154)
   (fma (floor (fma 0.3184713375796178 x 1.0)) -3.14 x)
   (if (<= x -2e-310)
     (- x (* (floor (pow (/ (- 3.14 (/ 9.8596 x)) x) -1.0)) 3.14))
     (fma
      (floor (/ (* (fma x x -9.8596) 0.3184713375796178) (- x 3.14)))
      -3.14
      x))))
double code(double x) {
	double tmp;
	if (x <= -2.4e-154) {
		tmp = fma(floor(fma(0.3184713375796178, x, 1.0)), -3.14, x);
	} else if (x <= -2e-310) {
		tmp = x - (floor(pow(((3.14 - (9.8596 / x)) / x), -1.0)) * 3.14);
	} else {
		tmp = fma(floor(((fma(x, x, -9.8596) * 0.3184713375796178) / (x - 3.14))), -3.14, x);
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (x <= -2.4e-154)
		tmp = fma(floor(fma(0.3184713375796178, x, 1.0)), -3.14, x);
	elseif (x <= -2e-310)
		tmp = Float64(x - Float64(floor((Float64(Float64(3.14 - Float64(9.8596 / x)) / x) ^ -1.0)) * 3.14));
	else
		tmp = fma(floor(Float64(Float64(fma(x, x, -9.8596) * 0.3184713375796178) / Float64(x - 3.14))), -3.14, x);
	end
	return tmp
end
code[x_] := If[LessEqual[x, -2.4e-154], N[(N[Floor[N[(0.3184713375796178 * x + 1.0), $MachinePrecision]], $MachinePrecision] * -3.14 + x), $MachinePrecision], If[LessEqual[x, -2e-310], N[(x - N[(N[Floor[N[Power[N[(N[(3.14 - N[(9.8596 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * 3.14), $MachinePrecision]), $MachinePrecision], N[(N[Floor[N[(N[(N[(x * x + -9.8596), $MachinePrecision] * 0.3184713375796178), $MachinePrecision] / N[(x - 3.14), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -3.14 + x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{-154}:\\
\;\;\;\;\mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right)\\

\mathbf{elif}\;x \leq -2 \cdot 10^{-310}:\\
\;\;\;\;x - \left\lfloor {\left(\frac{3.14 - \frac{9.8596}{x}}{x}\right)}^{-1}\right\rfloor  \cdot 3.14\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.39999999999999987e-154

    1. Initial program 8.8%

      \[x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x - \left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}} \]
      2. sub-negN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}\right)\right) + x} \]
      4. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}}\right)\right) + x \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right)\right)} + x \]
      6. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right)} \]
      7. lift-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      8. clear-numN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{1}{\frac{\frac{7070651414971679}{2251799813685248}}{x + \frac{7070651414971679}{2251799813685248}}}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      9. associate-/r/N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot \left(x + \frac{7070651414971679}{2251799813685248}\right)}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      10. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right)}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      11. distribute-lft-inN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot x + \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot \frac{7070651414971679}{2251799813685248}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot x + \color{blue}{\frac{2251799813685248}{7070651414971679}} \cdot \frac{7070651414971679}{2251799813685248}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot x + \color{blue}{1}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      14. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{7070651414971679}{2251799813685248}}, x, 1\right)}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(\color{blue}{\frac{2251799813685248}{7070651414971679}}, x, 1\right)\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
      16. metadata-eval9.8

        \[\leadsto \mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , \color{blue}{-3.14}, x\right) \]
    4. Applied rewrites9.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right)} \]

    if -2.39999999999999987e-154 < x < -1.999999999999994e-310

    1. Initial program 3.9%

      \[x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      2. div-invN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      3. lift-+.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      4. flip-+N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}}{x - \frac{7070651414971679}{2251799813685248}}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      5. associate-*l/N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}{x - \frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      6. clear-numN/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      7. lower-/.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      8. lower-/.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\color{blue}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      9. lower--.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\color{blue}{x - \frac{7070651414971679}{2251799813685248}}}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      10. lower-*.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\color{blue}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      11. sub-negN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\color{blue}{\left(x \cdot x + \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      12. lower-fma.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\color{blue}{\mathsf{fma}\left(x, x, \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      13. metadata-evalN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\mathsf{fma}\left(x, x, \mathsf{neg}\left(\color{blue}{\frac{49994111432041006387552372079041}{5070602400912917605986812821504}}\right)\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      14. metadata-evalN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - \frac{7070651414971679}{2251799813685248}}{\mathsf{fma}\left(x, x, \color{blue}{\frac{-49994111432041006387552372079041}{5070602400912917605986812821504}}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      15. metadata-eval3.9

        \[\leadsto x - \left\lfloor \frac{1}{\frac{x - 3.14}{\mathsf{fma}\left(x, x, -9.8596\right) \cdot \color{blue}{0.3184713375796178}}}\right\rfloor \cdot 3.14 \]
    4. Applied rewrites3.9%

      \[\leadsto x - \left\lfloor \color{blue}{\frac{1}{\frac{x - 3.14}{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}}}\right\rfloor \cdot 3.14 \]
    5. Taylor expanded in x around inf

      \[\leadsto x - \left\lfloor \frac{1}{\color{blue}{\frac{\frac{7070651414971679}{2251799813685248} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504} \cdot \frac{1}{x}}{x}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\color{blue}{\frac{\frac{7070651414971679}{2251799813685248} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504} \cdot \frac{1}{x}}{x}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      2. lower--.f64N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\color{blue}{\frac{7070651414971679}{2251799813685248} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504} \cdot \frac{1}{x}}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      3. associate-*r/N/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\frac{7070651414971679}{2251799813685248} - \color{blue}{\frac{\frac{49994111432041006387552372079041}{5070602400912917605986812821504} \cdot 1}{x}}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      4. metadata-evalN/A

        \[\leadsto x - \left\lfloor \frac{1}{\frac{\frac{7070651414971679}{2251799813685248} - \frac{\color{blue}{\frac{49994111432041006387552372079041}{5070602400912917605986812821504}}}{x}}{x}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      5. lower-/.f64100.0

        \[\leadsto x - \left\lfloor \frac{1}{\frac{3.14 - \color{blue}{\frac{9.8596}{x}}}{x}}\right\rfloor \cdot 3.14 \]
    7. Applied rewrites100.0%

      \[\leadsto x - \left\lfloor \frac{1}{\color{blue}{\frac{3.14 - \frac{9.8596}{x}}{x}}}\right\rfloor \cdot 3.14 \]

    if -1.999999999999994e-310 < x

    1. Initial program 47.4%

      \[x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      2. div-invN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      3. lift-+.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      4. flip-+N/A

        \[\leadsto x - \left\lfloor \color{blue}{\frac{x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}}{x - \frac{7070651414971679}{2251799813685248}}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      5. div-invN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \frac{1}{x - \frac{7070651414971679}{2251799813685248}}\right)} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      6. associate-*l*N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      7. lower-*.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x - \frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      8. sub-negN/A

        \[\leadsto x - \left\lfloor \color{blue}{\left(x \cdot x + \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)\right)} \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      9. lower-fma.f64N/A

        \[\leadsto x - \left\lfloor \color{blue}{\mathsf{fma}\left(x, x, \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248} \cdot \frac{7070651414971679}{2251799813685248}\right)\right)} \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      10. metadata-evalN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \mathsf{neg}\left(\color{blue}{\frac{49994111432041006387552372079041}{5070602400912917605986812821504}}\right)\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      11. metadata-evalN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \color{blue}{\frac{-49994111432041006387552372079041}{5070602400912917605986812821504}}\right) \cdot \left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      12. lower-*.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \color{blue}{\left(\frac{1}{x - \frac{7070651414971679}{2251799813685248}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      13. inv-powN/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left(\color{blue}{{\left(x - \frac{7070651414971679}{2251799813685248}\right)}^{-1}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      14. lower-pow.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left(\color{blue}{{\left(x - \frac{7070651414971679}{2251799813685248}\right)}^{-1}} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      15. lower--.f64N/A

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \left({\color{blue}{\left(x - \frac{7070651414971679}{2251799813685248}\right)}}^{-1} \cdot \frac{1}{\frac{7070651414971679}{2251799813685248}}\right)\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
      16. metadata-eval7.4

        \[\leadsto x - \left\lfloor \mathsf{fma}\left(x, x, -9.8596\right) \cdot \left({\left(x - 3.14\right)}^{-1} \cdot \color{blue}{0.3184713375796178}\right)\right\rfloor \cdot 3.14 \]
    4. Applied rewrites7.4%

      \[\leadsto x - \left\lfloor \color{blue}{\mathsf{fma}\left(x, x, -9.8596\right) \cdot \left({\left(x - 3.14\right)}^{-1} \cdot 0.3184713375796178\right)}\right\rfloor \cdot 3.14 \]
    5. Taylor expanded in x around 0

      \[\leadsto \color{blue}{x - \frac{7070651414971679}{2251799813685248} \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor } \]
    6. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right)\right) \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor } \]
      2. metadata-evalN/A

        \[\leadsto x + \color{blue}{\frac{-7070651414971679}{2251799813685248}} \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-7070651414971679}{2251799813685248} \cdot \left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor + x} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{-7070651414971679}{2251799813685248}} + x \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right)} \]
      6. lower-floor.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left\lfloor \frac{2251799813685248}{7070651414971679} \cdot \frac{{x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor }, \frac{-7070651414971679}{2251799813685248}, x\right) \]
      7. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{\frac{2251799813685248}{7070651414971679} \cdot \left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)}{x - \frac{7070651414971679}{2251799813685248}}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      8. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{\frac{2251799813685248}{7070651414971679} \cdot \left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)}{x - \frac{7070651414971679}{2251799813685248}}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \frac{2251799813685248}{7070651414971679}}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\left({x}^{2} - \frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right) \cdot \frac{2251799813685248}{7070651414971679}}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\left({x}^{2} + \left(\mathsf{neg}\left(\frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)\right)\right)} \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\left(\color{blue}{x \cdot x} + \left(\mathsf{neg}\left(\frac{49994111432041006387552372079041}{5070602400912917605986812821504}\right)\right)\right) \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\left(x \cdot x + \color{blue}{\frac{-49994111432041006387552372079041}{5070602400912917605986812821504}}\right) \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      14. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\color{blue}{\mathsf{fma}\left(x, x, \frac{-49994111432041006387552372079041}{5070602400912917605986812821504}\right)} \cdot \frac{2251799813685248}{7070651414971679}}{x - \frac{7070651414971679}{2251799813685248}}\right\rfloor , \frac{-7070651414971679}{2251799813685248}, x\right) \]
      15. lower--.f6448.3

        \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{\color{blue}{x - 3.14}}\right\rfloor , -3.14, x\right) \]
    7. Applied rewrites48.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification44.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{-154}:\\ \;\;\;\;\mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right)\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-310}:\\ \;\;\;\;x - \left\lfloor {\left(\frac{3.14 - \frac{9.8596}{x}}{x}\right)}^{-1}\right\rfloor \cdot 3.14\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left\lfloor \frac{\mathsf{fma}\left(x, x, -9.8596\right) \cdot 0.3184713375796178}{x - 3.14}\right\rfloor , -3.14, x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 32.1% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right) \end{array} \]
(FPCore (x)
 :precision binary64
 (fma (floor (fma 0.3184713375796178 x 1.0)) -3.14 x))
double code(double x) {
	return fma(floor(fma(0.3184713375796178, x, 1.0)), -3.14, x);
}
function code(x)
	return fma(floor(fma(0.3184713375796178, x, 1.0)), -3.14, x)
end
code[x_] := N[(N[Floor[N[(0.3184713375796178 * x + 1.0), $MachinePrecision]], $MachinePrecision] * -3.14 + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right)
\end{array}
Derivation
  1. Initial program 27.4%

    \[x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{x - \left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}} \]
    2. sub-negN/A

      \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}\right)\right)} \]
    3. +-commutativeN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}\right)\right) + x} \]
    4. lift-*.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}}\right)\right) + x \]
    5. distribute-rgt-neg-inN/A

      \[\leadsto \color{blue}{\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor \cdot \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right)\right)} + x \]
    6. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right)} \]
    7. lift-/.f64N/A

      \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{x + \frac{7070651414971679}{2251799813685248}}{\frac{7070651414971679}{2251799813685248}}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
    8. clear-numN/A

      \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{1}{\frac{\frac{7070651414971679}{2251799813685248}}{x + \frac{7070651414971679}{2251799813685248}}}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
    9. associate-/r/N/A

      \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot \left(x + \frac{7070651414971679}{2251799813685248}\right)}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
    10. lift-+.f64N/A

      \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot \color{blue}{\left(x + \frac{7070651414971679}{2251799813685248}\right)}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
    11. distribute-lft-inN/A

      \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot x + \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot \frac{7070651414971679}{2251799813685248}}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot x + \color{blue}{\frac{2251799813685248}{7070651414971679}} \cdot \frac{7070651414971679}{2251799813685248}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(\left\lfloor \frac{1}{\frac{7070651414971679}{2251799813685248}} \cdot x + \color{blue}{1}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
    14. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(\left\lfloor \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{7070651414971679}{2251799813685248}}, x, 1\right)}\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(\color{blue}{\frac{2251799813685248}{7070651414971679}}, x, 1\right)\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right) \]
    16. metadata-eval28.1

      \[\leadsto \mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , \color{blue}{-3.14}, x\right) \]
  4. Applied rewrites28.1%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor \mathsf{fma}\left(0.3184713375796178, x, 1\right)\right\rfloor , -3.14, x\right)} \]
  5. Add Preprocessing

Alternative 6: 28.4% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\left\lfloor 1\right\rfloor , -3.14, x\right) \end{array} \]
(FPCore (x) :precision binary64 (fma (floor 1.0) -3.14 x))
double code(double x) {
	return fma(floor(1.0), -3.14, x);
}
function code(x)
	return fma(floor(1.0), -3.14, x)
end
code[x_] := N[(N[Floor[1.0], $MachinePrecision] * -3.14 + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\left\lfloor 1\right\rfloor , -3.14, x\right)
\end{array}
Derivation
  1. Initial program 27.4%

    \[x - \left\lfloor \frac{x + 3.14}{3.14}\right\rfloor \cdot 3.14 \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto x - \left\lfloor \color{blue}{1}\right\rfloor \cdot \frac{7070651414971679}{2251799813685248} \]
  4. Step-by-step derivation
    1. Applied rewrites25.0%

      \[\leadsto x - \left\lfloor \color{blue}{1}\right\rfloor \cdot 3.14 \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x - \left\lfloor 1\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}} \]
      2. sub-negN/A

        \[\leadsto \color{blue}{x + \left(\mathsf{neg}\left(\left\lfloor 1\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left\lfloor 1\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}\right)\right) + x} \]
      4. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left\lfloor 1\right\rfloor \cdot \frac{7070651414971679}{2251799813685248}}\right)\right) + x \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{\left\lfloor 1\right\rfloor \cdot \left(\mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right)\right)} + x \]
      6. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor 1\right\rfloor , \mathsf{neg}\left(\frac{7070651414971679}{2251799813685248}\right), x\right)} \]
      7. metadata-eval25.0

        \[\leadsto \mathsf{fma}\left(\left\lfloor 1\right\rfloor , \color{blue}{-3.14}, x\right) \]
    3. Applied rewrites25.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left\lfloor 1\right\rfloor , -3.14, x\right)} \]
    4. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 1 
    (FPCore (x)
      :name "x - floor((x+3.14)/3.14)*3.14"
      :precision binary64
      :pre (and (<= -1.79e+308 x) (<= x 1.79e+308))
      (- x (* (floor (/ (+ x 3.14) 3.14)) 3.14)))