
(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 (fma (+ x -1.0) y 1.0))
double code(double x, double y) {
return fma((x + -1.0), y, 1.0);
}
function code(x, y) return fma(Float64(x + -1.0), y, 1.0) end
code[x_, y_] := N[(N[(x + -1.0), $MachinePrecision] * y + 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x + -1, y, 1\right)
\end{array}
Initial program 82.8%
+-commutative82.8%
remove-double-neg82.8%
unsub-neg82.8%
sub-neg82.8%
+-commutative82.8%
distribute-rgt-in82.9%
*-lft-identity82.9%
associate-+r-82.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%
+-commutative100.0%
*-commutative100.0%
fma-define100.0%
Applied egg-rr100.0%
(FPCore (x y)
:precision binary64
(if (<= x -0.00011)
(* x y)
(if (<= x -1.85e-174)
1.0
(if (<= x 9.6e-252) (- y) (if (<= x 2.4e+26) 1.0 (* x y))))))
double code(double x, double y) {
double tmp;
if (x <= -0.00011) {
tmp = x * y;
} else if (x <= -1.85e-174) {
tmp = 1.0;
} else if (x <= 9.6e-252) {
tmp = -y;
} else if (x <= 2.4e+26) {
tmp = 1.0;
} 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 <= (-0.00011d0)) then
tmp = x * y
else if (x <= (-1.85d-174)) then
tmp = 1.0d0
else if (x <= 9.6d-252) then
tmp = -y
else if (x <= 2.4d+26) then
tmp = 1.0d0
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.00011) {
tmp = x * y;
} else if (x <= -1.85e-174) {
tmp = 1.0;
} else if (x <= 9.6e-252) {
tmp = -y;
} else if (x <= 2.4e+26) {
tmp = 1.0;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.00011: tmp = x * y elif x <= -1.85e-174: tmp = 1.0 elif x <= 9.6e-252: tmp = -y elif x <= 2.4e+26: tmp = 1.0 else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (x <= -0.00011) tmp = Float64(x * y); elseif (x <= -1.85e-174) tmp = 1.0; elseif (x <= 9.6e-252) tmp = Float64(-y); elseif (x <= 2.4e+26) tmp = 1.0; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.00011) tmp = x * y; elseif (x <= -1.85e-174) tmp = 1.0; elseif (x <= 9.6e-252) tmp = -y; elseif (x <= 2.4e+26) tmp = 1.0; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.00011], N[(x * y), $MachinePrecision], If[LessEqual[x, -1.85e-174], 1.0, If[LessEqual[x, 9.6e-252], (-y), If[LessEqual[x, 2.4e+26], 1.0, N[(x * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00011:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -1.85 \cdot 10^{-174}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{-252}:\\
\;\;\;\;-y\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+26}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if x < -1.10000000000000004e-4 or 2.40000000000000005e26 < x Initial program 62.7%
+-commutative62.7%
remove-double-neg62.7%
unsub-neg62.7%
sub-neg62.7%
+-commutative62.7%
distribute-rgt-in62.8%
*-lft-identity62.8%
associate-+r-62.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%
+-commutative100.0%
*-commutative100.0%
fma-define100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 85.9%
*-commutative85.9%
Simplified85.9%
if -1.10000000000000004e-4 < x < -1.85000000000000005e-174 or 9.6000000000000006e-252 < x < 2.40000000000000005e26Initial program 97.2%
+-commutative97.2%
remove-double-neg97.2%
unsub-neg97.2%
sub-neg97.2%
+-commutative97.2%
distribute-rgt-in97.2%
*-lft-identity97.2%
associate-+r-97.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 y around 0 61.0%
if -1.85000000000000005e-174 < x < 9.6000000000000006e-252Initial 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 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 67.3%
neg-mul-167.3%
Simplified67.3%
Final simplification72.7%
(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 62.4%
+-commutative62.4%
remove-double-neg62.4%
unsub-neg62.4%
sub-neg62.4%
+-commutative62.4%
distribute-rgt-in62.5%
*-lft-identity62.5%
associate-+r-62.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 x around inf 98.5%
*-commutative98.5%
Simplified98.5%
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-+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 99.5%
neg-mul-199.5%
unsub-neg99.5%
Simplified99.5%
Final simplification99.0%
(FPCore (x y) :precision binary64 (if (or (<= x -1.15) (not (<= x 6e+27))) (* x y) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((x <= -1.15) || !(x <= 6e+27)) {
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.15d0)) .or. (.not. (x <= 6d+27))) 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.15) || !(x <= 6e+27)) {
tmp = x * y;
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.15) or not (x <= 6e+27): tmp = x * y else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.15) || !(x <= 6e+27)) 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.15) || ~((x <= 6e+27))) tmp = x * y; else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.15], N[Not[LessEqual[x, 6e+27]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \lor \neg \left(x \leq 6 \cdot 10^{+27}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if x < -1.1499999999999999 or 5.99999999999999953e27 < x Initial program 62.3%
+-commutative62.3%
remove-double-neg62.3%
unsub-neg62.3%
sub-neg62.3%
+-commutative62.3%
distribute-rgt-in62.4%
*-lft-identity62.4%
associate-+r-62.4%
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%
+-commutative100.0%
*-commutative100.0%
fma-define100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 86.5%
*-commutative86.5%
Simplified86.5%
if -1.1499999999999999 < x < 5.99999999999999953e27Initial program 98.0%
+-commutative98.0%
remove-double-neg98.0%
unsub-neg98.0%
sub-neg98.0%
+-commutative98.0%
distribute-rgt-in98.0%
*-lft-identity98.0%
associate-+r-98.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 97.5%
neg-mul-197.5%
unsub-neg97.5%
Simplified97.5%
Final simplification92.8%
(FPCore (x y) :precision binary64 (if (<= x -5e-5) (* (+ x -1.0) y) (if (<= x 2.15e+27) (- 1.0 y) (* x y))))
double code(double x, double y) {
double tmp;
if (x <= -5e-5) {
tmp = (x + -1.0) * y;
} else if (x <= 2.15e+27) {
tmp = 1.0 - 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 <= (-5d-5)) then
tmp = (x + (-1.0d0)) * y
else if (x <= 2.15d+27) then
tmp = 1.0d0 - y
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -5e-5) {
tmp = (x + -1.0) * y;
} else if (x <= 2.15e+27) {
tmp = 1.0 - y;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -5e-5: tmp = (x + -1.0) * y elif x <= 2.15e+27: tmp = 1.0 - y else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (x <= -5e-5) tmp = Float64(Float64(x + -1.0) * y); elseif (x <= 2.15e+27) tmp = Float64(1.0 - y); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -5e-5) tmp = (x + -1.0) * y; elseif (x <= 2.15e+27) tmp = 1.0 - y; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -5e-5], N[(N[(x + -1.0), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[x, 2.15e+27], N[(1.0 - y), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-5}:\\
\;\;\;\;\left(x + -1\right) \cdot y\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{+27}:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if x < -5.00000000000000024e-5Initial program 67.2%
+-commutative67.2%
remove-double-neg67.2%
unsub-neg67.2%
sub-neg67.2%
+-commutative67.2%
distribute-rgt-in67.3%
*-lft-identity67.3%
associate-+r-67.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%
+-commutative100.0%
*-commutative100.0%
fma-define100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 94.1%
if -5.00000000000000024e-5 < x < 2.15000000000000004e27Initial program 98.0%
+-commutative98.0%
remove-double-neg98.0%
unsub-neg98.0%
sub-neg98.0%
+-commutative98.0%
distribute-rgt-in98.0%
*-lft-identity98.0%
associate-+r-98.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 97.9%
neg-mul-197.9%
unsub-neg97.9%
Simplified97.9%
if 2.15000000000000004e27 < x Initial program 58.3%
+-commutative58.3%
remove-double-neg58.3%
unsub-neg58.3%
sub-neg58.3%
+-commutative58.3%
distribute-rgt-in58.3%
*-lft-identity58.3%
associate-+r-58.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%
+-commutative100.0%
*-commutative100.0%
fma-define100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 80.9%
*-commutative80.9%
Simplified80.9%
Final simplification93.4%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.108))) (- y) 1.0))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.108)) {
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.108d0))) 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.108)) {
tmp = -y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 0.108): tmp = -y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.108)) 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.108))) 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.108]], $MachinePrecision]], (-y), 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.108\right):\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1 or 0.107999999999999999 < 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 0 50.2%
neg-mul-150.2%
unsub-neg50.2%
Simplified50.2%
Taylor expanded in y around inf 48.8%
neg-mul-148.8%
Simplified48.8%
if -1 < y < 0.107999999999999999Initial program 63.7%
+-commutative63.7%
remove-double-neg63.7%
unsub-neg63.7%
sub-neg63.7%
+-commutative63.7%
distribute-rgt-in63.8%
*-lft-identity63.8%
associate-+r-63.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 y around 0 74.6%
Final simplification61.0%
(FPCore (x y) :precision binary64 (+ 1.0 (* (+ x -1.0) y)))
double code(double x, double y) {
return 1.0 + ((x + -1.0) * y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 + ((x + (-1.0d0)) * y)
end function
public static double code(double x, double y) {
return 1.0 + ((x + -1.0) * y);
}
def code(x, y): return 1.0 + ((x + -1.0) * y)
function code(x, y) return Float64(1.0 + Float64(Float64(x + -1.0) * y)) end
function tmp = code(x, y) tmp = 1.0 + ((x + -1.0) * y); end
code[x_, y_] := N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(x + -1\right) \cdot y
\end{array}
Initial program 82.8%
+-commutative82.8%
remove-double-neg82.8%
unsub-neg82.8%
sub-neg82.8%
+-commutative82.8%
distribute-rgt-in82.9%
*-lft-identity82.9%
associate-+r-82.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%
Final simplification100.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 82.8%
+-commutative82.8%
remove-double-neg82.8%
unsub-neg82.8%
sub-neg82.8%
+-commutative82.8%
distribute-rgt-in82.9%
*-lft-identity82.9%
associate-+r-82.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 36.7%
(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 2024151
(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))))