
(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 8 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 (<= (/ (- x (* y z)) (- t (* z a))) 5e+289) (/ (fma z y (- x)) (- (* z a) t)) (/ y a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x - (y * z)) / (t - (z * a))) <= 5e+289) {
tmp = fma(z, y, -x) / ((z * a) - t);
} else {
tmp = y / a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a))) <= 5e+289) tmp = Float64(fma(z, y, Float64(-x)) / Float64(Float64(z * a) - t)); else tmp = Float64(y / a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+289], N[(N[(z * y + (-x)), $MachinePrecision] / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x - y \cdot z}{t - z \cdot a} \leq 5 \cdot 10^{+289}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, y, -x\right)}{z \cdot a - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 5.00000000000000031e289Initial program 93.6%
sub-neg93.6%
+-commutative93.6%
neg-sub093.6%
associate-+l-93.6%
sub0-neg93.6%
neg-mul-193.6%
sub-neg93.6%
+-commutative93.6%
neg-sub093.6%
associate-+l-93.6%
sub0-neg93.6%
neg-mul-193.6%
times-frac93.6%
metadata-eval93.6%
*-lft-identity93.6%
*-commutative93.6%
Simplified93.6%
*-commutative93.6%
fma-neg93.6%
Applied egg-rr93.6%
if 5.00000000000000031e289 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 21.6%
sub-neg21.6%
+-commutative21.6%
neg-sub021.6%
associate-+l-21.6%
sub0-neg21.6%
neg-mul-121.6%
sub-neg21.6%
+-commutative21.6%
neg-sub021.6%
associate-+l-21.6%
sub0-neg21.6%
neg-mul-121.6%
times-frac21.6%
metadata-eval21.6%
*-lft-identity21.6%
*-commutative21.6%
Simplified21.6%
Taylor expanded in z around inf 80.9%
Final simplification92.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- x (* y z)) (- t (* z a))))) (if (<= t_1 5e+289) t_1 (/ y a))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_1 <= 5e+289) {
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 - (y * z)) / (t - (z * a))
if (t_1 <= 5d+289) 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 - (y * z)) / (t - (z * a));
double tmp;
if (t_1 <= 5e+289) {
tmp = t_1;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (y * z)) / (t - (z * a)) tmp = 0 if t_1 <= 5e+289: tmp = t_1 else: tmp = y / a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(z * a))) tmp = 0.0 if (t_1 <= 5e+289) tmp = t_1; else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - (y * z)) / (t - (z * a)); tmp = 0.0; if (t_1 <= 5e+289) tmp = t_1; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+289], t$95$1, N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y \cdot z}{t - z \cdot a}\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{+289}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 5.00000000000000031e289Initial program 93.6%
if 5.00000000000000031e289 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 21.6%
sub-neg21.6%
+-commutative21.6%
neg-sub021.6%
associate-+l-21.6%
sub0-neg21.6%
neg-mul-121.6%
sub-neg21.6%
+-commutative21.6%
neg-sub021.6%
associate-+l-21.6%
sub0-neg21.6%
neg-mul-121.6%
times-frac21.6%
metadata-eval21.6%
*-lft-identity21.6%
*-commutative21.6%
Simplified21.6%
Taylor expanded in z around inf 80.9%
Final simplification92.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)) (t_2 (/ (- x (* y z)) t)))
(if (<= t -1.15e-36)
t_2
(if (<= t -2.2e-108)
t_1
(if (<= t -7.5e-131)
t_2
(if (<= t -4e-162)
(/ (- x) (- (* z a) t))
(if (<= t 8.4e-48) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double t_2 = (x - (y * z)) / t;
double tmp;
if (t <= -1.15e-36) {
tmp = t_2;
} else if (t <= -2.2e-108) {
tmp = t_1;
} else if (t <= -7.5e-131) {
tmp = t_2;
} else if (t <= -4e-162) {
tmp = -x / ((z * a) - t);
} else if (t <= 8.4e-48) {
tmp = 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 = (y - (x / z)) / a
t_2 = (x - (y * z)) / t
if (t <= (-1.15d-36)) then
tmp = t_2
else if (t <= (-2.2d-108)) then
tmp = t_1
else if (t <= (-7.5d-131)) then
tmp = t_2
else if (t <= (-4d-162)) then
tmp = -x / ((z * a) - t)
else if (t <= 8.4d-48) then
tmp = 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 = (y - (x / z)) / a;
double t_2 = (x - (y * z)) / t;
double tmp;
if (t <= -1.15e-36) {
tmp = t_2;
} else if (t <= -2.2e-108) {
tmp = t_1;
} else if (t <= -7.5e-131) {
tmp = t_2;
} else if (t <= -4e-162) {
tmp = -x / ((z * a) - t);
} else if (t <= 8.4e-48) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a t_2 = (x - (y * z)) / t tmp = 0 if t <= -1.15e-36: tmp = t_2 elif t <= -2.2e-108: tmp = t_1 elif t <= -7.5e-131: tmp = t_2 elif t <= -4e-162: tmp = -x / ((z * a) - t) elif t <= 8.4e-48: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - Float64(x / z)) / a) t_2 = Float64(Float64(x - Float64(y * z)) / t) tmp = 0.0 if (t <= -1.15e-36) tmp = t_2; elseif (t <= -2.2e-108) tmp = t_1; elseif (t <= -7.5e-131) tmp = t_2; elseif (t <= -4e-162) tmp = Float64(Float64(-x) / Float64(Float64(z * a) - t)); elseif (t <= 8.4e-48) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - (x / z)) / a; t_2 = (x - (y * z)) / t; tmp = 0.0; if (t <= -1.15e-36) tmp = t_2; elseif (t <= -2.2e-108) tmp = t_1; elseif (t <= -7.5e-131) tmp = t_2; elseif (t <= -4e-162) tmp = -x / ((z * a) - t); elseif (t <= 8.4e-48) tmp = t_1; else tmp = t_2; 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]}, Block[{t$95$2 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -1.15e-36], t$95$2, If[LessEqual[t, -2.2e-108], t$95$1, If[LessEqual[t, -7.5e-131], t$95$2, If[LessEqual[t, -4e-162], N[((-x) / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.4e-48], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - \frac{x}{z}}{a}\\
t_2 := \frac{x - y \cdot z}{t}\\
\mathbf{if}\;t \leq -1.15 \cdot 10^{-36}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -2.2 \cdot 10^{-108}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -7.5 \cdot 10^{-131}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -4 \cdot 10^{-162}:\\
\;\;\;\;\frac{-x}{z \cdot a - t}\\
\mathbf{elif}\;t \leq 8.4 \cdot 10^{-48}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -1.14999999999999998e-36 or -2.2000000000000001e-108 < t < -7.49999999999999964e-131 or 8.39999999999999954e-48 < t Initial program 83.8%
sub-neg83.8%
+-commutative83.8%
neg-sub083.8%
associate-+l-83.8%
sub0-neg83.8%
neg-mul-183.8%
sub-neg83.8%
+-commutative83.8%
neg-sub083.8%
associate-+l-83.8%
sub0-neg83.8%
neg-mul-183.8%
times-frac83.8%
metadata-eval83.8%
*-lft-identity83.8%
*-commutative83.8%
Simplified83.8%
Taylor expanded in a around 0 70.4%
associate-*r/70.4%
neg-mul-170.4%
neg-sub070.4%
sub-neg70.4%
+-commutative70.4%
associate--r+70.4%
neg-sub070.4%
remove-double-neg70.4%
*-commutative70.4%
Simplified70.4%
if -1.14999999999999998e-36 < t < -2.2000000000000001e-108 or -3.99999999999999982e-162 < t < 8.39999999999999954e-48Initial program 86.7%
sub-neg86.7%
+-commutative86.7%
neg-sub086.7%
associate-+l-86.7%
sub0-neg86.7%
neg-mul-186.7%
sub-neg86.7%
+-commutative86.7%
neg-sub086.7%
associate-+l-86.7%
sub0-neg86.7%
neg-mul-186.7%
times-frac86.7%
metadata-eval86.7%
*-lft-identity86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in a around inf 52.4%
+-commutative52.4%
associate--l+52.4%
associate-/l*49.0%
*-commutative49.0%
unpow249.0%
unpow249.0%
swap-sqr59.0%
unpow259.0%
associate-/r/63.4%
*-commutative63.4%
*-commutative63.4%
*-commutative63.4%
associate-/r*62.4%
Simplified62.4%
Taylor expanded in t around 0 81.5%
associate-/l/80.5%
div-sub80.5%
Simplified80.5%
if -7.49999999999999964e-131 < t < -3.99999999999999982e-162Initial program 99.4%
sub-neg99.4%
+-commutative99.4%
neg-sub099.4%
associate-+l-99.4%
sub0-neg99.4%
neg-mul-199.4%
sub-neg99.4%
+-commutative99.4%
neg-sub099.4%
associate-+l-99.4%
sub0-neg99.4%
neg-mul-199.4%
times-frac99.4%
metadata-eval99.4%
*-lft-identity99.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in y around 0 80.8%
neg-mul-180.8%
Simplified80.8%
Final simplification74.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)) (t_2 (/ (- x (* y z)) t)))
(if (<= t -6.8e-43)
(- (/ x t) (* z (/ y t)))
(if (<= t -1.32e-107)
t_1
(if (<= t -2e-131)
t_2
(if (<= t -1.75e-159)
(/ (- x) (- (* z a) t))
(if (<= t 9.2e-48) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double t_2 = (x - (y * z)) / t;
double tmp;
if (t <= -6.8e-43) {
tmp = (x / t) - (z * (y / t));
} else if (t <= -1.32e-107) {
tmp = t_1;
} else if (t <= -2e-131) {
tmp = t_2;
} else if (t <= -1.75e-159) {
tmp = -x / ((z * a) - t);
} else if (t <= 9.2e-48) {
tmp = 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 = (y - (x / z)) / a
t_2 = (x - (y * z)) / t
if (t <= (-6.8d-43)) then
tmp = (x / t) - (z * (y / t))
else if (t <= (-1.32d-107)) then
tmp = t_1
else if (t <= (-2d-131)) then
tmp = t_2
else if (t <= (-1.75d-159)) then
tmp = -x / ((z * a) - t)
else if (t <= 9.2d-48) then
tmp = 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 = (y - (x / z)) / a;
double t_2 = (x - (y * z)) / t;
double tmp;
if (t <= -6.8e-43) {
tmp = (x / t) - (z * (y / t));
} else if (t <= -1.32e-107) {
tmp = t_1;
} else if (t <= -2e-131) {
tmp = t_2;
} else if (t <= -1.75e-159) {
tmp = -x / ((z * a) - t);
} else if (t <= 9.2e-48) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a t_2 = (x - (y * z)) / t tmp = 0 if t <= -6.8e-43: tmp = (x / t) - (z * (y / t)) elif t <= -1.32e-107: tmp = t_1 elif t <= -2e-131: tmp = t_2 elif t <= -1.75e-159: tmp = -x / ((z * a) - t) elif t <= 9.2e-48: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - Float64(x / z)) / a) t_2 = Float64(Float64(x - Float64(y * z)) / t) tmp = 0.0 if (t <= -6.8e-43) tmp = Float64(Float64(x / t) - Float64(z * Float64(y / t))); elseif (t <= -1.32e-107) tmp = t_1; elseif (t <= -2e-131) tmp = t_2; elseif (t <= -1.75e-159) tmp = Float64(Float64(-x) / Float64(Float64(z * a) - t)); elseif (t <= 9.2e-48) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - (x / z)) / a; t_2 = (x - (y * z)) / t; tmp = 0.0; if (t <= -6.8e-43) tmp = (x / t) - (z * (y / t)); elseif (t <= -1.32e-107) tmp = t_1; elseif (t <= -2e-131) tmp = t_2; elseif (t <= -1.75e-159) tmp = -x / ((z * a) - t); elseif (t <= 9.2e-48) tmp = t_1; else tmp = t_2; 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]}, Block[{t$95$2 = N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -6.8e-43], N[(N[(x / t), $MachinePrecision] - N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.32e-107], t$95$1, If[LessEqual[t, -2e-131], t$95$2, If[LessEqual[t, -1.75e-159], N[((-x) / N[(N[(z * a), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9.2e-48], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - \frac{x}{z}}{a}\\
t_2 := \frac{x - y \cdot z}{t}\\
\mathbf{if}\;t \leq -6.8 \cdot 10^{-43}:\\
\;\;\;\;\frac{x}{t} - z \cdot \frac{y}{t}\\
\mathbf{elif}\;t \leq -1.32 \cdot 10^{-107}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -2 \cdot 10^{-131}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -1.75 \cdot 10^{-159}:\\
\;\;\;\;\frac{-x}{z \cdot a - t}\\
\mathbf{elif}\;t \leq 9.2 \cdot 10^{-48}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -6.8000000000000001e-43Initial program 78.5%
sub-neg78.5%
+-commutative78.5%
neg-sub078.5%
associate-+l-78.5%
sub0-neg78.5%
neg-mul-178.5%
sub-neg78.5%
+-commutative78.5%
neg-sub078.5%
associate-+l-78.5%
sub0-neg78.5%
neg-mul-178.5%
times-frac78.5%
metadata-eval78.5%
*-lft-identity78.5%
*-commutative78.5%
Simplified78.5%
*-commutative78.5%
fma-neg78.5%
Applied egg-rr78.5%
Taylor expanded in z around 0 66.8%
distribute-lft-out--66.8%
*-commutative66.8%
unpow266.8%
Simplified66.8%
Taylor expanded in y around inf 71.5%
if -6.8000000000000001e-43 < t < -1.3200000000000001e-107 or -1.75000000000000001e-159 < t < 9.2000000000000003e-48Initial program 86.7%
sub-neg86.7%
+-commutative86.7%
neg-sub086.7%
associate-+l-86.7%
sub0-neg86.7%
neg-mul-186.7%
sub-neg86.7%
+-commutative86.7%
neg-sub086.7%
associate-+l-86.7%
sub0-neg86.7%
neg-mul-186.7%
times-frac86.7%
metadata-eval86.7%
*-lft-identity86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in a around inf 52.4%
+-commutative52.4%
associate--l+52.4%
associate-/l*49.0%
*-commutative49.0%
unpow249.0%
unpow249.0%
swap-sqr59.0%
unpow259.0%
associate-/r/63.4%
*-commutative63.4%
*-commutative63.4%
*-commutative63.4%
associate-/r*62.4%
Simplified62.4%
Taylor expanded in t around 0 81.5%
associate-/l/80.5%
div-sub80.5%
Simplified80.5%
if -1.3200000000000001e-107 < t < -2e-131 or 9.2000000000000003e-48 < t Initial program 89.0%
sub-neg89.0%
+-commutative89.0%
neg-sub089.0%
associate-+l-89.0%
sub0-neg89.0%
neg-mul-189.0%
sub-neg89.0%
+-commutative89.0%
neg-sub089.0%
associate-+l-89.0%
sub0-neg89.0%
neg-mul-189.0%
times-frac89.0%
metadata-eval89.0%
*-lft-identity89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in a around 0 72.1%
associate-*r/72.1%
neg-mul-172.1%
neg-sub072.1%
sub-neg72.1%
+-commutative72.1%
associate--r+72.1%
neg-sub072.1%
remove-double-neg72.1%
*-commutative72.1%
Simplified72.1%
if -2e-131 < t < -1.75000000000000001e-159Initial program 99.4%
sub-neg99.4%
+-commutative99.4%
neg-sub099.4%
associate-+l-99.4%
sub0-neg99.4%
neg-mul-199.4%
sub-neg99.4%
+-commutative99.4%
neg-sub099.4%
associate-+l-99.4%
sub0-neg99.4%
neg-mul-199.4%
times-frac99.4%
metadata-eval99.4%
*-lft-identity99.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in y around 0 80.8%
neg-mul-180.8%
Simplified80.8%
Final simplification75.0%
(FPCore (x y z t a)
:precision binary64
(if (or (<= z -1.15e+120)
(and (not (<= z -1.7e+102))
(or (<= z -1.25e+53) (not (<= z 2.15e+128)))))
(/ y a)
(/ (- x (* y z)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.15e+120) || (!(z <= -1.7e+102) && ((z <= -1.25e+53) || !(z <= 2.15e+128)))) {
tmp = y / a;
} else {
tmp = (x - (y * z)) / 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 <= (-1.15d+120)) .or. (.not. (z <= (-1.7d+102))) .and. (z <= (-1.25d+53)) .or. (.not. (z <= 2.15d+128))) then
tmp = y / a
else
tmp = (x - (y * z)) / 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 <= -1.15e+120) || (!(z <= -1.7e+102) && ((z <= -1.25e+53) || !(z <= 2.15e+128)))) {
tmp = y / a;
} else {
tmp = (x - (y * z)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.15e+120) or (not (z <= -1.7e+102) and ((z <= -1.25e+53) or not (z <= 2.15e+128))): tmp = y / a else: tmp = (x - (y * z)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.15e+120) || (!(z <= -1.7e+102) && ((z <= -1.25e+53) || !(z <= 2.15e+128)))) tmp = Float64(y / a); else tmp = Float64(Float64(x - Float64(y * z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.15e+120) || (~((z <= -1.7e+102)) && ((z <= -1.25e+53) || ~((z <= 2.15e+128))))) tmp = y / a; else tmp = (x - (y * z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.15e+120], And[N[Not[LessEqual[z, -1.7e+102]], $MachinePrecision], Or[LessEqual[z, -1.25e+53], N[Not[LessEqual[z, 2.15e+128]], $MachinePrecision]]]], N[(y / a), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+120} \lor \neg \left(z \leq -1.7 \cdot 10^{+102}\right) \land \left(z \leq -1.25 \cdot 10^{+53} \lor \neg \left(z \leq 2.15 \cdot 10^{+128}\right)\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\end{array}
\end{array}
if z < -1.14999999999999996e120 or -1.7e102 < z < -1.2500000000000001e53 or 2.14999999999999987e128 < z Initial program 58.3%
sub-neg58.3%
+-commutative58.3%
neg-sub058.3%
associate-+l-58.3%
sub0-neg58.3%
neg-mul-158.3%
sub-neg58.3%
+-commutative58.3%
neg-sub058.3%
associate-+l-58.3%
sub0-neg58.3%
neg-mul-158.3%
times-frac58.3%
metadata-eval58.3%
*-lft-identity58.3%
*-commutative58.3%
Simplified58.3%
Taylor expanded in z around inf 64.9%
if -1.14999999999999996e120 < z < -1.7e102 or -1.2500000000000001e53 < z < 2.14999999999999987e128Initial program 99.2%
sub-neg99.2%
+-commutative99.2%
neg-sub099.2%
associate-+l-99.2%
sub0-neg99.2%
neg-mul-199.2%
sub-neg99.2%
+-commutative99.2%
neg-sub099.2%
associate-+l-99.2%
sub0-neg99.2%
neg-mul-199.2%
times-frac99.2%
metadata-eval99.2%
*-lft-identity99.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in a around 0 69.8%
associate-*r/69.8%
neg-mul-169.8%
neg-sub069.8%
sub-neg69.8%
+-commutative69.8%
associate--r+69.8%
neg-sub069.8%
remove-double-neg69.8%
*-commutative69.8%
Simplified69.8%
Final simplification68.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.5e-40) (not (<= t 1.45e-48))) (/ (- x (* y z)) t) (/ (- y (/ x z)) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.5e-40) || !(t <= 1.45e-48)) {
tmp = (x - (y * z)) / t;
} else {
tmp = (y - (x / 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 ((t <= (-4.5d-40)) .or. (.not. (t <= 1.45d-48))) then
tmp = (x - (y * z)) / t
else
tmp = (y - (x / 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 ((t <= -4.5e-40) || !(t <= 1.45e-48)) {
tmp = (x - (y * z)) / t;
} else {
tmp = (y - (x / z)) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.5e-40) or not (t <= 1.45e-48): tmp = (x - (y * z)) / t else: tmp = (y - (x / z)) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.5e-40) || !(t <= 1.45e-48)) tmp = Float64(Float64(x - Float64(y * z)) / t); else tmp = Float64(Float64(y - Float64(x / z)) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.5e-40) || ~((t <= 1.45e-48))) tmp = (x - (y * z)) / t; else tmp = (y - (x / z)) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.5e-40], N[Not[LessEqual[t, 1.45e-48]], $MachinePrecision]], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{-40} \lor \neg \left(t \leq 1.45 \cdot 10^{-48}\right):\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\end{array}
\end{array}
if t < -4.5000000000000001e-40 or 1.4500000000000001e-48 < t Initial program 83.2%
sub-neg83.2%
+-commutative83.2%
neg-sub083.2%
associate-+l-83.2%
sub0-neg83.2%
neg-mul-183.2%
sub-neg83.2%
+-commutative83.2%
neg-sub083.2%
associate-+l-83.2%
sub0-neg83.2%
neg-mul-183.2%
times-frac83.2%
metadata-eval83.2%
*-lft-identity83.2%
*-commutative83.2%
Simplified83.2%
Taylor expanded in a around 0 69.9%
associate-*r/69.9%
neg-mul-169.9%
neg-sub069.9%
sub-neg69.9%
+-commutative69.9%
associate--r+69.9%
neg-sub069.9%
remove-double-neg69.9%
*-commutative69.9%
Simplified69.9%
if -4.5000000000000001e-40 < t < 1.4500000000000001e-48Initial program 88.1%
sub-neg88.1%
+-commutative88.1%
neg-sub088.1%
associate-+l-88.1%
sub0-neg88.1%
neg-mul-188.1%
sub-neg88.1%
+-commutative88.1%
neg-sub088.1%
associate-+l-88.1%
sub0-neg88.1%
neg-mul-188.1%
times-frac88.1%
metadata-eval88.1%
*-lft-identity88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in a around inf 49.9%
+-commutative49.9%
associate--l+49.9%
associate-/l*47.1%
*-commutative47.1%
unpow247.1%
unpow247.1%
swap-sqr57.0%
unpow257.0%
associate-/r/60.9%
*-commutative60.9%
*-commutative60.9%
*-commutative60.9%
associate-/r*59.1%
Simplified59.1%
Taylor expanded in t around 0 77.9%
associate-/l/76.1%
div-sub76.1%
Simplified76.1%
Final simplification72.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -7.2e+37) (/ y a) (if (<= z 9.5e+55) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.2e+37) {
tmp = y / a;
} else if (z <= 9.5e+55) {
tmp = x / t;
} 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) :: tmp
if (z <= (-7.2d+37)) then
tmp = y / a
else if (z <= 9.5d+55) then
tmp = x / t
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 tmp;
if (z <= -7.2e+37) {
tmp = y / a;
} else if (z <= 9.5e+55) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7.2e+37: tmp = y / a elif z <= 9.5e+55: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.2e+37) tmp = Float64(y / a); elseif (z <= 9.5e+55) tmp = Float64(x / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7.2e+37) tmp = y / a; elseif (z <= 9.5e+55) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.2e+37], N[(y / a), $MachinePrecision], If[LessEqual[z, 9.5e+55], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+37}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+55}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -7.19999999999999995e37 or 9.49999999999999989e55 < z Initial program 66.7%
sub-neg66.7%
+-commutative66.7%
neg-sub066.7%
associate-+l-66.7%
sub0-neg66.7%
neg-mul-166.7%
sub-neg66.7%
+-commutative66.7%
neg-sub066.7%
associate-+l-66.7%
sub0-neg66.7%
neg-mul-166.7%
times-frac66.7%
metadata-eval66.7%
*-lft-identity66.7%
*-commutative66.7%
Simplified66.7%
Taylor expanded in z around inf 56.7%
if -7.19999999999999995e37 < z < 9.49999999999999989e55Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
times-frac99.8%
metadata-eval99.8%
*-lft-identity99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 50.9%
Final simplification53.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.2%
sub-neg85.2%
+-commutative85.2%
neg-sub085.2%
associate-+l-85.2%
sub0-neg85.2%
neg-mul-185.2%
sub-neg85.2%
+-commutative85.2%
neg-sub085.2%
associate-+l-85.2%
sub0-neg85.2%
neg-mul-185.2%
times-frac85.2%
metadata-eval85.2%
*-lft-identity85.2%
*-commutative85.2%
Simplified85.2%
Taylor expanded in z around 0 36.1%
Final simplification36.1%
(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 2023182
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(if (< z -32113435955957344.0) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a)))))
(/ (- x (* y z)) (- t (* a z))))