
(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 78.4%
+-commutative78.4%
remove-double-neg78.4%
unsub-neg78.4%
sub-neg78.4%
+-commutative78.4%
distribute-rgt-in78.4%
*-lft-identity78.4%
associate--l+90.6%
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 -1.72e+80) (* x y) (if (<= x 2.9e-75) 1.0 (if (<= x 1.0) (- y) (* x y)))))
double code(double x, double y) {
double tmp;
if (x <= -1.72e+80) {
tmp = x * y;
} else if (x <= 2.9e-75) {
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 <= (-1.72d+80)) then
tmp = x * y
else if (x <= 2.9d-75) 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 <= -1.72e+80) {
tmp = x * y;
} else if (x <= 2.9e-75) {
tmp = 1.0;
} else if (x <= 1.0) {
tmp = -y;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.72e+80: tmp = x * y elif x <= 2.9e-75: tmp = 1.0 elif x <= 1.0: tmp = -y else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (x <= -1.72e+80) tmp = Float64(x * y); elseif (x <= 2.9e-75) 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 <= -1.72e+80) tmp = x * y; elseif (x <= 2.9e-75) tmp = 1.0; elseif (x <= 1.0) tmp = -y; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.72e+80], N[(x * y), $MachinePrecision], If[LessEqual[x, 2.9e-75], 1.0, If[LessEqual[x, 1.0], (-y), N[(x * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.72 \cdot 10^{+80}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-75}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if x < -1.7200000000000001e80 or 1 < x Initial program 55.6%
+-commutative55.6%
remove-double-neg55.6%
unsub-neg55.6%
sub-neg55.6%
+-commutative55.6%
distribute-rgt-in55.6%
*-lft-identity55.6%
associate--l+84.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%
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 84.1%
*-commutative84.1%
Simplified84.1%
if -1.7200000000000001e80 < x < 2.9000000000000002e-75Initial program 94.8%
+-commutative94.8%
remove-double-neg94.8%
unsub-neg94.8%
sub-neg94.8%
+-commutative94.8%
distribute-rgt-in94.8%
*-lft-identity94.8%
associate--l+94.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%
Taylor expanded in y around 0 58.2%
if 2.9000000000000002e-75 < 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 y around inf 69.9%
Taylor expanded in x around 0 64.3%
mul-1-neg64.3%
Simplified64.3%
Final simplification69.6%
(FPCore (x y) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (+ 1.0 (* x y)) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
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 <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) 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 <= -1.0) || !(x <= 1.0)) {
tmp = 1.0 + (x * y);
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = 1.0 + (x * y) else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) 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 <= -1.0) || ~((x <= 1.0))) tmp = 1.0 + (x * y); else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;1 + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 55.5%
+-commutative55.5%
remove-double-neg55.5%
unsub-neg55.5%
sub-neg55.5%
+-commutative55.5%
distribute-rgt-in55.5%
*-lft-identity55.5%
associate--l+80.6%
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 99.1%
*-commutative99.1%
Simplified99.1%
if -1 < 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%
Taylor expanded in x around 0 98.7%
neg-mul-198.7%
unsub-neg98.7%
Simplified98.7%
Final simplification98.9%
(FPCore (x y) :precision binary64 (if (<= x -1.8e+80) (* x y) (if (<= x 1.5e-11) (- 1.0 y) (* y (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -1.8e+80) {
tmp = x * y;
} else if (x <= 1.5e-11) {
tmp = 1.0 - y;
} else {
tmp = y * (x + -1.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.8d+80)) then
tmp = x * y
else if (x <= 1.5d-11) then
tmp = 1.0d0 - y
else
tmp = y * (x + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.8e+80) {
tmp = x * y;
} else if (x <= 1.5e-11) {
tmp = 1.0 - y;
} else {
tmp = y * (x + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.8e+80: tmp = x * y elif x <= 1.5e-11: tmp = 1.0 - y else: tmp = y * (x + -1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.8e+80) tmp = Float64(x * y); elseif (x <= 1.5e-11) tmp = Float64(1.0 - y); else tmp = Float64(y * Float64(x + -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.8e+80) tmp = x * y; elseif (x <= 1.5e-11) tmp = 1.0 - y; else tmp = y * (x + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.8e+80], N[(x * y), $MachinePrecision], If[LessEqual[x, 1.5e-11], N[(1.0 - y), $MachinePrecision], N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+80}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-11}:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if x < -1.79999999999999997e80Initial program 52.3%
+-commutative52.3%
remove-double-neg52.3%
unsub-neg52.3%
sub-neg52.3%
+-commutative52.3%
distribute-rgt-in52.3%
*-lft-identity52.3%
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%
Taylor expanded in x around inf 89.8%
*-commutative89.8%
Simplified89.8%
if -1.79999999999999997e80 < x < 1.5e-11Initial program 95.3%
+-commutative95.3%
remove-double-neg95.3%
unsub-neg95.3%
sub-neg95.3%
+-commutative95.3%
distribute-rgt-in95.3%
*-lft-identity95.3%
associate--l+95.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 x around 0 95.3%
neg-mul-195.3%
unsub-neg95.3%
Simplified95.3%
if 1.5e-11 < x Initial program 60.5%
+-commutative60.5%
remove-double-neg60.5%
unsub-neg60.5%
sub-neg60.5%
+-commutative60.5%
distribute-rgt-in60.6%
*-lft-identity60.6%
associate--l+80.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 y around inf 80.0%
Final simplification90.6%
(FPCore (x y) :precision binary64 (if (or (<= x -1.65e+80) (not (<= x 5500000000000.0))) (* x y) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((x <= -1.65e+80) || !(x <= 5500000000000.0)) {
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.65d+80)) .or. (.not. (x <= 5500000000000.0d0))) 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.65e+80) || !(x <= 5500000000000.0)) {
tmp = x * y;
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.65e+80) or not (x <= 5500000000000.0): tmp = x * y else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.65e+80) || !(x <= 5500000000000.0)) 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.65e+80) || ~((x <= 5500000000000.0))) tmp = x * y; else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.65e+80], N[Not[LessEqual[x, 5500000000000.0]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{+80} \lor \neg \left(x \leq 5500000000000\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if x < -1.64999999999999995e80 or 5.5e12 < x Initial program 55.6%
+-commutative55.6%
remove-double-neg55.6%
unsub-neg55.6%
sub-neg55.6%
+-commutative55.6%
distribute-rgt-in55.6%
*-lft-identity55.6%
associate--l+84.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%
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 84.1%
*-commutative84.1%
Simplified84.1%
if -1.64999999999999995e80 < x < 5.5e12Initial program 95.4%
+-commutative95.4%
remove-double-neg95.4%
unsub-neg95.4%
sub-neg95.4%
+-commutative95.4%
distribute-rgt-in95.4%
*-lft-identity95.4%
associate--l+95.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 94.8%
neg-mul-194.8%
unsub-neg94.8%
Simplified94.8%
Final simplification90.2%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (- y) 1.0))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
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 <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) 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 <= -1.0) || !(y <= 1.0)) {
tmp = -y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = -y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(-y); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.0))) tmp = -y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], (-y), 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 99.9%
+-commutative99.9%
remove-double-neg99.9%
unsub-neg99.9%
sub-neg99.9%
+-commutative99.9%
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 y around inf 98.8%
Taylor expanded in x around 0 47.6%
mul-1-neg47.6%
Simplified47.6%
if -1 < y < 1Initial program 58.5%
+-commutative58.5%
remove-double-neg58.5%
unsub-neg58.5%
sub-neg58.5%
+-commutative58.5%
distribute-rgt-in58.5%
*-lft-identity58.5%
associate--l+81.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%
Taylor expanded in y around 0 72.7%
Final simplification60.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 78.4%
+-commutative78.4%
remove-double-neg78.4%
unsub-neg78.4%
sub-neg78.4%
+-commutative78.4%
distribute-rgt-in78.4%
*-lft-identity78.4%
associate--l+90.6%
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 78.4%
+-commutative78.4%
remove-double-neg78.4%
unsub-neg78.4%
sub-neg78.4%
+-commutative78.4%
distribute-rgt-in78.4%
*-lft-identity78.4%
associate--l+90.6%
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 39.1%
(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 2024146
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.Vectors:renderPlotVectors from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (- (* y x) (- y 1)))
(+ x (* (- 1.0 x) (- 1.0 y))))