
(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 80.7%
+-commutative80.7%
remove-double-neg80.7%
unsub-neg80.7%
sub-neg80.7%
+-commutative80.7%
distribute-rgt-in80.7%
*-lft-identity80.7%
associate--l+88.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%
(FPCore (x y)
:precision binary64
(if (<= y -5.2e+188)
(* x y)
(if (<= y -7.2e+77)
(- y)
(if (<= y -1.2e-71)
(* x y)
(if (<= y 1.06e-14)
1.0
(if (or (<= y 3.5e+87) (not (<= y 3.2e+249))) (* x y) (- y)))))))
double code(double x, double y) {
double tmp;
if (y <= -5.2e+188) {
tmp = x * y;
} else if (y <= -7.2e+77) {
tmp = -y;
} else if (y <= -1.2e-71) {
tmp = x * y;
} else if (y <= 1.06e-14) {
tmp = 1.0;
} else if ((y <= 3.5e+87) || !(y <= 3.2e+249)) {
tmp = x * y;
} else {
tmp = -y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-5.2d+188)) then
tmp = x * y
else if (y <= (-7.2d+77)) then
tmp = -y
else if (y <= (-1.2d-71)) then
tmp = x * y
else if (y <= 1.06d-14) then
tmp = 1.0d0
else if ((y <= 3.5d+87) .or. (.not. (y <= 3.2d+249))) then
tmp = x * y
else
tmp = -y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.2e+188) {
tmp = x * y;
} else if (y <= -7.2e+77) {
tmp = -y;
} else if (y <= -1.2e-71) {
tmp = x * y;
} else if (y <= 1.06e-14) {
tmp = 1.0;
} else if ((y <= 3.5e+87) || !(y <= 3.2e+249)) {
tmp = x * y;
} else {
tmp = -y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.2e+188: tmp = x * y elif y <= -7.2e+77: tmp = -y elif y <= -1.2e-71: tmp = x * y elif y <= 1.06e-14: tmp = 1.0 elif (y <= 3.5e+87) or not (y <= 3.2e+249): tmp = x * y else: tmp = -y return tmp
function code(x, y) tmp = 0.0 if (y <= -5.2e+188) tmp = Float64(x * y); elseif (y <= -7.2e+77) tmp = Float64(-y); elseif (y <= -1.2e-71) tmp = Float64(x * y); elseif (y <= 1.06e-14) tmp = 1.0; elseif ((y <= 3.5e+87) || !(y <= 3.2e+249)) tmp = Float64(x * y); else tmp = Float64(-y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.2e+188) tmp = x * y; elseif (y <= -7.2e+77) tmp = -y; elseif (y <= -1.2e-71) tmp = x * y; elseif (y <= 1.06e-14) tmp = 1.0; elseif ((y <= 3.5e+87) || ~((y <= 3.2e+249))) tmp = x * y; else tmp = -y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.2e+188], N[(x * y), $MachinePrecision], If[LessEqual[y, -7.2e+77], (-y), If[LessEqual[y, -1.2e-71], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.06e-14], 1.0, If[Or[LessEqual[y, 3.5e+87], N[Not[LessEqual[y, 3.2e+249]], $MachinePrecision]], N[(x * y), $MachinePrecision], (-y)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+188}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq -7.2 \cdot 10^{+77}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq -1.2 \cdot 10^{-71}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 1.06 \cdot 10^{-14}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+87} \lor \neg \left(y \leq 3.2 \cdot 10^{+249}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;-y\\
\end{array}
\end{array}
if y < -5.19999999999999975e188 or -7.1999999999999996e77 < y < -1.2e-71 or 1.06e-14 < y < 3.49999999999999986e87 or 3.20000000000000014e249 < y Initial program 92.2%
+-commutative92.2%
remove-double-neg92.2%
unsub-neg92.2%
sub-neg92.2%
+-commutative92.2%
distribute-rgt-in92.2%
*-lft-identity92.2%
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 y around inf 100.0%
Taylor expanded in x around inf 60.4%
if -5.19999999999999975e188 < y < -7.1999999999999996e77 or 3.49999999999999986e87 < y < 3.20000000000000014e249Initial 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 y around inf 100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 67.8%
neg-mul-167.8%
Simplified67.8%
if -1.2e-71 < y < 1.06e-14Initial program 59.1%
+-commutative59.1%
remove-double-neg59.1%
unsub-neg59.1%
sub-neg59.1%
+-commutative59.1%
distribute-rgt-in59.1%
*-lft-identity59.1%
associate--l+72.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 y around 0 83.4%
Final simplification71.2%
(FPCore (x y) :precision binary64 (if (or (<= x -2800000000.0) (not (<= x 1.0))) (+ 1.0 (* x y)) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((x <= -2800000000.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 <= (-2800000000.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 <= -2800000000.0) || !(x <= 1.0)) {
tmp = 1.0 + (x * y);
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -2800000000.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 <= -2800000000.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 <= -2800000000.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, -2800000000.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 -2800000000 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;1 + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if x < -2.8e9 or 1 < x Initial program 59.6%
+-commutative59.6%
remove-double-neg59.6%
unsub-neg59.6%
sub-neg59.6%
+-commutative59.6%
distribute-rgt-in59.6%
*-lft-identity59.6%
associate--l+76.7%
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.4%
*-commutative99.4%
Simplified99.4%
if -2.8e9 < 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 99.3%
neg-mul-199.3%
unsub-neg99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (x y) :precision binary64 (if (or (<= y -1.05e-71) (not (<= y 0.0145))) (* y (+ x -1.0)) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((y <= -1.05e-71) || !(y <= 0.0145)) {
tmp = y * (x + -1.0);
} 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 ((y <= (-1.05d-71)) .or. (.not. (y <= 0.0145d0))) then
tmp = y * (x + (-1.0d0))
else
tmp = 1.0d0 - y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.05e-71) || !(y <= 0.0145)) {
tmp = y * (x + -1.0);
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.05e-71) or not (y <= 0.0145): tmp = y * (x + -1.0) else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.05e-71) || !(y <= 0.0145)) tmp = Float64(y * Float64(x + -1.0)); else tmp = Float64(1.0 - y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.05e-71) || ~((y <= 0.0145))) tmp = y * (x + -1.0); else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.05e-71], N[Not[LessEqual[y, 0.0145]], $MachinePrecision]], N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{-71} \lor \neg \left(y \leq 0.0145\right):\\
\;\;\;\;y \cdot \left(x + -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if y < -1.0500000000000001e-71 or 0.0145000000000000007 < y Initial 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+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 y around inf 100.0%
Taylor expanded in y around inf 96.2%
if -1.0500000000000001e-71 < y < 0.0145000000000000007Initial program 59.6%
+-commutative59.6%
remove-double-neg59.6%
unsub-neg59.6%
sub-neg59.6%
+-commutative59.6%
distribute-rgt-in59.6%
*-lft-identity59.6%
associate--l+72.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 x around 0 83.0%
neg-mul-183.0%
unsub-neg83.0%
Simplified83.0%
Final simplification90.8%
(FPCore (x y) :precision binary64 (if (or (<= x -5.2e+18) (not (<= x 16500000000.0))) (* x y) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((x <= -5.2e+18) || !(x <= 16500000000.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 <= (-5.2d+18)) .or. (.not. (x <= 16500000000.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 <= -5.2e+18) || !(x <= 16500000000.0)) {
tmp = x * y;
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -5.2e+18) or not (x <= 16500000000.0): tmp = x * y else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((x <= -5.2e+18) || !(x <= 16500000000.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 <= -5.2e+18) || ~((x <= 16500000000.0))) tmp = x * y; else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -5.2e+18], N[Not[LessEqual[x, 16500000000.0]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{+18} \lor \neg \left(x \leq 16500000000\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if x < -5.2e18 or 1.65e10 < x Initial program 58.6%
+-commutative58.6%
remove-double-neg58.6%
unsub-neg58.6%
sub-neg58.6%
+-commutative58.6%
distribute-rgt-in58.6%
*-lft-identity58.6%
associate--l+76.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 y around inf 99.9%
Taylor expanded in x around inf 76.1%
if -5.2e18 < x < 1.65e10Initial 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.6%
neg-mul-198.6%
unsub-neg98.6%
Simplified98.6%
Final simplification88.1%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.0185))) (- y) 1.0))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.0185)) {
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 <= 0.0185d0))) 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 <= 0.0185)) {
tmp = -y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 0.0185): tmp = -y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.0185)) 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 <= 0.0185))) tmp = -y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 0.0185]], $MachinePrecision]], (-y), 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.0185\right):\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 0.0184999999999999991 < y Initial program 99.9%
+-commutative99.9%
remove-double-neg99.9%
unsub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-rgt-in99.9%
*-lft-identity99.9%
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 y around inf 100.0%
Taylor expanded in y around inf 99.2%
Taylor expanded in x around 0 50.4%
neg-mul-150.4%
Simplified50.4%
if -1 < y < 0.0184999999999999991Initial program 57.9%
+-commutative57.9%
remove-double-neg57.9%
unsub-neg57.9%
sub-neg57.9%
+-commutative57.9%
distribute-rgt-in57.9%
*-lft-identity57.9%
associate--l+75.7%
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 78.1%
Final simplification63.0%
(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 80.7%
+-commutative80.7%
remove-double-neg80.7%
unsub-neg80.7%
sub-neg80.7%
+-commutative80.7%
distribute-rgt-in80.7%
*-lft-identity80.7%
associate--l+88.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%
(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 80.7%
+-commutative80.7%
remove-double-neg80.7%
unsub-neg80.7%
sub-neg80.7%
+-commutative80.7%
distribute-rgt-in80.7%
*-lft-identity80.7%
associate--l+88.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 37.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 2024144
(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))))