?

Average Accuracy: 100.0% → 100.0%
Time: 7.0s
Precision: binary64
Cost: 576

?

\[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
\[\left(0.918938533204673 + y \cdot \left(x + -0.5\right)\right) - x \]
(FPCore (x y)
 :precision binary64
 (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))
(FPCore (x y) :precision binary64 (- (+ 0.918938533204673 (* y (+ x -0.5))) x))
double code(double x, double y) {
	return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
double code(double x, double y) {
	return (0.918938533204673 + (y * (x + -0.5))) - x;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((x * (y - 1.0d0)) - (y * 0.5d0)) + 0.918938533204673d0
end function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (0.918938533204673d0 + (y * (x + (-0.5d0)))) - x
end function
public static double code(double x, double y) {
	return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
}
public static double code(double x, double y) {
	return (0.918938533204673 + (y * (x + -0.5))) - x;
}
def code(x, y):
	return ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673
def code(x, y):
	return (0.918938533204673 + (y * (x + -0.5))) - x
function code(x, y)
	return Float64(Float64(Float64(x * Float64(y - 1.0)) - Float64(y * 0.5)) + 0.918938533204673)
end
function code(x, y)
	return Float64(Float64(0.918938533204673 + Float64(y * Float64(x + -0.5))) - x)
end
function tmp = code(x, y)
	tmp = ((x * (y - 1.0)) - (y * 0.5)) + 0.918938533204673;
end
function tmp = code(x, y)
	tmp = (0.918938533204673 + (y * (x + -0.5))) - x;
end
code[x_, y_] := N[(N[(N[(x * N[(y - 1.0), $MachinePrecision]), $MachinePrecision] - N[(y * 0.5), $MachinePrecision]), $MachinePrecision] + 0.918938533204673), $MachinePrecision]
code[x_, y_] := N[(N[(0.918938533204673 + N[(y * N[(x + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]
\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673
\left(0.918938533204673 + y \cdot \left(x + -0.5\right)\right) - x

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 100.0%

    \[\left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]
  2. Simplified100.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, x + -0.5, 0.918938533204673 - x\right)} \]
    Proof

    [Start]100.0

    \[ \left(x \cdot \left(y - 1\right) - y \cdot 0.5\right) + 0.918938533204673 \]

    sub-neg [=>]100.0

    \[ \color{blue}{\left(x \cdot \left(y - 1\right) + \left(-y \cdot 0.5\right)\right)} + 0.918938533204673 \]

    +-commutative [=>]100.0

    \[ \color{blue}{\left(\left(-y \cdot 0.5\right) + x \cdot \left(y - 1\right)\right)} + 0.918938533204673 \]

    sub-neg [=>]100.0

    \[ \left(\left(-y \cdot 0.5\right) + x \cdot \color{blue}{\left(y + \left(-1\right)\right)}\right) + 0.918938533204673 \]

    distribute-lft-in [=>]100.0

    \[ \left(\left(-y \cdot 0.5\right) + \color{blue}{\left(x \cdot y + x \cdot \left(-1\right)\right)}\right) + 0.918938533204673 \]

    *-commutative [<=]100.0

    \[ \left(\left(-y \cdot 0.5\right) + \left(\color{blue}{y \cdot x} + x \cdot \left(-1\right)\right)\right) + 0.918938533204673 \]

    associate-+r+ [=>]100.0

    \[ \color{blue}{\left(\left(\left(-y \cdot 0.5\right) + y \cdot x\right) + x \cdot \left(-1\right)\right)} + 0.918938533204673 \]

    associate-+l+ [=>]100.0

    \[ \color{blue}{\left(\left(-y \cdot 0.5\right) + y \cdot x\right) + \left(x \cdot \left(-1\right) + 0.918938533204673\right)} \]

    distribute-rgt-neg-in [=>]100.0

    \[ \left(\color{blue}{y \cdot \left(-0.5\right)} + y \cdot x\right) + \left(x \cdot \left(-1\right) + 0.918938533204673\right) \]

    distribute-lft-out [=>]100.0

    \[ \color{blue}{y \cdot \left(\left(-0.5\right) + x\right)} + \left(x \cdot \left(-1\right) + 0.918938533204673\right) \]

    fma-def [=>]100.0

    \[ \color{blue}{\mathsf{fma}\left(y, \left(-0.5\right) + x, x \cdot \left(-1\right) + 0.918938533204673\right)} \]

    +-commutative [=>]100.0

    \[ \mathsf{fma}\left(y, \color{blue}{x + \left(-0.5\right)}, x \cdot \left(-1\right) + 0.918938533204673\right) \]

    metadata-eval [=>]100.0

    \[ \mathsf{fma}\left(y, x + \color{blue}{-0.5}, x \cdot \left(-1\right) + 0.918938533204673\right) \]

    +-commutative [<=]100.0

    \[ \mathsf{fma}\left(y, x + -0.5, \color{blue}{0.918938533204673 + x \cdot \left(-1\right)}\right) \]

    *-commutative [=>]100.0

    \[ \mathsf{fma}\left(y, x + -0.5, 0.918938533204673 + \color{blue}{\left(-1\right) \cdot x}\right) \]

    metadata-eval [=>]100.0

    \[ \mathsf{fma}\left(y, x + -0.5, 0.918938533204673 + \color{blue}{-1} \cdot x\right) \]

    mul-1-neg [=>]100.0

    \[ \mathsf{fma}\left(y, x + -0.5, 0.918938533204673 + \color{blue}{\left(-x\right)}\right) \]

    unsub-neg [=>]100.0

    \[ \mathsf{fma}\left(y, x + -0.5, \color{blue}{0.918938533204673 - x}\right) \]
  3. Taylor expanded in y around 0 100.0%

    \[\leadsto \color{blue}{\left(0.918938533204673 + y \cdot \left(x - 0.5\right)\right) - x} \]
  4. Final simplification100.0%

    \[\leadsto \left(0.918938533204673 + y \cdot \left(x + -0.5\right)\right) - x \]

Alternatives

Alternative 1
Accuracy55.6%
Cost1116
\[\begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+143}:\\ \;\;\;\;-x\\ \mathbf{elif}\;x \leq -9.2 \cdot 10^{+72}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;x \leq -2.85 \cdot 10^{+19}:\\ \;\;\;\;-x\\ \mathbf{elif}\;x \leq -0.0031:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;x \leq 7.8 \cdot 10^{-294}:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{-178}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;x \leq 0.5:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]
Alternative 2
Accuracy98.5%
Cost840
\[\begin{array}{l} \mathbf{if}\;x \leq -1800000000000:\\ \;\;\;\;y \cdot x - x\\ \mathbf{elif}\;x \leq 45000000000:\\ \;\;\;\;0.918938533204673 + \left(y \cdot x + y \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y + -1\right)\\ \end{array} \]
Alternative 3
Accuracy56.4%
Cost720
\[\begin{array}{l} \mathbf{if}\;y \leq -0.4:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq -1.6 \cdot 10^{-51}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq -3.2 \cdot 10^{-183}:\\ \;\;\;\;0.918938533204673\\ \mathbf{elif}\;y \leq 1.5:\\ \;\;\;\;-x\\ \mathbf{else}:\\ \;\;\;\;y \cdot -0.5\\ \end{array} \]
Alternative 4
Accuracy97.7%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -1.55 \lor \neg \left(y \leq 1.45\right):\\ \;\;\;\;y \cdot \left(x + -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673 - x\\ \end{array} \]
Alternative 5
Accuracy97.7%
Cost585
\[\begin{array}{l} \mathbf{if}\;x \leq -0.7 \lor \neg \left(x \leq 0.62\right):\\ \;\;\;\;x \cdot \left(y + -1\right)\\ \mathbf{else}:\\ \;\;\;\;0.918938533204673 + y \cdot -0.5\\ \end{array} \]
Alternative 6
Accuracy97.7%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -0.75:\\ \;\;\;\;y \cdot x - x\\ \mathbf{elif}\;x \leq 0.74:\\ \;\;\;\;0.918938533204673 + y \cdot -0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y + -1\right)\\ \end{array} \]
Alternative 7
Accuracy83.9%
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -30:\\ \;\;\;\;y \cdot -0.5\\ \mathbf{elif}\;y \leq 1.8:\\ \;\;\;\;0.918938533204673 - x\\ \mathbf{else}:\\ \;\;\;\;y \cdot -0.5\\ \end{array} \]
Alternative 8
Accuracy56.4%
Cost392
\[\begin{array}{l} \mathbf{if}\;x \leq -1020:\\ \;\;\;\;-x\\ \mathbf{elif}\;x \leq 0.92:\\ \;\;\;\;0.918938533204673\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]
Alternative 9
Accuracy29.8%
Cost64
\[0.918938533204673 \]

Error

Reproduce?

herbie shell --seed 2023140 
(FPCore (x y)
  :name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, A"
  :precision binary64
  (+ (- (* x (- y 1.0)) (* y 0.5)) 0.918938533204673))