
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x - (y * z)) / (t - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x - (y * z)) / (t - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.75e+135) (not (<= z 8.2e+139))) (/ (- y (/ x z)) a) (/ (- x (* z y)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.75e+135) || !(z <= 8.2e+139)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-2.75d+135)) .or. (.not. (z <= 8.2d+139))) then
tmp = (y - (x / z)) / a
else
tmp = (x - (z * y)) / (t - (z * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.75e+135) || !(z <= 8.2e+139)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.75e+135) or not (z <= 8.2e+139): tmp = (y - (x / z)) / a else: tmp = (x - (z * y)) / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.75e+135) || !(z <= 8.2e+139)) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = Float64(Float64(x - Float64(z * y)) / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.75e+135) || ~((z <= 8.2e+139))) tmp = (y - (x / z)) / a; else tmp = (x - (z * y)) / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.75e+135], N[Not[LessEqual[z, 8.2e+139]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.75 \cdot 10^{+135} \lor \neg \left(z \leq 8.2 \cdot 10^{+139}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -2.7499999999999999e135 or 8.2000000000000004e139 < z Initial program 55.5%
*-commutative55.5%
Simplified55.5%
Taylor expanded in x around 0 55.5%
*-commutative55.5%
*-commutative55.5%
*-un-lft-identity55.5%
times-frac63.5%
Applied egg-rr63.5%
/-rgt-identity63.5%
Simplified63.5%
Taylor expanded in a around inf 88.9%
mul-1-neg88.9%
unsub-neg88.9%
Simplified88.9%
if -2.7499999999999999e135 < z < 8.2000000000000004e139Initial program 97.7%
Final simplification95.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ x (- t (* z a)))))
(if (<= z -5e+138)
(/ y a)
(if (<= z 7.8e-163)
t_1
(if (<= z 0.00285)
(/ (- x (* z y)) t)
(if (<= z 5e+122) t_1 (/ y a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x / (t - (z * a));
double tmp;
if (z <= -5e+138) {
tmp = y / a;
} else if (z <= 7.8e-163) {
tmp = t_1;
} else if (z <= 0.00285) {
tmp = (x - (z * y)) / t;
} else if (z <= 5e+122) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x / (t - (z * a))
if (z <= (-5d+138)) then
tmp = y / a
else if (z <= 7.8d-163) then
tmp = t_1
else if (z <= 0.00285d0) then
tmp = (x - (z * y)) / t
else if (z <= 5d+122) then
tmp = t_1
else
tmp = y / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x / (t - (z * a));
double tmp;
if (z <= -5e+138) {
tmp = y / a;
} else if (z <= 7.8e-163) {
tmp = t_1;
} else if (z <= 0.00285) {
tmp = (x - (z * y)) / t;
} else if (z <= 5e+122) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x / (t - (z * a)) tmp = 0 if z <= -5e+138: tmp = y / a elif z <= 7.8e-163: tmp = t_1 elif z <= 0.00285: tmp = (x - (z * y)) / t elif z <= 5e+122: tmp = t_1 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(x / Float64(t - Float64(z * a))) tmp = 0.0 if (z <= -5e+138) tmp = Float64(y / a); elseif (z <= 7.8e-163) tmp = t_1; elseif (z <= 0.00285) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 5e+122) tmp = t_1; else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x / (t - (z * a)); tmp = 0.0; if (z <= -5e+138) tmp = y / a; elseif (z <= 7.8e-163) tmp = t_1; elseif (z <= 0.00285) tmp = (x - (z * y)) / t; elseif (z <= 5e+122) tmp = t_1; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5e+138], N[(y / a), $MachinePrecision], If[LessEqual[z, 7.8e-163], t$95$1, If[LessEqual[z, 0.00285], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 5e+122], t$95$1, N[(y / a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{t - z \cdot a}\\
\mathbf{if}\;z \leq -5 \cdot 10^{+138}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{-163}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.00285:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -5.00000000000000016e138 or 4.99999999999999989e122 < z Initial program 57.2%
*-commutative57.2%
Simplified57.2%
Taylor expanded in z around inf 67.7%
if -5.00000000000000016e138 < z < 7.8000000000000004e-163 or 0.0028500000000000001 < z < 4.99999999999999989e122Initial program 97.0%
*-commutative97.0%
Simplified97.0%
Taylor expanded in x around inf 72.5%
*-commutative72.5%
Simplified72.5%
if 7.8000000000000004e-163 < z < 0.0028500000000000001Initial program 99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in t around inf 76.4%
Final simplification71.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)))
(if (<= z -4.3e+52)
t_1
(if (<= z 7.2e-163)
(/ x (- t (* z a)))
(if (<= z 4.5e+29) (- (/ x t) (/ (* z y) t)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -4.3e+52) {
tmp = t_1;
} else if (z <= 7.2e-163) {
tmp = x / (t - (z * a));
} else if (z <= 4.5e+29) {
tmp = (x / t) - ((z * y) / t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (y - (x / z)) / a
if (z <= (-4.3d+52)) then
tmp = t_1
else if (z <= 7.2d-163) then
tmp = x / (t - (z * a))
else if (z <= 4.5d+29) then
tmp = (x / t) - ((z * y) / t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -4.3e+52) {
tmp = t_1;
} else if (z <= 7.2e-163) {
tmp = x / (t - (z * a));
} else if (z <= 4.5e+29) {
tmp = (x / t) - ((z * y) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a tmp = 0 if z <= -4.3e+52: tmp = t_1 elif z <= 7.2e-163: tmp = x / (t - (z * a)) elif z <= 4.5e+29: tmp = (x / t) - ((z * y) / t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - Float64(x / z)) / a) tmp = 0.0 if (z <= -4.3e+52) tmp = t_1; elseif (z <= 7.2e-163) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 4.5e+29) tmp = Float64(Float64(x / t) - Float64(Float64(z * y) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - (x / z)) / a; tmp = 0.0; if (z <= -4.3e+52) tmp = t_1; elseif (z <= 7.2e-163) tmp = x / (t - (z * a)); elseif (z <= 4.5e+29) tmp = (x / t) - ((z * y) / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -4.3e+52], t$95$1, If[LessEqual[z, 7.2e-163], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e+29], N[(N[(x / t), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -4.3 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-163}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+29}:\\
\;\;\;\;\frac{x}{t} - \frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.3e52 or 4.5000000000000002e29 < z Initial program 66.2%
*-commutative66.2%
Simplified66.2%
Taylor expanded in x around 0 66.3%
*-commutative66.3%
*-commutative66.3%
*-un-lft-identity66.3%
times-frac71.9%
Applied egg-rr71.9%
/-rgt-identity71.9%
Simplified71.9%
Taylor expanded in a around inf 79.9%
mul-1-neg79.9%
unsub-neg79.9%
Simplified79.9%
if -4.3e52 < z < 7.1999999999999996e-163Initial program 99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in x around inf 74.8%
*-commutative74.8%
Simplified74.8%
if 7.1999999999999996e-163 < z < 4.5000000000000002e29Initial program 99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in x around 0 99.6%
*-commutative99.6%
*-commutative99.6%
*-un-lft-identity99.6%
times-frac91.1%
Applied egg-rr91.1%
/-rgt-identity91.1%
Simplified91.1%
+-commutative91.1%
mul-1-neg91.1%
unsub-neg91.1%
*-commutative91.1%
clear-num91.0%
un-div-inv91.6%
Applied egg-rr91.6%
Taylor expanded in a around 0 75.9%
Final simplification77.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)))
(if (<= z -3.9e+52)
t_1
(if (<= z 1.08e-162)
(/ x (- t (* z a)))
(if (<= z 3.9e+27) (/ (- x (* z y)) t) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -3.9e+52) {
tmp = t_1;
} else if (z <= 1.08e-162) {
tmp = x / (t - (z * a));
} else if (z <= 3.9e+27) {
tmp = (x - (z * y)) / t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (y - (x / z)) / a
if (z <= (-3.9d+52)) then
tmp = t_1
else if (z <= 1.08d-162) then
tmp = x / (t - (z * a))
else if (z <= 3.9d+27) then
tmp = (x - (z * y)) / t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double tmp;
if (z <= -3.9e+52) {
tmp = t_1;
} else if (z <= 1.08e-162) {
tmp = x / (t - (z * a));
} else if (z <= 3.9e+27) {
tmp = (x - (z * y)) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a tmp = 0 if z <= -3.9e+52: tmp = t_1 elif z <= 1.08e-162: tmp = x / (t - (z * a)) elif z <= 3.9e+27: tmp = (x - (z * y)) / t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - Float64(x / z)) / a) tmp = 0.0 if (z <= -3.9e+52) tmp = t_1; elseif (z <= 1.08e-162) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 3.9e+27) tmp = Float64(Float64(x - Float64(z * y)) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - (x / z)) / a; tmp = 0.0; if (z <= -3.9e+52) tmp = t_1; elseif (z <= 1.08e-162) tmp = x / (t - (z * a)); elseif (z <= 3.9e+27) tmp = (x - (z * y)) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -3.9e+52], t$95$1, If[LessEqual[z, 1.08e-162], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.9e+27], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -3.9 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.08 \cdot 10^{-162}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+27}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.9e52 or 3.8999999999999999e27 < z Initial program 66.2%
*-commutative66.2%
Simplified66.2%
Taylor expanded in x around 0 66.3%
*-commutative66.3%
*-commutative66.3%
*-un-lft-identity66.3%
times-frac71.9%
Applied egg-rr71.9%
/-rgt-identity71.9%
Simplified71.9%
Taylor expanded in a around inf 79.9%
mul-1-neg79.9%
unsub-neg79.9%
Simplified79.9%
if -3.9e52 < z < 1.08000000000000006e-162Initial program 99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in x around inf 74.8%
*-commutative74.8%
Simplified74.8%
if 1.08000000000000006e-162 < z < 3.8999999999999999e27Initial program 99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in t around inf 75.9%
Final simplification77.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9.5e+126) (not (<= z 4.8e+122))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.5e+126) || !(z <= 4.8e+122)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-9.5d+126)) .or. (.not. (z <= 4.8d+122))) then
tmp = y / a
else
tmp = x / (t - (z * a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.5e+126) || !(z <= 4.8e+122)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9.5e+126) or not (z <= 4.8e+122): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9.5e+126) || !(z <= 4.8e+122)) tmp = Float64(y / a); else tmp = Float64(x / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -9.5e+126) || ~((z <= 4.8e+122))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9.5e+126], N[Not[LessEqual[z, 4.8e+122]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+126} \lor \neg \left(z \leq 4.8 \cdot 10^{+122}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -9.49999999999999951e126 or 4.8000000000000004e122 < z Initial program 57.2%
*-commutative57.2%
Simplified57.2%
Taylor expanded in z around inf 67.7%
if -9.49999999999999951e126 < z < 4.8000000000000004e122Initial program 97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in x around inf 68.3%
*-commutative68.3%
Simplified68.3%
Final simplification68.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.75e-28) (not (<= z 4.2e-23))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.75e-28) || !(z <= 4.2e-23)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-3.75d-28)) .or. (.not. (z <= 4.2d-23))) then
tmp = y / a
else
tmp = x / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.75e-28) || !(z <= 4.2e-23)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.75e-28) or not (z <= 4.2e-23): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.75e-28) || !(z <= 4.2e-23)) tmp = Float64(y / a); else tmp = Float64(x / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.75e-28) || ~((z <= 4.2e-23))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.75e-28], N[Not[LessEqual[z, 4.2e-23]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.75 \cdot 10^{-28} \lor \neg \left(z \leq 4.2 \cdot 10^{-23}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -3.7500000000000001e-28 or 4.2000000000000002e-23 < z Initial program 71.6%
*-commutative71.6%
Simplified71.6%
Taylor expanded in z around inf 53.3%
if -3.7500000000000001e-28 < z < 4.2000000000000002e-23Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 51.7%
Final simplification52.5%
(FPCore (x y z t a) :precision binary64 (/ x t))
double code(double x, double y, double z, double t, double a) {
return x / t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x / t
end function
public static double code(double x, double y, double z, double t, double a) {
return x / t;
}
def code(x, y, z, t, a): return x / t
function code(x, y, z, t, a) return Float64(x / t) end
function tmp = code(x, y, z, t, a) tmp = x / t; end
code[x_, y_, z_, t_, a_] := N[(x / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{t}
\end{array}
Initial program 85.1%
*-commutative85.1%
Simplified85.1%
Taylor expanded in z around 0 34.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))) (t_2 (- (/ x t_1) (/ y (- (/ t z) a)))))
(if (< z -32113435955957344.0)
t_2
(if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 t_1)) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t - (a * z)
t_2 = (x / t_1) - (y / ((t / z) - a))
if (z < (-32113435955957344.0d0)) then
tmp = t_2
else if (z < 3.5139522372978296d-86) then
tmp = (x - (y * z)) * (1.0d0 / t_1)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (a * z) t_2 = (x / t_1) - (y / ((t / z) - a)) tmp = 0 if z < -32113435955957344.0: tmp = t_2 elif z < 3.5139522372978296e-86: tmp = (x - (y * z)) * (1.0 / t_1) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) t_2 = Float64(Float64(x / t_1) - Float64(y / Float64(Float64(t / z) - a))) tmp = 0.0 if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = Float64(Float64(x - Float64(y * z)) * Float64(1.0 / t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (a * z); t_2 = (x / t_1) - (y / ((t / z) - a)); tmp = 0.0; if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = (x - (y * z)) * (1.0 / t_1); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / t$95$1), $MachinePrecision] - N[(y / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -32113435955957344.0], t$95$2, If[Less[z, 3.5139522372978296e-86], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x}{t\_1} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{if}\;z < -32113435955957344:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z < 3.5139522372978296 \cdot 10^{-86}:\\
\;\;\;\;\left(x - y \cdot z\right) \cdot \frac{1}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024131
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:alt
(! :herbie-platform default (if (< z -32113435955957344) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 4392440296622287/125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (- x (* y z)) (/ 1 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))))))
(/ (- x (* y z)) (- t (* a z))))