
(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 75.4%
+-commutative75.4%
remove-double-neg75.4%
unsub-neg75.4%
sub-neg75.4%
+-commutative75.4%
distribute-rgt-in75.4%
*-lft-identity75.4%
associate-+r-75.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%
(FPCore (x y)
:precision binary64
(if (<= x -20500000000.0)
(* x y)
(if (<= x -5e-108)
1.0
(if (<= x 9.5e-24) (- y) (if (<= x 1.65e+30) 1.0 (* x y))))))
double code(double x, double y) {
double tmp;
if (x <= -20500000000.0) {
tmp = x * y;
} else if (x <= -5e-108) {
tmp = 1.0;
} else if (x <= 9.5e-24) {
tmp = -y;
} else if (x <= 1.65e+30) {
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 <= (-20500000000.0d0)) then
tmp = x * y
else if (x <= (-5d-108)) then
tmp = 1.0d0
else if (x <= 9.5d-24) then
tmp = -y
else if (x <= 1.65d+30) 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 <= -20500000000.0) {
tmp = x * y;
} else if (x <= -5e-108) {
tmp = 1.0;
} else if (x <= 9.5e-24) {
tmp = -y;
} else if (x <= 1.65e+30) {
tmp = 1.0;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -20500000000.0: tmp = x * y elif x <= -5e-108: tmp = 1.0 elif x <= 9.5e-24: tmp = -y elif x <= 1.65e+30: tmp = 1.0 else: tmp = x * y return tmp
function code(x, y) tmp = 0.0 if (x <= -20500000000.0) tmp = Float64(x * y); elseif (x <= -5e-108) tmp = 1.0; elseif (x <= 9.5e-24) tmp = Float64(-y); elseif (x <= 1.65e+30) tmp = 1.0; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -20500000000.0) tmp = x * y; elseif (x <= -5e-108) tmp = 1.0; elseif (x <= 9.5e-24) tmp = -y; elseif (x <= 1.65e+30) tmp = 1.0; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -20500000000.0], N[(x * y), $MachinePrecision], If[LessEqual[x, -5e-108], 1.0, If[LessEqual[x, 9.5e-24], (-y), If[LessEqual[x, 1.65e+30], 1.0, N[(x * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -20500000000:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-108}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-24}:\\
\;\;\;\;-y\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{+30}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if x < -2.05e10 or 1.65000000000000013e30 < x Initial program 46.8%
+-commutative46.8%
remove-double-neg46.8%
unsub-neg46.8%
sub-neg46.8%
+-commutative46.8%
distribute-rgt-in46.8%
*-lft-identity46.8%
associate-+r-46.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 y around inf 82.4%
Taylor expanded in x around inf 82.1%
*-commutative82.1%
Simplified82.1%
if -2.05e10 < x < -5e-108 or 9.50000000000000029e-24 < x < 1.65000000000000013e30Initial program 92.7%
+-commutative92.7%
remove-double-neg92.7%
unsub-neg92.7%
sub-neg92.7%
+-commutative92.7%
distribute-rgt-in92.8%
*-lft-identity92.8%
associate-+r-92.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 71.1%
if -5e-108 < x < 9.50000000000000029e-24Initial 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 59.2%
neg-mul-159.2%
Simplified59.2%
Final simplification71.3%
(FPCore (x y) :precision binary64 (if (or (<= x -165000000.0) (not (<= x 5.8e-18))) (+ 1.0 (* x y)) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((x <= -165000000.0) || !(x <= 5.8e-18)) {
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 <= (-165000000.0d0)) .or. (.not. (x <= 5.8d-18))) 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 <= -165000000.0) || !(x <= 5.8e-18)) {
tmp = 1.0 + (x * y);
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -165000000.0) or not (x <= 5.8e-18): tmp = 1.0 + (x * y) else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((x <= -165000000.0) || !(x <= 5.8e-18)) 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 <= -165000000.0) || ~((x <= 5.8e-18))) tmp = 1.0 + (x * y); else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -165000000.0], N[Not[LessEqual[x, 5.8e-18]], $MachinePrecision]], N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -165000000 \lor \neg \left(x \leq 5.8 \cdot 10^{-18}\right):\\
\;\;\;\;1 + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if x < -1.65e8 or 5.8e-18 < x Initial program 50.8%
+-commutative50.8%
remove-double-neg50.8%
unsub-neg50.8%
sub-neg50.8%
+-commutative50.8%
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 x around inf 99.7%
*-commutative99.7%
Simplified99.7%
if -1.65e8 < x < 5.8e-18Initial 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.9%
neg-mul-199.9%
unsub-neg99.9%
Simplified99.9%
Final simplification99.8%
(FPCore (x y) :precision binary64 (if (or (<= x -52000000000.0) (not (<= x 6200000000000.0))) (* (+ x -1.0) y) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((x <= -52000000000.0) || !(x <= 6200000000000.0)) {
tmp = (x + -1.0) * 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 <= (-52000000000.0d0)) .or. (.not. (x <= 6200000000000.0d0))) then
tmp = (x + (-1.0d0)) * y
else
tmp = 1.0d0 - y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -52000000000.0) || !(x <= 6200000000000.0)) {
tmp = (x + -1.0) * y;
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -52000000000.0) or not (x <= 6200000000000.0): tmp = (x + -1.0) * y else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((x <= -52000000000.0) || !(x <= 6200000000000.0)) tmp = Float64(Float64(x + -1.0) * y); else tmp = Float64(1.0 - y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -52000000000.0) || ~((x <= 6200000000000.0))) tmp = (x + -1.0) * y; else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -52000000000.0], N[Not[LessEqual[x, 6200000000000.0]], $MachinePrecision]], N[(N[(x + -1.0), $MachinePrecision] * y), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -52000000000 \lor \neg \left(x \leq 6200000000000\right):\\
\;\;\;\;\left(x + -1\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if x < -5.2e10 or 6.2e12 < x Initial program 47.0%
+-commutative47.0%
remove-double-neg47.0%
unsub-neg47.0%
sub-neg47.0%
+-commutative47.0%
distribute-rgt-in47.0%
*-lft-identity47.0%
associate-+r-47.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%
+-commutative100.0%
*-commutative100.0%
fma-define100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 80.8%
if -5.2e10 < x < 6.2e12Initial program 99.7%
+-commutative99.7%
remove-double-neg99.7%
unsub-neg99.7%
sub-neg99.7%
+-commutative99.7%
distribute-rgt-in99.7%
*-lft-identity99.7%
associate-+r-99.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 0 99.6%
neg-mul-199.6%
unsub-neg99.6%
Simplified99.6%
Final simplification90.9%
(FPCore (x y) :precision binary64 (if (or (<= x -58000000000.0) (not (<= x 1.55e+15))) (* x y) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((x <= -58000000000.0) || !(x <= 1.55e+15)) {
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 <= (-58000000000.0d0)) .or. (.not. (x <= 1.55d+15))) 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 <= -58000000000.0) || !(x <= 1.55e+15)) {
tmp = x * y;
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -58000000000.0) or not (x <= 1.55e+15): tmp = x * y else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((x <= -58000000000.0) || !(x <= 1.55e+15)) 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 <= -58000000000.0) || ~((x <= 1.55e+15))) tmp = x * y; else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -58000000000.0], N[Not[LessEqual[x, 1.55e+15]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -58000000000 \lor \neg \left(x \leq 1.55 \cdot 10^{+15}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if x < -5.8e10 or 1.55e15 < x Initial program 47.0%
+-commutative47.0%
remove-double-neg47.0%
unsub-neg47.0%
sub-neg47.0%
+-commutative47.0%
distribute-rgt-in47.0%
*-lft-identity47.0%
associate-+r-47.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%
+-commutative100.0%
*-commutative100.0%
fma-define100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 80.8%
Taylor expanded in x around inf 80.5%
*-commutative80.5%
Simplified80.5%
if -5.8e10 < x < 1.55e15Initial program 99.7%
+-commutative99.7%
remove-double-neg99.7%
unsub-neg99.7%
sub-neg99.7%
+-commutative99.7%
distribute-rgt-in99.7%
*-lft-identity99.7%
associate-+r-99.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 0 99.6%
neg-mul-199.6%
unsub-neg99.6%
Simplified99.6%
Final simplification90.8%
(FPCore (x y) :precision binary64 (if (or (<= y -7e-11) (not (<= y 0.0042))) (- y) 1.0))
double code(double x, double y) {
double tmp;
if ((y <= -7e-11) || !(y <= 0.0042)) {
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 <= (-7d-11)) .or. (.not. (y <= 0.0042d0))) 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 <= -7e-11) || !(y <= 0.0042)) {
tmp = -y;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -7e-11) or not (y <= 0.0042): tmp = -y else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -7e-11) || !(y <= 0.0042)) tmp = Float64(-y); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -7e-11) || ~((y <= 0.0042))) tmp = -y; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -7e-11], N[Not[LessEqual[y, 0.0042]], $MachinePrecision]], (-y), 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{-11} \lor \neg \left(y \leq 0.0042\right):\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -7.00000000000000038e-11 or 0.00419999999999999974 < y Initial program 99.5%
+-commutative99.5%
remove-double-neg99.5%
unsub-neg99.5%
sub-neg99.5%
+-commutative99.5%
distribute-rgt-in99.5%
*-lft-identity99.5%
associate-+r-99.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 0 57.3%
neg-mul-157.3%
unsub-neg57.3%
Simplified57.3%
Taylor expanded in y around inf 56.1%
neg-mul-156.1%
Simplified56.1%
if -7.00000000000000038e-11 < y < 0.00419999999999999974Initial program 53.8%
+-commutative53.8%
remove-double-neg53.8%
unsub-neg53.8%
sub-neg53.8%
+-commutative53.8%
distribute-rgt-in53.9%
*-lft-identity53.9%
associate-+r-53.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 68.9%
Final simplification62.8%
(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 75.4%
+-commutative75.4%
remove-double-neg75.4%
unsub-neg75.4%
sub-neg75.4%
+-commutative75.4%
distribute-rgt-in75.4%
*-lft-identity75.4%
associate-+r-75.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%
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 75.4%
+-commutative75.4%
remove-double-neg75.4%
unsub-neg75.4%
sub-neg75.4%
+-commutative75.4%
distribute-rgt-in75.4%
*-lft-identity75.4%
associate-+r-75.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%
Taylor expanded in y around 0 37.6%
(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 2024169
(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))))