
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
return (x + (y * (z - 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 = (x + (y * (z - x))) / z
end function
public static double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
def code(x, y, z): return (x + (y * (z - x))) / z
function code(x, y, z) return Float64(Float64(x + Float64(y * Float64(z - x))) / z) end
function tmp = code(x, y, z) tmp = (x + (y * (z - x))) / z; end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
return (x + (y * (z - 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 = (x + (y * (z - x))) / z
end function
public static double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
def code(x, y, z): return (x + (y * (z - x))) / z
function code(x, y, z) return Float64(Float64(x + Float64(y * Float64(z - x))) / z) end
function tmp = code(x, y, z) tmp = (x + (y * (z - x))) / z; end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (- y (* (/ x z) (+ y -1.0))))
double code(double x, double y, double z) {
return y - ((x / z) * (y + -1.0));
}
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 + (-1.0d0)))
end function
public static double code(double x, double y, double z) {
return y - ((x / z) * (y + -1.0));
}
def code(x, y, z): return y - ((x / z) * (y + -1.0))
function code(x, y, z) return Float64(y - Float64(Float64(x / z) * Float64(y + -1.0))) end
function tmp = code(x, y, z) tmp = y - ((x / z) * (y + -1.0)); end
code[x_, y_, z_] := N[(y - N[(N[(x / z), $MachinePrecision] * N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y - \frac{x}{z} \cdot \left(y + -1\right)
\end{array}
Initial program 89.3%
Taylor expanded in x around -inf 95.9%
mul-1-neg95.9%
unsub-neg95.9%
associate-/l*95.6%
associate-/r/99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ y (/ (- z) x))) (t_1 (+ y (/ x z))))
(if (<= y -6.8e+174)
t_0
(if (<= y -2.5e+46)
t_1
(if (<= y -2.9e+20)
t_0
(if (<= y 220.0)
t_1
(if (<= y 2e+106)
t_0
(if (<= y 1.04e+136)
(/ z (/ z y))
(if (<= y 1.85e+195) t_0 y)))))))))
double code(double x, double y, double z) {
double t_0 = y / (-z / x);
double t_1 = y + (x / z);
double tmp;
if (y <= -6.8e+174) {
tmp = t_0;
} else if (y <= -2.5e+46) {
tmp = t_1;
} else if (y <= -2.9e+20) {
tmp = t_0;
} else if (y <= 220.0) {
tmp = t_1;
} else if (y <= 2e+106) {
tmp = t_0;
} else if (y <= 1.04e+136) {
tmp = z / (z / y);
} else if (y <= 1.85e+195) {
tmp = t_0;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y / (-z / x)
t_1 = y + (x / z)
if (y <= (-6.8d+174)) then
tmp = t_0
else if (y <= (-2.5d+46)) then
tmp = t_1
else if (y <= (-2.9d+20)) then
tmp = t_0
else if (y <= 220.0d0) then
tmp = t_1
else if (y <= 2d+106) then
tmp = t_0
else if (y <= 1.04d+136) then
tmp = z / (z / y)
else if (y <= 1.85d+195) then
tmp = t_0
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y / (-z / x);
double t_1 = y + (x / z);
double tmp;
if (y <= -6.8e+174) {
tmp = t_0;
} else if (y <= -2.5e+46) {
tmp = t_1;
} else if (y <= -2.9e+20) {
tmp = t_0;
} else if (y <= 220.0) {
tmp = t_1;
} else if (y <= 2e+106) {
tmp = t_0;
} else if (y <= 1.04e+136) {
tmp = z / (z / y);
} else if (y <= 1.85e+195) {
tmp = t_0;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): t_0 = y / (-z / x) t_1 = y + (x / z) tmp = 0 if y <= -6.8e+174: tmp = t_0 elif y <= -2.5e+46: tmp = t_1 elif y <= -2.9e+20: tmp = t_0 elif y <= 220.0: tmp = t_1 elif y <= 2e+106: tmp = t_0 elif y <= 1.04e+136: tmp = z / (z / y) elif y <= 1.85e+195: tmp = t_0 else: tmp = y return tmp
function code(x, y, z) t_0 = Float64(y / Float64(Float64(-z) / x)) t_1 = Float64(y + Float64(x / z)) tmp = 0.0 if (y <= -6.8e+174) tmp = t_0; elseif (y <= -2.5e+46) tmp = t_1; elseif (y <= -2.9e+20) tmp = t_0; elseif (y <= 220.0) tmp = t_1; elseif (y <= 2e+106) tmp = t_0; elseif (y <= 1.04e+136) tmp = Float64(z / Float64(z / y)); elseif (y <= 1.85e+195) tmp = t_0; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y / (-z / x); t_1 = y + (x / z); tmp = 0.0; if (y <= -6.8e+174) tmp = t_0; elseif (y <= -2.5e+46) tmp = t_1; elseif (y <= -2.9e+20) tmp = t_0; elseif (y <= 220.0) tmp = t_1; elseif (y <= 2e+106) tmp = t_0; elseif (y <= 1.04e+136) tmp = z / (z / y); elseif (y <= 1.85e+195) tmp = t_0; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[((-z) / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.8e+174], t$95$0, If[LessEqual[y, -2.5e+46], t$95$1, If[LessEqual[y, -2.9e+20], t$95$0, If[LessEqual[y, 220.0], t$95$1, If[LessEqual[y, 2e+106], t$95$0, If[LessEqual[y, 1.04e+136], N[(z / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.85e+195], t$95$0, y]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{\frac{-z}{x}}\\
t_1 := y + \frac{x}{z}\\
\mathbf{if}\;y \leq -6.8 \cdot 10^{+174}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -2.5 \cdot 10^{+46}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.9 \cdot 10^{+20}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 220:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+106}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.04 \cdot 10^{+136}:\\
\;\;\;\;\frac{z}{\frac{z}{y}}\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+195}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -6.8000000000000002e174 or -2.5000000000000001e46 < y < -2.9e20 or 220 < y < 2.00000000000000018e106 or 1.04e136 < y < 1.85e195Initial program 86.0%
Taylor expanded in y around inf 84.1%
associate-/l*98.0%
Simplified98.0%
Taylor expanded in z around 0 76.7%
associate-*r/76.7%
neg-mul-176.7%
Simplified76.7%
if -6.8000000000000002e174 < y < -2.5000000000000001e46 or -2.9e20 < y < 220Initial program 96.1%
Taylor expanded in x around -inf 99.4%
mul-1-neg99.4%
unsub-neg99.4%
associate-/l*98.7%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 96.4%
mul-1-neg96.4%
distribute-frac-neg96.4%
Simplified96.4%
Taylor expanded in y around 0 96.4%
+-commutative96.4%
Simplified96.4%
if 2.00000000000000018e106 < y < 1.04e136Initial program 87.6%
Taylor expanded in x around 0 63.7%
associate-/l*76.1%
associate-/r/76.0%
Applied egg-rr76.0%
*-commutative76.0%
clear-num75.9%
un-div-inv84.0%
Applied egg-rr84.0%
if 1.85e195 < y Initial program 54.2%
Taylor expanded in x around 0 62.0%
Final simplification87.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (- x) (/ z y))))
(if (<= y -3.5e+174)
t_0
(if (<= y 170.0)
(+ y (/ x z))
(if (<= y 2.4e+106)
t_0
(if (<= y 1.08e+136) (/ z (/ z y)) (if (<= y 6e+195) t_0 y)))))))
double code(double x, double y, double z) {
double t_0 = -x / (z / y);
double tmp;
if (y <= -3.5e+174) {
tmp = t_0;
} else if (y <= 170.0) {
tmp = y + (x / z);
} else if (y <= 2.4e+106) {
tmp = t_0;
} else if (y <= 1.08e+136) {
tmp = z / (z / y);
} else if (y <= 6e+195) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = -x / (z / y)
if (y <= (-3.5d+174)) then
tmp = t_0
else if (y <= 170.0d0) then
tmp = y + (x / z)
else if (y <= 2.4d+106) then
tmp = t_0
else if (y <= 1.08d+136) then
tmp = z / (z / y)
else if (y <= 6d+195) then
tmp = t_0
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -x / (z / y);
double tmp;
if (y <= -3.5e+174) {
tmp = t_0;
} else if (y <= 170.0) {
tmp = y + (x / z);
} else if (y <= 2.4e+106) {
tmp = t_0;
} else if (y <= 1.08e+136) {
tmp = z / (z / y);
} else if (y <= 6e+195) {
tmp = t_0;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): t_0 = -x / (z / y) tmp = 0 if y <= -3.5e+174: tmp = t_0 elif y <= 170.0: tmp = y + (x / z) elif y <= 2.4e+106: tmp = t_0 elif y <= 1.08e+136: tmp = z / (z / y) elif y <= 6e+195: tmp = t_0 else: tmp = y return tmp
function code(x, y, z) t_0 = Float64(Float64(-x) / Float64(z / y)) tmp = 0.0 if (y <= -3.5e+174) tmp = t_0; elseif (y <= 170.0) tmp = Float64(y + Float64(x / z)); elseif (y <= 2.4e+106) tmp = t_0; elseif (y <= 1.08e+136) tmp = Float64(z / Float64(z / y)); elseif (y <= 6e+195) tmp = t_0; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -x / (z / y); tmp = 0.0; if (y <= -3.5e+174) tmp = t_0; elseif (y <= 170.0) tmp = y + (x / z); elseif (y <= 2.4e+106) tmp = t_0; elseif (y <= 1.08e+136) tmp = z / (z / y); elseif (y <= 6e+195) tmp = t_0; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[((-x) / N[(z / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.5e+174], t$95$0, If[LessEqual[y, 170.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.4e+106], t$95$0, If[LessEqual[y, 1.08e+136], N[(z / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e+195], t$95$0, y]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\frac{z}{y}}\\
\mathbf{if}\;y \leq -3.5 \cdot 10^{+174}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 170:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+106}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.08 \cdot 10^{+136}:\\
\;\;\;\;\frac{z}{\frac{z}{y}}\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+195}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -3.5000000000000001e174 or 170 < y < 2.4000000000000001e106 or 1.07999999999999994e136 < y < 6.0000000000000001e195Initial program 83.9%
Taylor expanded in y around inf 81.8%
associate-/l*97.7%
Simplified97.7%
Taylor expanded in z around 0 71.1%
mul-1-neg71.1%
associate-/l*69.2%
Simplified69.2%
if -3.5000000000000001e174 < y < 170Initial program 96.3%
Taylor expanded in x around -inf 99.4%
mul-1-neg99.4%
unsub-neg99.4%
associate-/l*98.2%
associate-/r/99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 92.6%
mul-1-neg92.6%
distribute-frac-neg92.6%
Simplified92.6%
Taylor expanded in y around 0 92.6%
+-commutative92.6%
Simplified92.6%
if 2.4000000000000001e106 < y < 1.07999999999999994e136Initial program 87.6%
Taylor expanded in x around 0 63.7%
associate-/l*76.1%
associate-/r/76.0%
Applied egg-rr76.0%
*-commutative76.0%
clear-num75.9%
un-div-inv84.0%
Applied egg-rr84.0%
if 6.0000000000000001e195 < y Initial program 54.2%
Taylor expanded in x around 0 62.0%
Final simplification83.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.00023))) (* y (- 1.0 (/ x z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 0.00023)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + (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) :: tmp
if ((y <= (-1.0d0)) .or. (.not. (y <= 0.00023d0))) then
tmp = y * (1.0d0 - (x / z))
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 0.00023)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.0) or not (y <= 0.00023): tmp = y * (1.0 - (x / z)) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.00023)) tmp = Float64(y * Float64(1.0 - Float64(x / z))); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.0) || ~((y <= 0.00023))) tmp = y * (1.0 - (x / z)); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 0.00023]], $MachinePrecision]], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.00023\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1 or 2.3000000000000001e-4 < y Initial program 79.4%
Taylor expanded in y around inf 78.4%
associate-/l*98.9%
Simplified98.9%
clear-num98.7%
associate-/r/98.8%
clear-num98.8%
div-sub98.8%
*-inverses98.8%
Applied egg-rr98.8%
if -1 < y < 2.3000000000000001e-4Initial program 99.9%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
associate-/l*100.0%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
distribute-frac-neg99.3%
Simplified99.3%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
Simplified99.3%
Final simplification99.0%
(FPCore (x y z) :precision binary64 (if (<= y -1.0) (/ y (/ z (- z x))) (if (<= y 0.00023) (+ y (/ x z)) (* y (- 1.0 (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.0) {
tmp = y / (z / (z - x));
} else if (y <= 0.00023) {
tmp = y + (x / z);
} else {
tmp = y * (1.0 - (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) :: tmp
if (y <= (-1.0d0)) then
tmp = y / (z / (z - x))
else if (y <= 0.00023d0) then
tmp = y + (x / z)
else
tmp = y * (1.0d0 - (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.0) {
tmp = y / (z / (z - x));
} else if (y <= 0.00023) {
tmp = y + (x / z);
} else {
tmp = y * (1.0 - (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.0: tmp = y / (z / (z - x)) elif y <= 0.00023: tmp = y + (x / z) else: tmp = y * (1.0 - (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.0) tmp = Float64(y / Float64(z / Float64(z - x))); elseif (y <= 0.00023) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y * Float64(1.0 - Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.0) tmp = y / (z / (z - x)); elseif (y <= 0.00023) tmp = y + (x / z); else tmp = y * (1.0 - (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.0], N[(y / N[(z / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.00023], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;\frac{y}{\frac{z}{z - x}}\\
\mathbf{elif}\;y \leq 0.00023:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\end{array}
\end{array}
if y < -1Initial program 83.1%
Taylor expanded in y around inf 83.1%
associate-/l*99.9%
Simplified99.9%
if -1 < y < 2.3000000000000001e-4Initial program 99.9%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
associate-/l*100.0%
associate-/r/100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
distribute-frac-neg99.3%
Simplified99.3%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
Simplified99.3%
if 2.3000000000000001e-4 < y Initial program 76.2%
Taylor expanded in y around inf 74.3%
associate-/l*97.9%
Simplified97.9%
clear-num97.7%
associate-/r/97.9%
clear-num98.0%
div-sub98.0%
*-inverses98.0%
Applied egg-rr98.0%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (<= y -4e-103) y (if (<= y 3.8e-11) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -4e-103) {
tmp = y;
} else if (y <= 3.8e-11) {
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 (y <= (-4d-103)) then
tmp = y
else if (y <= 3.8d-11) 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 (y <= -4e-103) {
tmp = y;
} else if (y <= 3.8e-11) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4e-103: tmp = y elif y <= 3.8e-11: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4e-103) tmp = y; elseif (y <= 3.8e-11) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4e-103) tmp = y; elseif (y <= 3.8e-11) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4e-103], y, If[LessEqual[y, 3.8e-11], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-103}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -3.99999999999999983e-103 or 3.7999999999999998e-11 < y Initial program 81.7%
Taylor expanded in x around 0 44.5%
if -3.99999999999999983e-103 < y < 3.7999999999999998e-11Initial program 99.9%
Taylor expanded in y around 0 78.5%
Final simplification58.6%
(FPCore (x y z) :precision binary64 (if (<= y -8.6e-34) (* z (/ y z)) (if (<= y 3.6e-9) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -8.6e-34) {
tmp = z * (y / z);
} else if (y <= 3.6e-9) {
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 (y <= (-8.6d-34)) then
tmp = z * (y / z)
else if (y <= 3.6d-9) 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 (y <= -8.6e-34) {
tmp = z * (y / z);
} else if (y <= 3.6e-9) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -8.6e-34: tmp = z * (y / z) elif y <= 3.6e-9: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -8.6e-34) tmp = Float64(z * Float64(y / z)); elseif (y <= 3.6e-9) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -8.6e-34) tmp = z * (y / z); elseif (y <= 3.6e-9) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -8.6e-34], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.6e-9], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.6 \cdot 10^{-34}:\\
\;\;\;\;z \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -8.5999999999999999e-34Initial program 84.8%
Taylor expanded in x around 0 33.7%
associate-/l*46.1%
associate-/r/58.1%
Applied egg-rr58.1%
if -8.5999999999999999e-34 < y < 3.6e-9Initial program 99.9%
Taylor expanded in y around 0 75.6%
if 3.6e-9 < y Initial program 76.2%
Taylor expanded in x around 0 41.8%
Final simplification61.5%
(FPCore (x y z) :precision binary64 (if (<= y -5.9e+147) (* z (/ y z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.9e+147) {
tmp = z * (y / z);
} else {
tmp = y + (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) :: tmp
if (y <= (-5.9d+147)) then
tmp = z * (y / z)
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.9e+147) {
tmp = z * (y / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.9e+147: tmp = z * (y / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.9e+147) tmp = Float64(z * Float64(y / z)); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.9e+147) tmp = z * (y / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.9e+147], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.9 \cdot 10^{+147}:\\
\;\;\;\;z \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -5.9000000000000001e147Initial program 78.2%
Taylor expanded in x around 0 18.7%
associate-/l*34.3%
associate-/r/55.5%
Applied egg-rr55.5%
if -5.9000000000000001e147 < y Initial program 90.7%
Taylor expanded in x around -inf 96.6%
mul-1-neg96.6%
unsub-neg96.6%
associate-/l*97.5%
associate-/r/99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 77.0%
mul-1-neg77.0%
distribute-frac-neg77.0%
Simplified77.0%
Taylor expanded in y around 0 77.0%
+-commutative77.0%
Simplified77.0%
Final simplification74.5%
(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 89.3%
Taylor expanded in x around 0 36.1%
Final simplification36.1%
(FPCore (x y z) :precision binary64 (- (+ y (/ x z)) (/ y (/ z x))))
double code(double x, double y, double z) {
return (y + (x / z)) - (y / (z / x));
}
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 / (z / x))
end function
public static double code(double x, double y, double z) {
return (y + (x / z)) - (y / (z / x));
}
def code(x, y, z): return (y + (x / z)) - (y / (z / x))
function code(x, y, z) return Float64(Float64(y + Float64(x / z)) - Float64(y / Float64(z / x))) end
function tmp = code(x, y, z) tmp = (y + (x / z)) - (y / (z / x)); end
code[x_, y_, z_] := N[(N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision] - N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y + \frac{x}{z}\right) - \frac{y}{\frac{z}{x}}
\end{array}
herbie shell --seed 2024029
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
:precision binary64
:herbie-target
(- (+ y (/ x z)) (/ y (/ z x)))
(/ (+ x (* y (- z x))) z))