
(FPCore (x y) :precision binary64 (+ x (* (- 1.0 x) (- 1.0 y))))
double code(double x, double y) {
return x + ((1.0 - x) * (1.0 - y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x + ((1.0d0 - x) * (1.0d0 - y))
end function
public static double code(double x, double y) {
return x + ((1.0 - x) * (1.0 - y));
}
def code(x, y): return x + ((1.0 - x) * (1.0 - y))
function code(x, y) return Float64(x + Float64(Float64(1.0 - x) * Float64(1.0 - y))) end
function tmp = code(x, y) tmp = x + ((1.0 - x) * (1.0 - y)); end
code[x_, y_] := N[(x + N[(N[(1.0 - x), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(1 - x\right) \cdot \left(1 - y\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ x (* (- 1.0 x) (- 1.0 y))))
double code(double x, double y) {
return x + ((1.0 - x) * (1.0 - y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x + ((1.0d0 - x) * (1.0d0 - y))
end function
public static double code(double x, double y) {
return x + ((1.0 - x) * (1.0 - y));
}
def code(x, y): return x + ((1.0 - x) * (1.0 - y))
function code(x, y) return Float64(x + Float64(Float64(1.0 - x) * Float64(1.0 - y))) end
function tmp = code(x, y) tmp = x + ((1.0 - x) * (1.0 - y)); end
code[x_, y_] := N[(x + N[(N[(1.0 - x), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(1 - x\right) \cdot \left(1 - y\right)
\end{array}
(FPCore (x y) :precision binary64 (- (+ 1.0 (* x y)) y))
double code(double x, double y) {
return (1.0 + (x * y)) - y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 + (x * y)) - y
end function
public static double code(double x, double y) {
return (1.0 + (x * y)) - y;
}
def code(x, y): return (1.0 + (x * y)) - y
function code(x, y) return Float64(Float64(1.0 + Float64(x * y)) - y) end
function tmp = code(x, y) tmp = (1.0 + (x * y)) - y; end
code[x_, y_] := N[(N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + x \cdot y\right) - y
\end{array}
Initial program 79.1%
+-commutative79.1%
remove-double-neg79.1%
unsub-neg79.1%
sub-neg79.1%
+-commutative79.1%
distribute-rgt-in79.1%
*-lft-identity79.1%
associate--l+89.8%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
distribute-lft-in100.0%
*-commutative100.0%
mul-1-neg100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
(FPCore (x y)
:precision binary64
(if (<= x -2.8e+19)
(* x y)
(if (<= x -2.5e-67)
1.0
(if (<= x -5.2e-113)
(- y)
(if (<= x -5.2e-164)
1.0
(if (<= x -8.6e-214)
(- y)
(if (<= x -3.2e-262) 1.0 (if (<= x 1.0) (- y) (* x y)))))))))
double code(double x, double y) {
double tmp;
if (x <= -2.8e+19) {
tmp = x * y;
} else if (x <= -2.5e-67) {
tmp = 1.0;
} else if (x <= -5.2e-113) {
tmp = -y;
} else if (x <= -5.2e-164) {
tmp = 1.0;
} else if (x <= -8.6e-214) {
tmp = -y;
} else if (x <= -3.2e-262) {
tmp = 1.0;
} else if (x <= 1.0) {
tmp = -y;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-2.8d+19)) then
tmp = x * y
else if (x <= (-2.5d-67)) then
tmp = 1.0d0
else if (x <= (-5.2d-113)) then
tmp = -y
else if (x <= (-5.2d-164)) then
tmp = 1.0d0
else if (x <= (-8.6d-214)) then
tmp = -y
else if (x <= (-3.2d-262)) then
tmp = 1.0d0
else if (x <= 1.0d0) then
tmp = -y
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -2.8e+19) {
tmp = x * y;
} else if (x <= -2.5e-67) {
tmp = 1.0;
} else if (x <= -5.2e-113) {
tmp = -y;
} else if (x <= -5.2e-164) {
tmp = 1.0;
} else if (x <= -8.6e-214) {
tmp = -y;
} else if (x <= -3.2e-262) {
tmp = 1.0;
} else if (x <= 1.0) {
tmp = -y;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -2.8e+19: tmp = x * y elif x <= -2.5e-67: tmp = 1.0 elif x <= -5.2e-113: tmp = -y elif x <= -5.2e-164: tmp = 1.0 elif x <= -8.6e-214: tmp = -y elif x <= -3.2e-262: tmp = 1.0 elif x <= 1.0: tmp = -y else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (x <= -2.8e+19) tmp = Float64(x * y); elseif (x <= -2.5e-67) tmp = 1.0; elseif (x <= -5.2e-113) tmp = Float64(-y); elseif (x <= -5.2e-164) tmp = 1.0; elseif (x <= -8.6e-214) tmp = Float64(-y); elseif (x <= -3.2e-262) tmp = 1.0; elseif (x <= 1.0) tmp = Float64(-y); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -2.8e+19) tmp = x * y; elseif (x <= -2.5e-67) tmp = 1.0; elseif (x <= -5.2e-113) tmp = -y; elseif (x <= -5.2e-164) tmp = 1.0; elseif (x <= -8.6e-214) tmp = -y; elseif (x <= -3.2e-262) tmp = 1.0; elseif (x <= 1.0) tmp = -y; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -2.8e+19], N[(x * y), $MachinePrecision], If[LessEqual[x, -2.5e-67], 1.0, If[LessEqual[x, -5.2e-113], (-y), If[LessEqual[x, -5.2e-164], 1.0, If[LessEqual[x, -8.6e-214], (-y), If[LessEqual[x, -3.2e-262], 1.0, If[LessEqual[x, 1.0], (-y), N[(x * y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+19}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-67}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-113}:\\
\;\;\;\;-y\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-164}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -8.6 \cdot 10^{-214}:\\
\;\;\;\;-y\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{-262}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if x < -2.8e19 or 1 < x Initial program 60.8%
+-commutative60.8%
remove-double-neg60.8%
unsub-neg60.8%
sub-neg60.8%
+-commutative60.8%
distribute-rgt-in60.8%
*-lft-identity60.8%
associate--l+81.3%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
distribute-lft-in100.0%
*-commutative100.0%
mul-1-neg100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in x around inf 79.2%
Taylor expanded in x around inf 77.9%
*-commutative77.9%
Simplified77.9%
if -2.8e19 < x < -2.4999999999999999e-67 or -5.1999999999999998e-113 < x < -5.2000000000000003e-164 or -8.5999999999999999e-214 < x < -3.2e-262Initial program 97.3%
+-commutative97.3%
remove-double-neg97.3%
unsub-neg97.3%
sub-neg97.3%
+-commutative97.3%
distribute-rgt-in97.4%
*-lft-identity97.4%
associate--l+97.4%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 68.6%
if -2.4999999999999999e-67 < x < -5.1999999999999998e-113 or -5.2000000000000003e-164 < x < -8.5999999999999999e-214 or -3.2e-262 < x < 1Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
unsub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-rgt-in100.0%
*-lft-identity100.0%
associate--l+100.0%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
distribute-lft-in100.0%
*-commutative100.0%
mul-1-neg100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in x around inf 64.6%
Taylor expanded in x around 0 64.2%
neg-mul-164.2%
Simplified64.2%
Final simplification72.0%
(FPCore (x y) :precision binary64 (if (or (<= (- 1.0 y) -5e+27) (not (<= (- 1.0 y) 1.0))) (- (* x y) y) (+ 1.0 (* x y))))
double code(double x, double y) {
double tmp;
if (((1.0 - y) <= -5e+27) || !((1.0 - y) <= 1.0)) {
tmp = (x * y) - y;
} else {
tmp = 1.0 + (x * y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (((1.0d0 - y) <= (-5d+27)) .or. (.not. ((1.0d0 - y) <= 1.0d0))) then
tmp = (x * y) - y
else
tmp = 1.0d0 + (x * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (((1.0 - y) <= -5e+27) || !((1.0 - y) <= 1.0)) {
tmp = (x * y) - y;
} else {
tmp = 1.0 + (x * y);
}
return tmp;
}
def code(x, y): tmp = 0 if ((1.0 - y) <= -5e+27) or not ((1.0 - y) <= 1.0): tmp = (x * y) - y else: tmp = 1.0 + (x * y) return tmp
function code(x, y) tmp = 0.0 if ((Float64(1.0 - y) <= -5e+27) || !(Float64(1.0 - y) <= 1.0)) tmp = Float64(Float64(x * y) - y); else tmp = Float64(1.0 + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((1.0 - y) <= -5e+27) || ~(((1.0 - y) <= 1.0))) tmp = (x * y) - y; else tmp = 1.0 + (x * y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[N[(1.0 - y), $MachinePrecision], -5e+27], N[Not[LessEqual[N[(1.0 - y), $MachinePrecision], 1.0]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] - y), $MachinePrecision], N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;1 - y \leq -5 \cdot 10^{+27} \lor \neg \left(1 - y \leq 1\right):\\
\;\;\;\;x \cdot y - y\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot y\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) y) < -4.99999999999999979e27 or 1 < (-.f64 #s(literal 1 binary64) y) Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
unsub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-rgt-in100.0%
*-lft-identity100.0%
associate--l+100.0%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
distribute-lft-in100.0%
*-commutative100.0%
mul-1-neg100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in x around inf 98.3%
if -4.99999999999999979e27 < (-.f64 #s(literal 1 binary64) y) < 1Initial program 55.0%
+-commutative55.0%
remove-double-neg55.0%
unsub-neg55.0%
sub-neg55.0%
+-commutative55.0%
distribute-rgt-in55.0%
*-lft-identity55.0%
associate--l+78.1%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 98.3%
*-commutative98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (x y) :precision binary64 (if (or (<= x -360000000000.0) (not (<= x 5.8e-36))) (+ 1.0 (* x y)) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((x <= -360000000000.0) || !(x <= 5.8e-36)) {
tmp = 1.0 + (x * y);
} else {
tmp = 1.0 - y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-360000000000.0d0)) .or. (.not. (x <= 5.8d-36))) then
tmp = 1.0d0 + (x * y)
else
tmp = 1.0d0 - y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -360000000000.0) || !(x <= 5.8e-36)) {
tmp = 1.0 + (x * y);
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -360000000000.0) or not (x <= 5.8e-36): tmp = 1.0 + (x * y) else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((x <= -360000000000.0) || !(x <= 5.8e-36)) tmp = Float64(1.0 + Float64(x * y)); else tmp = Float64(1.0 - y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -360000000000.0) || ~((x <= 5.8e-36))) tmp = 1.0 + (x * y); else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -360000000000.0], N[Not[LessEqual[x, 5.8e-36]], $MachinePrecision]], N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -360000000000 \lor \neg \left(x \leq 5.8 \cdot 10^{-36}\right):\\
\;\;\;\;1 + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if x < -3.6e11 or 5.80000000000000026e-36 < x Initial program 62.0%
+-commutative62.0%
remove-double-neg62.0%
unsub-neg62.0%
sub-neg62.0%
+-commutative62.0%
distribute-rgt-in62.1%
*-lft-identity62.1%
associate--l+81.5%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 95.9%
*-commutative95.9%
Simplified95.9%
if -3.6e11 < x < 5.80000000000000026e-36Initial program 100.0%
+-commutative100.0%
remove-double-neg100.0%
unsub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-rgt-in100.0%
*-lft-identity100.0%
associate--l+100.0%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 98.2%
neg-mul-198.2%
unsub-neg98.2%
Simplified98.2%
Final simplification96.9%
(FPCore (x y) :precision binary64 (if (or (<= x -1.3e+58) (not (<= x 1.9e+34))) (* x y) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((x <= -1.3e+58) || !(x <= 1.9e+34)) {
tmp = x * y;
} else {
tmp = 1.0 - y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-1.3d+58)) .or. (.not. (x <= 1.9d+34))) then
tmp = x * y
else
tmp = 1.0d0 - y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -1.3e+58) || !(x <= 1.9e+34)) {
tmp = x * y;
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.3e+58) or not (x <= 1.9e+34): tmp = x * y else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.3e+58) || !(x <= 1.9e+34)) tmp = Float64(x * y); else tmp = Float64(1.0 - y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.3e+58) || ~((x <= 1.9e+34))) tmp = x * y; else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.3e+58], N[Not[LessEqual[x, 1.9e+34]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{+58} \lor \neg \left(x \leq 1.9 \cdot 10^{+34}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if x < -1.29999999999999994e58 or 1.9000000000000001e34 < x Initial program 59.9%
+-commutative59.9%
remove-double-neg59.9%
unsub-neg59.9%
sub-neg59.9%
+-commutative59.9%
distribute-rgt-in59.9%
*-lft-identity59.9%
associate--l+82.2%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
distribute-lft-in100.0%
*-commutative100.0%
mul-1-neg100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in x around inf 82.2%
Taylor expanded in x around inf 82.2%
*-commutative82.2%
Simplified82.2%
if -1.29999999999999994e58 < x < 1.9000000000000001e34Initial program 95.7%
+-commutative95.7%
remove-double-neg95.7%
unsub-neg95.7%
sub-neg95.7%
+-commutative95.7%
distribute-rgt-in95.7%
*-lft-identity95.7%
associate--l+96.5%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 92.0%
neg-mul-192.0%
unsub-neg92.0%
Simplified92.0%
Final simplification87.4%
(FPCore (x y) :precision binary64 (if (or (<= y -4.4e+66) (not (<= y 1.45e-18))) (- y) 1.0))
double code(double x, double y) {
double tmp;
if ((y <= -4.4e+66) || !(y <= 1.45e-18)) {
tmp = -y;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-4.4d+66)) .or. (.not. (y <= 1.45d-18))) then
tmp = -y
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -4.4e+66) || !(y <= 1.45e-18)) {
tmp = -y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -4.4e+66) or not (y <= 1.45e-18): tmp = -y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -4.4e+66) || !(y <= 1.45e-18)) tmp = Float64(-y); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -4.4e+66) || ~((y <= 1.45e-18))) tmp = -y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -4.4e+66], N[Not[LessEqual[y, 1.45e-18]], $MachinePrecision]], (-y), 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+66} \lor \neg \left(y \leq 1.45 \cdot 10^{-18}\right):\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.3999999999999997e66 or 1.45e-18 < y Initial program 99.2%
+-commutative99.2%
remove-double-neg99.2%
unsub-neg99.2%
sub-neg99.2%
+-commutative99.2%
distribute-rgt-in99.2%
*-lft-identity99.2%
associate--l+99.9%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
distribute-lft-in100.0%
*-commutative100.0%
mul-1-neg100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in x around inf 99.1%
Taylor expanded in x around 0 45.0%
neg-mul-145.0%
Simplified45.0%
if -4.3999999999999997e66 < y < 1.45e-18Initial program 55.9%
+-commutative55.9%
remove-double-neg55.9%
unsub-neg55.9%
sub-neg55.9%
+-commutative55.9%
distribute-rgt-in55.9%
*-lft-identity55.9%
associate--l+78.2%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 70.1%
Final simplification56.6%
(FPCore (x y) :precision binary64 (+ 1.0 (* y (+ x -1.0))))
double code(double x, double y) {
return 1.0 + (y * (x + -1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 + (y * (x + (-1.0d0)))
end function
public static double code(double x, double y) {
return 1.0 + (y * (x + -1.0));
}
def code(x, y): return 1.0 + (y * (x + -1.0))
function code(x, y) return Float64(1.0 + Float64(y * Float64(x + -1.0))) end
function tmp = code(x, y) tmp = 1.0 + (y * (x + -1.0)); end
code[x_, y_] := N[(1.0 + N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + y \cdot \left(x + -1\right)
\end{array}
Initial program 79.1%
+-commutative79.1%
remove-double-neg79.1%
unsub-neg79.1%
sub-neg79.1%
+-commutative79.1%
distribute-rgt-in79.1%
*-lft-identity79.1%
associate--l+89.8%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 79.1%
+-commutative79.1%
remove-double-neg79.1%
unsub-neg79.1%
sub-neg79.1%
+-commutative79.1%
distribute-rgt-in79.1%
*-lft-identity79.1%
associate--l+89.8%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 34.2%
(FPCore (x y) :precision binary64 (- (* y x) (- y 1.0)))
double code(double x, double y) {
return (y * x) - (y - 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y * x) - (y - 1.0d0)
end function
public static double code(double x, double y) {
return (y * x) - (y - 1.0);
}
def code(x, y): return (y * x) - (y - 1.0)
function code(x, y) return Float64(Float64(y * x) - Float64(y - 1.0)) end
function tmp = code(x, y) tmp = (y * x) - (y - 1.0); end
code[x_, y_] := N[(N[(y * x), $MachinePrecision] - N[(y - 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot x - \left(y - 1\right)
\end{array}
herbie shell --seed 2024107
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.Vectors:renderPlotVectors from Chart-1.5.3"
:precision binary64
:alt
(- (* y x) (- y 1.0))
(+ x (* (- 1.0 x) (- 1.0 y))))