
(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 (- (* y x) y)))
double code(double x, double y) {
return 1.0 + ((y * x) - y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 + ((y * x) - y)
end function
public static double code(double x, double y) {
return 1.0 + ((y * x) - y);
}
def code(x, y): return 1.0 + ((y * x) - y)
function code(x, y) return Float64(1.0 + Float64(Float64(y * x) - y)) end
function tmp = code(x, y) tmp = 1.0 + ((y * x) - y); end
code[x_, y_] := N[(1.0 + N[(N[(y * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(y \cdot x - y\right)
\end{array}
Initial program 78.0%
+-commutative78.0%
remove-double-neg78.0%
unsub-neg78.0%
sub-neg78.0%
+-commutative78.0%
distribute-rgt-in78.0%
*-lft-identity78.0%
associate-+r-78.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%
distribute-lft-in100.0%
fma-define100.0%
*-commutative100.0%
mul-1-neg100.0%
fmm-undef100.0%
Applied egg-rr100.0%
(FPCore (x y)
:precision binary64
(if (<= x -1400.0)
(* y x)
(if (<= x -2.2e-191)
(- y)
(if (<= x 1.65e-167) 1.0 (if (<= x 1.0) (- y) (* y x))))))
double code(double x, double y) {
double tmp;
if (x <= -1400.0) {
tmp = y * x;
} else if (x <= -2.2e-191) {
tmp = -y;
} else if (x <= 1.65e-167) {
tmp = 1.0;
} else if (x <= 1.0) {
tmp = -y;
} else {
tmp = y * x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1400.0d0)) then
tmp = y * x
else if (x <= (-2.2d-191)) then
tmp = -y
else if (x <= 1.65d-167) then
tmp = 1.0d0
else if (x <= 1.0d0) then
tmp = -y
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1400.0) {
tmp = y * x;
} else if (x <= -2.2e-191) {
tmp = -y;
} else if (x <= 1.65e-167) {
tmp = 1.0;
} else if (x <= 1.0) {
tmp = -y;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1400.0: tmp = y * x elif x <= -2.2e-191: tmp = -y elif x <= 1.65e-167: tmp = 1.0 elif x <= 1.0: tmp = -y else: tmp = y * x return tmp
function code(x, y) tmp = 0.0 if (x <= -1400.0) tmp = Float64(y * x); elseif (x <= -2.2e-191) tmp = Float64(-y); elseif (x <= 1.65e-167) tmp = 1.0; elseif (x <= 1.0) tmp = Float64(-y); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1400.0) tmp = y * x; elseif (x <= -2.2e-191) tmp = -y; elseif (x <= 1.65e-167) tmp = 1.0; elseif (x <= 1.0) tmp = -y; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1400.0], N[(y * x), $MachinePrecision], If[LessEqual[x, -2.2e-191], (-y), If[LessEqual[x, 1.65e-167], 1.0, If[LessEqual[x, 1.0], (-y), N[(y * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1400:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \leq -2.2 \cdot 10^{-191}:\\
\;\;\;\;-y\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-167}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if x < -1400 or 1 < x Initial program 53.5%
+-commutative53.5%
remove-double-neg53.5%
unsub-neg53.5%
sub-neg53.5%
+-commutative53.5%
distribute-rgt-in53.5%
*-lft-identity53.5%
associate-+r-53.5%
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 inf 99.9%
Taylor expanded in x around inf 80.1%
if -1400 < x < -2.19999999999999998e-191 or 1.64999999999999998e-167 < 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-+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 y around inf 99.9%
Taylor expanded in y around inf 64.5%
Taylor expanded in x around 0 62.6%
neg-mul-162.6%
Simplified62.6%
if -2.19999999999999998e-191 < x < 1.64999999999999998e-167Initial 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 y around 0 61.7%
(FPCore (x y) :precision binary64 (if (or (<= x -1400.0) (not (<= x 1.3e-8))) (+ 1.0 (* y x)) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((x <= -1400.0) || !(x <= 1.3e-8)) {
tmp = 1.0 + (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 <= (-1400.0d0)) .or. (.not. (x <= 1.3d-8))) then
tmp = 1.0d0 + (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 <= -1400.0) || !(x <= 1.3e-8)) {
tmp = 1.0 + (y * x);
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1400.0) or not (x <= 1.3e-8): tmp = 1.0 + (y * x) else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((x <= -1400.0) || !(x <= 1.3e-8)) tmp = Float64(1.0 + Float64(y * x)); else tmp = Float64(1.0 - y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1400.0) || ~((x <= 1.3e-8))) tmp = 1.0 + (y * x); else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1400.0], N[Not[LessEqual[x, 1.3e-8]], $MachinePrecision]], N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1400 \lor \neg \left(x \leq 1.3 \cdot 10^{-8}\right):\\
\;\;\;\;1 + y \cdot x\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if x < -1400 or 1.3000000000000001e-8 < x Initial program 54.2%
+-commutative54.2%
remove-double-neg54.2%
unsub-neg54.2%
sub-neg54.2%
+-commutative54.2%
distribute-rgt-in54.2%
*-lft-identity54.2%
associate-+r-54.2%
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.4%
*-commutative99.4%
Simplified99.4%
if -1400 < x < 1.3000000000000001e-8Initial 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 0 98.7%
neg-mul-198.7%
unsub-neg98.7%
Simplified98.7%
Final simplification99.0%
(FPCore (x y) :precision binary64 (if (<= x -3.4e+93) (* y x) (if (<= x 9.6) (- 1.0 y) (* y (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -3.4e+93) {
tmp = y * x;
} else if (x <= 9.6) {
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 <= (-3.4d+93)) then
tmp = y * x
else if (x <= 9.6d0) 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 <= -3.4e+93) {
tmp = y * x;
} else if (x <= 9.6) {
tmp = 1.0 - y;
} else {
tmp = y * (x + -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3.4e+93: tmp = y * x elif x <= 9.6: tmp = 1.0 - y else: tmp = y * (x + -1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -3.4e+93) tmp = Float64(y * x); elseif (x <= 9.6) 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 <= -3.4e+93) tmp = y * x; elseif (x <= 9.6) tmp = 1.0 - y; else tmp = y * (x + -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3.4e+93], N[(y * x), $MachinePrecision], If[LessEqual[x, 9.6], N[(1.0 - y), $MachinePrecision], N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{+93}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \leq 9.6:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if x < -3.4e93Initial program 49.9%
+-commutative49.9%
remove-double-neg49.9%
unsub-neg49.9%
sub-neg49.9%
+-commutative49.9%
distribute-rgt-in49.9%
*-lft-identity49.9%
associate-+r-49.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 inf 99.9%
Taylor expanded in x around inf 90.2%
if -3.4e93 < x < 9.59999999999999964Initial program 94.2%
+-commutative94.2%
remove-double-neg94.2%
unsub-neg94.2%
sub-neg94.2%
+-commutative94.2%
distribute-rgt-in94.2%
*-lft-identity94.2%
associate-+r-94.2%
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 94.1%
neg-mul-194.1%
unsub-neg94.1%
Simplified94.1%
if 9.59999999999999964 < x Initial program 57.5%
+-commutative57.5%
remove-double-neg57.5%
unsub-neg57.5%
sub-neg57.5%
+-commutative57.5%
distribute-rgt-in57.5%
*-lft-identity57.5%
associate-+r-57.5%
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 inf 100.0%
Taylor expanded in y around inf 82.8%
Final simplification90.6%
(FPCore (x y) :precision binary64 (if (or (<= x -1.55e+93) (not (<= x 2.2e+16))) (* y x) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((x <= -1.55e+93) || !(x <= 2.2e+16)) {
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 <= (-1.55d+93)) .or. (.not. (x <= 2.2d+16))) 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 <= -1.55e+93) || !(x <= 2.2e+16)) {
tmp = y * x;
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.55e+93) or not (x <= 2.2e+16): tmp = y * x else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.55e+93) || !(x <= 2.2e+16)) 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 <= -1.55e+93) || ~((x <= 2.2e+16))) tmp = y * x; else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.55e+93], N[Not[LessEqual[x, 2.2e+16]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{+93} \lor \neg \left(x \leq 2.2 \cdot 10^{+16}\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if x < -1.5500000000000001e93 or 2.2e16 < x Initial program 52.9%
+-commutative52.9%
remove-double-neg52.9%
unsub-neg52.9%
sub-neg52.9%
+-commutative52.9%
distribute-rgt-in52.9%
*-lft-identity52.9%
associate-+r-52.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 inf 100.0%
Taylor expanded in x around inf 86.9%
if -1.5500000000000001e93 < x < 2.2e16Initial program 94.3%
+-commutative94.3%
remove-double-neg94.3%
unsub-neg94.3%
sub-neg94.3%
+-commutative94.3%
distribute-rgt-in94.3%
*-lft-identity94.3%
associate-+r-94.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 0 93.0%
neg-mul-193.0%
unsub-neg93.0%
Simplified93.0%
Final simplification90.6%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 620000000.0))) (- y) 1.0))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 620000000.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 <= 620000000.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 <= 620000000.0)) {
tmp = -y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 620000000.0): tmp = -y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 620000000.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 <= 620000000.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, 620000000.0]], $MachinePrecision]], (-y), 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 620000000\right):\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 6.2e8 < 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 y around inf 100.0%
Taylor expanded in y around inf 99.4%
Taylor expanded in x around 0 54.1%
neg-mul-154.1%
Simplified54.1%
if -1 < y < 6.2e8Initial program 57.0%
+-commutative57.0%
remove-double-neg57.0%
unsub-neg57.0%
sub-neg57.0%
+-commutative57.0%
distribute-rgt-in57.0%
*-lft-identity57.0%
associate-+r-57.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 y around 0 67.3%
Final simplification60.9%
(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.0%
+-commutative78.0%
remove-double-neg78.0%
unsub-neg78.0%
sub-neg78.0%
+-commutative78.0%
distribute-rgt-in78.0%
*-lft-identity78.0%
associate-+r-78.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%
(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.0%
+-commutative78.0%
remove-double-neg78.0%
unsub-neg78.0%
sub-neg78.0%
+-commutative78.0%
distribute-rgt-in78.0%
*-lft-identity78.0%
associate-+r-78.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 y around 0 35.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 2024158
(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))))