
(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 7 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 (* 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 75.3%
+-commutative75.3%
remove-double-neg75.3%
unsub-neg75.3%
sub-neg75.3%
+-commutative75.3%
distribute-rgt-in75.3%
*-lft-identity75.3%
associate-+r-75.3%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
--rgt-identity100.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%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -9e+268)
(* y x)
(if (<= y -1.15e+241)
(- y)
(if (or (<= y -1.65e-50) (not (<= y 6.3e-74))) (* y x) 1.0))))
double code(double x, double y) {
double tmp;
if (y <= -9e+268) {
tmp = y * x;
} else if (y <= -1.15e+241) {
tmp = -y;
} else if ((y <= -1.65e-50) || !(y <= 6.3e-74)) {
tmp = y * x;
} 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 <= (-9d+268)) then
tmp = y * x
else if (y <= (-1.15d+241)) then
tmp = -y
else if ((y <= (-1.65d-50)) .or. (.not. (y <= 6.3d-74))) then
tmp = y * x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -9e+268) {
tmp = y * x;
} else if (y <= -1.15e+241) {
tmp = -y;
} else if ((y <= -1.65e-50) || !(y <= 6.3e-74)) {
tmp = y * x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -9e+268: tmp = y * x elif y <= -1.15e+241: tmp = -y elif (y <= -1.65e-50) or not (y <= 6.3e-74): tmp = y * x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -9e+268) tmp = Float64(y * x); elseif (y <= -1.15e+241) tmp = Float64(-y); elseif ((y <= -1.65e-50) || !(y <= 6.3e-74)) tmp = Float64(y * x); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -9e+268) tmp = y * x; elseif (y <= -1.15e+241) tmp = -y; elseif ((y <= -1.65e-50) || ~((y <= 6.3e-74))) tmp = y * x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -9e+268], N[(y * x), $MachinePrecision], If[LessEqual[y, -1.15e+241], (-y), If[Or[LessEqual[y, -1.65e-50], N[Not[LessEqual[y, 6.3e-74]], $MachinePrecision]], N[(y * x), $MachinePrecision], 1.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+268}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq -1.15 \cdot 10^{+241}:\\
\;\;\;\;-y\\
\mathbf{elif}\;y \leq -1.65 \cdot 10^{-50} \lor \neg \left(y \leq 6.3 \cdot 10^{-74}\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -9.00000000000000013e268 or -1.15e241 < y < -1.6499999999999999e-50 or 6.30000000000000003e-74 < y Initial program 92.3%
+-commutative92.3%
remove-double-neg92.3%
unsub-neg92.3%
sub-neg92.3%
+-commutative92.3%
distribute-rgt-in92.3%
*-lft-identity92.3%
associate-+r-92.3%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
--rgt-identity100.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 84.8%
Taylor expanded in x around inf 57.2%
*-commutative57.2%
Simplified57.2%
if -9.00000000000000013e268 < y < -1.15e241Initial 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-+r-100.0%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
--rgt-identity100.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 33.6%
Taylor expanded in y around inf 33.4%
*-commutative33.4%
associate-*r*99.6%
sub-neg99.6%
+-commutative99.6%
distribute-rgt1-in99.6%
distribute-lft-neg-out99.6%
lft-mult-inverse100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 86.8%
neg-mul-186.8%
Simplified86.8%
if -1.6499999999999999e-50 < y < 6.30000000000000003e-74Initial program 50.6%
+-commutative50.6%
remove-double-neg50.6%
unsub-neg50.6%
sub-neg50.6%
+-commutative50.6%
distribute-rgt-in50.6%
*-lft-identity50.6%
associate-+r-50.6%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
--rgt-identity100.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 81.8%
Final simplification68.2%
(FPCore (x y) :precision binary64 (if (or (<= (- 1.0 y) -5e+40) (not (<= (- 1.0 y) 2.0))) (* y (+ x -1.0)) (+ 1.0 (* y x))))
double code(double x, double y) {
double tmp;
if (((1.0 - y) <= -5e+40) || !((1.0 - y) <= 2.0)) {
tmp = y * (x + -1.0);
} else {
tmp = 1.0 + (y * x);
}
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+40)) .or. (.not. ((1.0d0 - y) <= 2.0d0))) then
tmp = y * (x + (-1.0d0))
else
tmp = 1.0d0 + (y * x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (((1.0 - y) <= -5e+40) || !((1.0 - y) <= 2.0)) {
tmp = y * (x + -1.0);
} else {
tmp = 1.0 + (y * x);
}
return tmp;
}
def code(x, y): tmp = 0 if ((1.0 - y) <= -5e+40) or not ((1.0 - y) <= 2.0): tmp = y * (x + -1.0) else: tmp = 1.0 + (y * x) return tmp
function code(x, y) tmp = 0.0 if ((Float64(1.0 - y) <= -5e+40) || !(Float64(1.0 - y) <= 2.0)) tmp = Float64(y * Float64(x + -1.0)); else tmp = Float64(1.0 + Float64(y * x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((1.0 - y) <= -5e+40) || ~(((1.0 - y) <= 2.0))) tmp = y * (x + -1.0); else tmp = 1.0 + (y * x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[N[(1.0 - y), $MachinePrecision], -5e+40], N[Not[LessEqual[N[(1.0 - y), $MachinePrecision], 2.0]], $MachinePrecision]], N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;1 - y \leq -5 \cdot 10^{+40} \lor \neg \left(1 - y \leq 2\right):\\
\;\;\;\;y \cdot \left(x + -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot x\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) y) < -5.00000000000000003e40 or 2 < (-.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-+r-100.0%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
--rgt-identity100.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 78.9%
Taylor expanded in y around inf 78.3%
*-commutative78.3%
associate-*r*99.3%
sub-neg99.3%
+-commutative99.3%
distribute-rgt1-in99.3%
distribute-lft-neg-out99.3%
lft-mult-inverse99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
if -5.00000000000000003e40 < (-.f64 #s(literal 1 binary64) y) < 2Initial program 51.7%
+-commutative51.7%
remove-double-neg51.7%
unsub-neg51.7%
sub-neg51.7%
+-commutative51.7%
distribute-rgt-in51.7%
*-lft-identity51.7%
associate-+r-51.7%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
--rgt-identity100.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.8%
*-commutative98.8%
Simplified98.8%
Final simplification99.1%
(FPCore (x y) :precision binary64 (if (or (<= y -1.85e-50) (not (<= y 21.0))) (* y (+ x -1.0)) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((y <= -1.85e-50) || !(y <= 21.0)) {
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.85d-50)) .or. (.not. (y <= 21.0d0))) 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.85e-50) || !(y <= 21.0)) {
tmp = y * (x + -1.0);
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.85e-50) or not (y <= 21.0): tmp = y * (x + -1.0) else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.85e-50) || !(y <= 21.0)) 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.85e-50) || ~((y <= 21.0))) tmp = y * (x + -1.0); else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.85e-50], N[Not[LessEqual[y, 21.0]], $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.85 \cdot 10^{-50} \lor \neg \left(y \leq 21\right):\\
\;\;\;\;y \cdot \left(x + -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if y < -1.85e-50 or 21 < y Initial program 96.3%
+-commutative96.3%
remove-double-neg96.3%
unsub-neg96.3%
sub-neg96.3%
+-commutative96.3%
distribute-rgt-in96.3%
*-lft-identity96.3%
associate-+r-96.3%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
--rgt-identity100.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 80.8%
Taylor expanded in y around inf 77.6%
*-commutative77.6%
associate-*r*96.7%
sub-neg96.7%
+-commutative96.7%
distribute-rgt1-in96.7%
distribute-lft-neg-out96.7%
lft-mult-inverse96.8%
metadata-eval96.8%
+-commutative96.8%
Simplified96.8%
if -1.85e-50 < y < 21Initial program 51.0%
+-commutative51.0%
remove-double-neg51.0%
unsub-neg51.0%
sub-neg51.0%
+-commutative51.0%
distribute-rgt-in51.0%
*-lft-identity51.0%
associate-+r-51.0%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
--rgt-identity100.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 78.9%
neg-mul-178.9%
unsub-neg78.9%
Simplified78.9%
Final simplification88.5%
(FPCore (x y) :precision binary64 (if (or (<= x -1e+49) (not (<= x 450.0))) (* y x) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((x <= -1e+49) || !(x <= 450.0)) {
tmp = y * x;
} 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 <= (-1d+49)) .or. (.not. (x <= 450.0d0))) then
tmp = y * x
else
tmp = 1.0d0 - y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -1e+49) || !(x <= 450.0)) {
tmp = y * x;
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1e+49) or not (x <= 450.0): tmp = y * x else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((x <= -1e+49) || !(x <= 450.0)) tmp = Float64(y * x); else tmp = Float64(1.0 - y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1e+49) || ~((x <= 450.0))) tmp = y * x; else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1e+49], N[Not[LessEqual[x, 450.0]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+49} \lor \neg \left(x \leq 450\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if x < -9.99999999999999946e48 or 450 < x Initial program 54.0%
+-commutative54.0%
remove-double-neg54.0%
unsub-neg54.0%
sub-neg54.0%
+-commutative54.0%
distribute-rgt-in54.1%
*-lft-identity54.1%
associate-+r-54.1%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
--rgt-identity100.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.9%
Taylor expanded in x around inf 74.8%
*-commutative74.8%
Simplified74.8%
if -9.99999999999999946e48 < x < 450Initial program 96.8%
+-commutative96.8%
remove-double-neg96.8%
unsub-neg96.8%
sub-neg96.8%
+-commutative96.8%
distribute-rgt-in96.8%
*-lft-identity96.8%
associate-+r-96.8%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
--rgt-identity100.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 96.4%
neg-mul-196.4%
unsub-neg96.4%
Simplified96.4%
Final simplification85.5%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 4400000000000.0))) (- y) 1.0))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 4400000000000.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 <= 4400000000000.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 <= 4400000000000.0)) {
tmp = -y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 4400000000000.0): tmp = -y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 4400000000000.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 <= 4400000000000.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, 4400000000000.0]], $MachinePrecision]], (-y), 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 4400000000000\right):\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 4.4e12 < 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-+r-100.0%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
--rgt-identity100.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 79.3%
Taylor expanded in y around inf 78.7%
*-commutative78.7%
associate-*r*99.3%
sub-neg99.3%
+-commutative99.3%
distribute-rgt1-in99.3%
distribute-lft-neg-out99.3%
lft-mult-inverse99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around 0 44.7%
neg-mul-144.7%
Simplified44.7%
if -1 < y < 4.4e12Initial program 50.9%
+-commutative50.9%
remove-double-neg50.9%
unsub-neg50.9%
sub-neg50.9%
+-commutative50.9%
distribute-rgt-in50.9%
*-lft-identity50.9%
associate-+r-50.9%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
--rgt-identity100.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 74.6%
Final simplification59.8%
(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 75.3%
+-commutative75.3%
remove-double-neg75.3%
unsub-neg75.3%
sub-neg75.3%
+-commutative75.3%
distribute-rgt-in75.3%
*-lft-identity75.3%
associate-+r-75.3%
associate--l-100.0%
sub-neg100.0%
+-inverses100.0%
--rgt-identity100.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 38.9%
Final simplification38.9%
(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 2024115
(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))))