
(FPCore (x y z) :precision binary64 (+ (* (- 1.0 x) y) (* x z)))
double code(double x, double y, double z) {
return ((1.0 - x) * y) + (x * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((1.0d0 - x) * y) + (x * z)
end function
public static double code(double x, double y, double z) {
return ((1.0 - x) * y) + (x * z);
}
def code(x, y, z): return ((1.0 - x) * y) + (x * z)
function code(x, y, z) return Float64(Float64(Float64(1.0 - x) * y) + Float64(x * z)) end
function tmp = code(x, y, z) tmp = ((1.0 - x) * y) + (x * z); end
code[x_, y_, z_] := N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - x\right) \cdot y + x \cdot z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (* (- 1.0 x) y) (* x z)))
double code(double x, double y, double z) {
return ((1.0 - x) * y) + (x * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((1.0d0 - x) * y) + (x * z)
end function
public static double code(double x, double y, double z) {
return ((1.0 - x) * y) + (x * z);
}
def code(x, y, z): return ((1.0 - x) * y) + (x * z)
function code(x, y, z) return Float64(Float64(Float64(1.0 - x) * y) + Float64(x * z)) end
function tmp = code(x, y, z) tmp = ((1.0 - x) * y) + (x * z); end
code[x_, y_, z_] := N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - x\right) \cdot y + x \cdot z
\end{array}
(FPCore (x y z) :precision binary64 (+ y (* x (- z y))))
double code(double x, double y, double z) {
return y + (x * (z - y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y + (x * (z - y))
end function
public static double code(double x, double y, double z) {
return y + (x * (z - y));
}
def code(x, y, z): return y + (x * (z - y))
function code(x, y, z) return Float64(y + Float64(x * Float64(z - y))) end
function tmp = code(x, y, z) tmp = y + (x * (z - y)); end
code[x_, y_, z_] := N[(y + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + x \cdot \left(z - y\right)
\end{array}
Initial program 97.7%
remove-double-neg97.7%
distribute-rgt-neg-out97.7%
neg-sub097.7%
neg-sub097.7%
*-commutative97.7%
distribute-lft-neg-in97.7%
remove-double-neg97.7%
distribute-rgt-out--97.7%
*-lft-identity97.7%
associate-+l-97.7%
distribute-lft-out--100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (- x))))
(if (<= x -1.45e+55)
t_0
(if (<= x -1.4e-48)
(* x z)
(if (<= x 9.6e-95)
y
(if (or (<= x 1.15e+24)
(and (not (<= x 1.56e+68))
(or (<= x 8e+148)
(and (not (<= x 1.6e+282)) (<= x 1.95e+302)))))
(* x z)
t_0))))))
double code(double x, double y, double z) {
double t_0 = y * -x;
double tmp;
if (x <= -1.45e+55) {
tmp = t_0;
} else if (x <= -1.4e-48) {
tmp = x * z;
} else if (x <= 9.6e-95) {
tmp = y;
} else if ((x <= 1.15e+24) || (!(x <= 1.56e+68) && ((x <= 8e+148) || (!(x <= 1.6e+282) && (x <= 1.95e+302))))) {
tmp = x * z;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = y * -x
if (x <= (-1.45d+55)) then
tmp = t_0
else if (x <= (-1.4d-48)) then
tmp = x * z
else if (x <= 9.6d-95) then
tmp = y
else if ((x <= 1.15d+24) .or. (.not. (x <= 1.56d+68)) .and. (x <= 8d+148) .or. (.not. (x <= 1.6d+282)) .and. (x <= 1.95d+302)) then
tmp = x * z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * -x;
double tmp;
if (x <= -1.45e+55) {
tmp = t_0;
} else if (x <= -1.4e-48) {
tmp = x * z;
} else if (x <= 9.6e-95) {
tmp = y;
} else if ((x <= 1.15e+24) || (!(x <= 1.56e+68) && ((x <= 8e+148) || (!(x <= 1.6e+282) && (x <= 1.95e+302))))) {
tmp = x * z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y * -x tmp = 0 if x <= -1.45e+55: tmp = t_0 elif x <= -1.4e-48: tmp = x * z elif x <= 9.6e-95: tmp = y elif (x <= 1.15e+24) or (not (x <= 1.56e+68) and ((x <= 8e+148) or (not (x <= 1.6e+282) and (x <= 1.95e+302)))): tmp = x * z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(-x)) tmp = 0.0 if (x <= -1.45e+55) tmp = t_0; elseif (x <= -1.4e-48) tmp = Float64(x * z); elseif (x <= 9.6e-95) tmp = y; elseif ((x <= 1.15e+24) || (!(x <= 1.56e+68) && ((x <= 8e+148) || (!(x <= 1.6e+282) && (x <= 1.95e+302))))) tmp = Float64(x * z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * -x; tmp = 0.0; if (x <= -1.45e+55) tmp = t_0; elseif (x <= -1.4e-48) tmp = x * z; elseif (x <= 9.6e-95) tmp = y; elseif ((x <= 1.15e+24) || (~((x <= 1.56e+68)) && ((x <= 8e+148) || (~((x <= 1.6e+282)) && (x <= 1.95e+302))))) tmp = x * z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * (-x)), $MachinePrecision]}, If[LessEqual[x, -1.45e+55], t$95$0, If[LessEqual[x, -1.4e-48], N[(x * z), $MachinePrecision], If[LessEqual[x, 9.6e-95], y, If[Or[LessEqual[x, 1.15e+24], And[N[Not[LessEqual[x, 1.56e+68]], $MachinePrecision], Or[LessEqual[x, 8e+148], And[N[Not[LessEqual[x, 1.6e+282]], $MachinePrecision], LessEqual[x, 1.95e+302]]]]], N[(x * z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(-x\right)\\
\mathbf{if}\;x \leq -1.45 \cdot 10^{+55}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{-48}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{-95}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+24} \lor \neg \left(x \leq 1.56 \cdot 10^{+68}\right) \land \left(x \leq 8 \cdot 10^{+148} \lor \neg \left(x \leq 1.6 \cdot 10^{+282}\right) \land x \leq 1.95 \cdot 10^{+302}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.4499999999999999e55 or 1.15e24 < x < 1.56000000000000003e68 or 8.0000000000000004e148 < x < 1.6000000000000001e282 or 1.9500000000000002e302 < x Initial program 94.3%
remove-double-neg94.3%
distribute-rgt-neg-out94.3%
neg-sub094.3%
neg-sub094.3%
*-commutative94.3%
distribute-lft-neg-in94.3%
remove-double-neg94.3%
distribute-rgt-out--94.3%
*-lft-identity94.3%
associate-+l-94.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in y around inf 72.1%
Taylor expanded in x around inf 72.1%
associate-*r*72.1%
neg-mul-172.1%
*-commutative72.1%
Simplified72.1%
if -1.4499999999999999e55 < x < -1.40000000000000002e-48 or 9.6e-95 < x < 1.15e24 or 1.56000000000000003e68 < x < 8.0000000000000004e148 or 1.6000000000000001e282 < x < 1.9500000000000002e302Initial program 98.5%
remove-double-neg98.5%
distribute-rgt-neg-out98.5%
neg-sub098.5%
neg-sub098.5%
*-commutative98.5%
distribute-lft-neg-in98.5%
remove-double-neg98.5%
distribute-rgt-out--98.5%
*-lft-identity98.5%
associate-+l-98.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in y around 0 86.8%
mul-1-neg86.8%
distribute-rgt-neg-out86.8%
Simplified86.8%
Taylor expanded in y around 0 73.0%
if -1.40000000000000002e-48 < x < 9.6e-95Initial program 100.0%
remove-double-neg100.0%
distribute-rgt-neg-out100.0%
neg-sub0100.0%
neg-sub0100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
remove-double-neg100.0%
distribute-rgt-out--100.0%
*-lft-identity100.0%
associate-+l-100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in y around inf 83.2%
Taylor expanded in x around 0 83.2%
Final simplification76.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (- x))))
(if (<= x -6e+56)
t_0
(if (<= x 1.05e+25)
(+ y (* x z))
(if (or (<= x 3.4e+68)
(not
(or (<= x 2.7e+150)
(and (not (<= x 4.6e+281)) (<= x 3.5e+302)))))
t_0
(* x z))))))
double code(double x, double y, double z) {
double t_0 = y * -x;
double tmp;
if (x <= -6e+56) {
tmp = t_0;
} else if (x <= 1.05e+25) {
tmp = y + (x * z);
} else if ((x <= 3.4e+68) || !((x <= 2.7e+150) || (!(x <= 4.6e+281) && (x <= 3.5e+302)))) {
tmp = t_0;
} else {
tmp = x * z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = y * -x
if (x <= (-6d+56)) then
tmp = t_0
else if (x <= 1.05d+25) then
tmp = y + (x * z)
else if ((x <= 3.4d+68) .or. (.not. (x <= 2.7d+150) .or. (.not. (x <= 4.6d+281)) .and. (x <= 3.5d+302))) then
tmp = t_0
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * -x;
double tmp;
if (x <= -6e+56) {
tmp = t_0;
} else if (x <= 1.05e+25) {
tmp = y + (x * z);
} else if ((x <= 3.4e+68) || !((x <= 2.7e+150) || (!(x <= 4.6e+281) && (x <= 3.5e+302)))) {
tmp = t_0;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): t_0 = y * -x tmp = 0 if x <= -6e+56: tmp = t_0 elif x <= 1.05e+25: tmp = y + (x * z) elif (x <= 3.4e+68) or not ((x <= 2.7e+150) or (not (x <= 4.6e+281) and (x <= 3.5e+302))): tmp = t_0 else: tmp = x * z return tmp
function code(x, y, z) t_0 = Float64(y * Float64(-x)) tmp = 0.0 if (x <= -6e+56) tmp = t_0; elseif (x <= 1.05e+25) tmp = Float64(y + Float64(x * z)); elseif ((x <= 3.4e+68) || !((x <= 2.7e+150) || (!(x <= 4.6e+281) && (x <= 3.5e+302)))) tmp = t_0; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * -x; tmp = 0.0; if (x <= -6e+56) tmp = t_0; elseif (x <= 1.05e+25) tmp = y + (x * z); elseif ((x <= 3.4e+68) || ~(((x <= 2.7e+150) || (~((x <= 4.6e+281)) && (x <= 3.5e+302))))) tmp = t_0; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * (-x)), $MachinePrecision]}, If[LessEqual[x, -6e+56], t$95$0, If[LessEqual[x, 1.05e+25], N[(y + N[(x * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 3.4e+68], N[Not[Or[LessEqual[x, 2.7e+150], And[N[Not[LessEqual[x, 4.6e+281]], $MachinePrecision], LessEqual[x, 3.5e+302]]]], $MachinePrecision]], t$95$0, N[(x * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(-x\right)\\
\mathbf{if}\;x \leq -6 \cdot 10^{+56}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+25}:\\
\;\;\;\;y + x \cdot z\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{+68} \lor \neg \left(x \leq 2.7 \cdot 10^{+150} \lor \neg \left(x \leq 4.6 \cdot 10^{+281}\right) \land x \leq 3.5 \cdot 10^{+302}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if x < -6.00000000000000012e56 or 1.05e25 < x < 3.40000000000000015e68 or 2.70000000000000008e150 < x < 4.60000000000000015e281 or 3.4999999999999997e302 < x Initial program 94.3%
remove-double-neg94.3%
distribute-rgt-neg-out94.3%
neg-sub094.3%
neg-sub094.3%
*-commutative94.3%
distribute-lft-neg-in94.3%
remove-double-neg94.3%
distribute-rgt-out--94.3%
*-lft-identity94.3%
associate-+l-94.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in y around inf 72.1%
Taylor expanded in x around inf 72.1%
associate-*r*72.1%
neg-mul-172.1%
*-commutative72.1%
Simplified72.1%
if -6.00000000000000012e56 < x < 1.05e25Initial program 100.0%
remove-double-neg100.0%
distribute-rgt-neg-out100.0%
neg-sub0100.0%
neg-sub0100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
remove-double-neg100.0%
distribute-rgt-out--100.0%
*-lft-identity100.0%
associate-+l-100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in y around 0 96.8%
mul-1-neg96.8%
distribute-rgt-neg-out96.8%
Simplified96.8%
sub-neg96.8%
+-commutative96.8%
distribute-rgt-neg-out96.8%
remove-double-neg96.8%
Applied egg-rr96.8%
if 3.40000000000000015e68 < x < 2.70000000000000008e150 or 4.60000000000000015e281 < x < 3.4999999999999997e302Initial program 95.4%
remove-double-neg95.4%
distribute-rgt-neg-out95.4%
neg-sub095.4%
neg-sub095.4%
*-commutative95.4%
distribute-lft-neg-in95.4%
remove-double-neg95.4%
distribute-rgt-out--95.4%
*-lft-identity95.4%
associate-+l-95.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in y around 0 81.1%
mul-1-neg81.1%
distribute-rgt-neg-out81.1%
Simplified81.1%
Taylor expanded in y around 0 81.2%
Final simplification87.1%
(FPCore (x y z)
:precision binary64
(if (or (<= z -8e+35)
(not (or (<= z -3.3e-59) (and (not (<= z -3.2e-122)) (<= z 4e+47)))))
(+ y (* x z))
(- y (* y x))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8e+35) || !((z <= -3.3e-59) || (!(z <= -3.2e-122) && (z <= 4e+47)))) {
tmp = y + (x * z);
} else {
tmp = y - (y * x);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-8d+35)) .or. (.not. (z <= (-3.3d-59)) .or. (.not. (z <= (-3.2d-122))) .and. (z <= 4d+47))) then
tmp = y + (x * z)
else
tmp = y - (y * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -8e+35) || !((z <= -3.3e-59) || (!(z <= -3.2e-122) && (z <= 4e+47)))) {
tmp = y + (x * z);
} else {
tmp = y - (y * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8e+35) or not ((z <= -3.3e-59) or (not (z <= -3.2e-122) and (z <= 4e+47))): tmp = y + (x * z) else: tmp = y - (y * x) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8e+35) || !((z <= -3.3e-59) || (!(z <= -3.2e-122) && (z <= 4e+47)))) tmp = Float64(y + Float64(x * z)); else tmp = Float64(y - Float64(y * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -8e+35) || ~(((z <= -3.3e-59) || (~((z <= -3.2e-122)) && (z <= 4e+47))))) tmp = y + (x * z); else tmp = y - (y * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8e+35], N[Not[Or[LessEqual[z, -3.3e-59], And[N[Not[LessEqual[z, -3.2e-122]], $MachinePrecision], LessEqual[z, 4e+47]]]], $MachinePrecision]], N[(y + N[(x * z), $MachinePrecision]), $MachinePrecision], N[(y - N[(y * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+35} \lor \neg \left(z \leq -3.3 \cdot 10^{-59} \lor \neg \left(z \leq -3.2 \cdot 10^{-122}\right) \land z \leq 4 \cdot 10^{+47}\right):\\
\;\;\;\;y + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y - y \cdot x\\
\end{array}
\end{array}
if z < -7.9999999999999997e35 or -3.29999999999999982e-59 < z < -3.2000000000000002e-122 or 4.0000000000000002e47 < z Initial program 94.9%
remove-double-neg94.9%
distribute-rgt-neg-out94.9%
neg-sub094.9%
neg-sub094.9%
*-commutative94.9%
distribute-lft-neg-in94.9%
remove-double-neg94.9%
distribute-rgt-out--94.9%
*-lft-identity94.9%
associate-+l-94.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in y around 0 93.5%
mul-1-neg93.5%
distribute-rgt-neg-out93.5%
Simplified93.5%
sub-neg93.5%
+-commutative93.5%
distribute-rgt-neg-out93.5%
remove-double-neg93.5%
Applied egg-rr93.5%
if -7.9999999999999997e35 < z < -3.29999999999999982e-59 or -3.2000000000000002e-122 < z < 4.0000000000000002e47Initial program 100.0%
remove-double-neg100.0%
distribute-rgt-neg-out100.0%
neg-sub0100.0%
neg-sub0100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
remove-double-neg100.0%
distribute-rgt-out--100.0%
*-lft-identity100.0%
associate-+l-100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in y around inf 91.7%
Final simplification92.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.6e-42) (not (<= x 9.6e-95))) (* x z) y))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.6e-42) || !(x <= 9.6e-95)) {
tmp = x * z;
} else {
tmp = y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-1.6d-42)) .or. (.not. (x <= 9.6d-95))) then
tmp = x * z
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.6e-42) || !(x <= 9.6e-95)) {
tmp = x * z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.6e-42) or not (x <= 9.6e-95): tmp = x * z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.6e-42) || !(x <= 9.6e-95)) tmp = Float64(x * z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.6e-42) || ~((x <= 9.6e-95))) tmp = x * z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.6e-42], N[Not[LessEqual[x, 9.6e-95]], $MachinePrecision]], N[(x * z), $MachinePrecision], y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-42} \lor \neg \left(x \leq 9.6 \cdot 10^{-95}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if x < -1.60000000000000012e-42 or 9.6e-95 < x Initial program 96.1%
remove-double-neg96.1%
distribute-rgt-neg-out96.1%
neg-sub096.1%
neg-sub096.1%
*-commutative96.1%
distribute-lft-neg-in96.1%
remove-double-neg96.1%
distribute-rgt-out--96.1%
*-lft-identity96.1%
associate-+l-96.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in y around 0 57.3%
mul-1-neg57.3%
distribute-rgt-neg-out57.3%
Simplified57.3%
Taylor expanded in y around 0 51.2%
if -1.60000000000000012e-42 < x < 9.6e-95Initial program 100.0%
remove-double-neg100.0%
distribute-rgt-neg-out100.0%
neg-sub0100.0%
neg-sub0100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
remove-double-neg100.0%
distribute-rgt-out--100.0%
*-lft-identity100.0%
associate-+l-100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in y around inf 83.2%
Taylor expanded in x around 0 83.2%
Final simplification64.0%
(FPCore (x y z) :precision binary64 y)
double code(double x, double y, double z) {
return y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y
end function
public static double code(double x, double y, double z) {
return y;
}
def code(x, y, z): return y
function code(x, y, z) return y end
function tmp = code(x, y, z) tmp = y; end
code[x_, y_, z_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 97.7%
remove-double-neg97.7%
distribute-rgt-neg-out97.7%
neg-sub097.7%
neg-sub097.7%
*-commutative97.7%
distribute-lft-neg-in97.7%
remove-double-neg97.7%
distribute-rgt-out--97.7%
*-lft-identity97.7%
associate-+l-97.7%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in y around inf 65.1%
Taylor expanded in x around 0 38.4%
Final simplification38.4%
(FPCore (x y z) :precision binary64 (- y (* x (- y z))))
double code(double x, double y, double z) {
return y - (x * (y - z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y - (x * (y - z))
end function
public static double code(double x, double y, double z) {
return y - (x * (y - z));
}
def code(x, y, z): return y - (x * (y - z))
function code(x, y, z) return Float64(y - Float64(x * Float64(y - z))) end
function tmp = code(x, y, z) tmp = y - (x * (y - z)); end
code[x_, y_, z_] := N[(y - N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y - x \cdot \left(y - z\right)
\end{array}
herbie shell --seed 2024089
(FPCore (x y z)
:name "Diagrams.Color.HSV:lerp from diagrams-contrib-1.3.0.5"
:precision binary64
:alt
(- y (* x (- y z)))
(+ (* (- 1.0 x) y) (* x z)))