
(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 (<= z -3.6e+264) (- (/ y a) (/ (/ x a) z)) (if (<= z 1.4e+53) (/ (- x (* z y)) (- t (* z a))) (/ y (- a (/ t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.6e+264) {
tmp = (y / a) - ((x / a) / z);
} else if (z <= 1.4e+53) {
tmp = (x - (z * y)) / (t - (z * a));
} else {
tmp = y / (a - (t / z));
}
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.6d+264)) then
tmp = (y / a) - ((x / a) / z)
else if (z <= 1.4d+53) then
tmp = (x - (z * y)) / (t - (z * a))
else
tmp = y / (a - (t / z))
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.6e+264) {
tmp = (y / a) - ((x / a) / z);
} else if (z <= 1.4e+53) {
tmp = (x - (z * y)) / (t - (z * a));
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.6e+264: tmp = (y / a) - ((x / a) / z) elif z <= 1.4e+53: tmp = (x - (z * y)) / (t - (z * a)) else: tmp = y / (a - (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.6e+264) tmp = Float64(Float64(y / a) - Float64(Float64(x / a) / z)); elseif (z <= 1.4e+53) tmp = Float64(Float64(x - Float64(z * y)) / Float64(t - Float64(z * a))); else tmp = Float64(y / Float64(a - Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.6e+264) tmp = (y / a) - ((x / a) / z); elseif (z <= 1.4e+53) tmp = (x - (z * y)) / (t - (z * a)); else tmp = y / (a - (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.6e+264], N[(N[(y / a), $MachinePrecision] - N[(N[(x / a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e+53], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+264}:\\
\;\;\;\;\frac{y}{a} - \frac{\frac{x}{a}}{z}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+53}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
\end{array}
if z < -3.60000000000000011e264Initial program 28.4%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6428.4%
Simplified28.4%
Taylor expanded in z around inf
+-commutativeN/A
associate--l+N/A
associate-/r*N/A
associate-*r/N/A
associate-/r*N/A
associate-*r/N/A
div-subN/A
distribute-lft-out--N/A
associate-*r/N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
associate-*r/N/A
distribute-lft-out--N/A
Simplified72.7%
Taylor expanded in y around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6491.0%
Simplified91.0%
if -3.60000000000000011e264 < z < 1.4e53Initial program 97.2%
if 1.4e53 < z Initial program 58.6%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6458.6%
Simplified58.6%
Taylor expanded in z around inf
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6458.6%
Simplified58.6%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
distribute-lft-out--N/A
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
/-lowering-/.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6486.1%
Simplified86.1%
Final simplification94.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.56e-12)
(/ (- y (/ x z)) a)
(if (<= z 1.45e-83)
(/ (- x (* z y)) t)
(if (<= z 0.235) (/ x (- t (* z a))) (/ y (- a (/ t z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.56e-12) {
tmp = (y - (x / z)) / a;
} else if (z <= 1.45e-83) {
tmp = (x - (z * y)) / t;
} else if (z <= 0.235) {
tmp = x / (t - (z * a));
} else {
tmp = y / (a - (t / z));
}
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.56d-12)) then
tmp = (y - (x / z)) / a
else if (z <= 1.45d-83) then
tmp = (x - (z * y)) / t
else if (z <= 0.235d0) then
tmp = x / (t - (z * a))
else
tmp = y / (a - (t / z))
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.56e-12) {
tmp = (y - (x / z)) / a;
} else if (z <= 1.45e-83) {
tmp = (x - (z * y)) / t;
} else if (z <= 0.235) {
tmp = x / (t - (z * a));
} else {
tmp = y / (a - (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.56e-12: tmp = (y - (x / z)) / a elif z <= 1.45e-83: tmp = (x - (z * y)) / t elif z <= 0.235: tmp = x / (t - (z * a)) else: tmp = y / (a - (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.56e-12) tmp = Float64(Float64(y - Float64(x / z)) / a); elseif (z <= 1.45e-83) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 0.235) tmp = Float64(x / Float64(t - Float64(z * a))); else tmp = Float64(y / Float64(a - Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.56e-12) tmp = (y - (x / z)) / a; elseif (z <= 1.45e-83) tmp = (x - (z * y)) / t; elseif (z <= 0.235) tmp = x / (t - (z * a)); else tmp = y / (a - (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.56e-12], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[z, 1.45e-83], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 0.235], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.56 \cdot 10^{-12}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-83}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 0.235:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
\end{array}
if z < -1.56000000000000002e-12Initial program 77.6%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6477.6%
Simplified77.6%
Taylor expanded in t around 0
associate-*r/N/A
*-commutativeN/A
associate-/r*N/A
associate-*r/N/A
/-lowering-/.f64N/A
div-subN/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
distribute-lft-out--N/A
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6477.5%
Simplified77.5%
if -1.56000000000000002e-12 < z < 1.45e-83Initial program 99.9%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6499.9%
Simplified99.9%
Taylor expanded in t around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f6485.8%
Simplified85.8%
if 1.45e-83 < z < 0.23499999999999999Initial program 99.8%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in x around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6483.5%
Simplified83.5%
if 0.23499999999999999 < z Initial program 64.7%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6464.7%
Simplified64.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6464.7%
Simplified64.7%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
distribute-lft-out--N/A
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
/-lowering-/.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6480.8%
Simplified80.8%
Final simplification82.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ y (- a (/ t z)))))
(if (<= z -1.35e+32)
t_1
(if (<= z 1.6e-83)
(/ (- x (* z y)) t)
(if (<= z 5.6) (/ x (- t (* z a))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y / (a - (t / z));
double tmp;
if (z <= -1.35e+32) {
tmp = t_1;
} else if (z <= 1.6e-83) {
tmp = (x - (z * y)) / t;
} else if (z <= 5.6) {
tmp = x / (t - (z * a));
} 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 / (a - (t / z))
if (z <= (-1.35d+32)) then
tmp = t_1
else if (z <= 1.6d-83) then
tmp = (x - (z * y)) / t
else if (z <= 5.6d0) then
tmp = x / (t - (z * a))
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 / (a - (t / z));
double tmp;
if (z <= -1.35e+32) {
tmp = t_1;
} else if (z <= 1.6e-83) {
tmp = (x - (z * y)) / t;
} else if (z <= 5.6) {
tmp = x / (t - (z * a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y / (a - (t / z)) tmp = 0 if z <= -1.35e+32: tmp = t_1 elif z <= 1.6e-83: tmp = (x - (z * y)) / t elif z <= 5.6: tmp = x / (t - (z * a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y / Float64(a - Float64(t / z))) tmp = 0.0 if (z <= -1.35e+32) tmp = t_1; elseif (z <= 1.6e-83) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 5.6) tmp = Float64(x / Float64(t - Float64(z * a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y / (a - (t / z)); tmp = 0.0; if (z <= -1.35e+32) tmp = t_1; elseif (z <= 1.6e-83) tmp = (x - (z * y)) / t; elseif (z <= 5.6) tmp = x / (t - (z * a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.35e+32], t$95$1, If[LessEqual[z, 1.6e-83], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 5.6], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a - \frac{t}{z}}\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-83}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 5.6:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.35000000000000006e32 or 5.5999999999999996 < z Initial program 68.9%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6468.9%
Simplified68.9%
Taylor expanded in z around inf
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6468.9%
Simplified68.9%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
distribute-lft-out--N/A
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
/-lowering-/.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6478.6%
Simplified78.6%
if -1.35000000000000006e32 < z < 1.6000000000000001e-83Initial program 99.8%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in t around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f6484.0%
Simplified84.0%
if 1.6000000000000001e-83 < z < 5.5999999999999996Initial program 99.8%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in x around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6483.5%
Simplified83.5%
Final simplification81.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -7.2e+46)
(/ y a)
(if (<= z -3.4e-66)
(* z (/ (- 0.0 y) t))
(if (<= z 1.65e+14) (/ x t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7.2e+46) {
tmp = y / a;
} else if (z <= -3.4e-66) {
tmp = z * ((0.0 - y) / t);
} else if (z <= 1.65e+14) {
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+46)) then
tmp = y / a
else if (z <= (-3.4d-66)) then
tmp = z * ((0.0d0 - y) / t)
else if (z <= 1.65d+14) 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+46) {
tmp = y / a;
} else if (z <= -3.4e-66) {
tmp = z * ((0.0 - y) / t);
} else if (z <= 1.65e+14) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7.2e+46: tmp = y / a elif z <= -3.4e-66: tmp = z * ((0.0 - y) / t) elif z <= 1.65e+14: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.2e+46) tmp = Float64(y / a); elseif (z <= -3.4e-66) tmp = Float64(z * Float64(Float64(0.0 - y) / t)); elseif (z <= 1.65e+14) 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+46) tmp = y / a; elseif (z <= -3.4e-66) tmp = z * ((0.0 - y) / t); elseif (z <= 1.65e+14) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7.2e+46], N[(y / a), $MachinePrecision], If[LessEqual[z, -3.4e-66], N[(z * N[(N[(0.0 - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.65e+14], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+46}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -3.4 \cdot 10^{-66}:\\
\;\;\;\;z \cdot \frac{0 - y}{t}\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+14}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -7.1999999999999997e46 or 1.65e14 < z Initial program 67.3%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6467.3%
Simplified67.3%
Taylor expanded in z around inf
/-lowering-/.f6463.5%
Simplified63.5%
if -7.1999999999999997e46 < z < -3.39999999999999997e-66Initial program 99.8%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in t around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f6467.4%
Simplified67.4%
Taylor expanded in z around inf
*-lowering-*.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f6467.4%
Simplified67.4%
Taylor expanded in x around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
/-lowering-/.f6460.6%
Simplified60.6%
if -3.39999999999999997e-66 < z < 1.65e14Initial program 99.8%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in z around 0
/-lowering-/.f6461.5%
Simplified61.5%
Final simplification62.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ y (- a (/ t z))))) (if (<= z -2.4e-65) t_1 (if (<= z 0.8) (/ x (- t (* z a))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y / (a - (t / z));
double tmp;
if (z <= -2.4e-65) {
tmp = t_1;
} else if (z <= 0.8) {
tmp = x / (t - (z * a));
} 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 / (a - (t / z))
if (z <= (-2.4d-65)) then
tmp = t_1
else if (z <= 0.8d0) then
tmp = x / (t - (z * a))
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 / (a - (t / z));
double tmp;
if (z <= -2.4e-65) {
tmp = t_1;
} else if (z <= 0.8) {
tmp = x / (t - (z * a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y / (a - (t / z)) tmp = 0 if z <= -2.4e-65: tmp = t_1 elif z <= 0.8: tmp = x / (t - (z * a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y / Float64(a - Float64(t / z))) tmp = 0.0 if (z <= -2.4e-65) tmp = t_1; elseif (z <= 0.8) tmp = Float64(x / Float64(t - Float64(z * a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y / (a - (t / z)); tmp = 0.0; if (z <= -2.4e-65) tmp = t_1; elseif (z <= 0.8) tmp = x / (t - (z * a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y / N[(a - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.4e-65], t$95$1, If[LessEqual[z, 0.8], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a - \frac{t}{z}}\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{-65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.8:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.4000000000000002e-65 or 0.80000000000000004 < z Initial program 71.8%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6471.8%
Simplified71.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6471.8%
Simplified71.8%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
distribute-lft-out--N/A
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
/-lowering-/.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6477.8%
Simplified77.8%
if -2.4000000000000002e-65 < z < 0.80000000000000004Initial program 99.8%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in x around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6477.5%
Simplified77.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.9e+42) (/ y a) (if (<= z 5.4e+45) (/ x (- t (* z a))) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.9e+42) {
tmp = y / a;
} else if (z <= 5.4e+45) {
tmp = x / (t - (z * a));
} 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 <= (-4.9d+42)) then
tmp = y / a
else if (z <= 5.4d+45) then
tmp = x / (t - (z * a))
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 <= -4.9e+42) {
tmp = y / a;
} else if (z <= 5.4e+45) {
tmp = x / (t - (z * a));
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.9e+42: tmp = y / a elif z <= 5.4e+45: tmp = x / (t - (z * a)) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.9e+42) tmp = Float64(y / a); elseif (z <= 5.4e+45) tmp = Float64(x / Float64(t - Float64(z * a))); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.9e+42) tmp = y / a; elseif (z <= 5.4e+45) tmp = x / (t - (z * a)); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.9e+42], N[(y / a), $MachinePrecision], If[LessEqual[z, 5.4e+45], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.9 \cdot 10^{+42}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{+45}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -4.9000000000000002e42 or 5.39999999999999968e45 < z Initial program 65.9%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6465.9%
Simplified65.9%
Taylor expanded in z around inf
/-lowering-/.f6464.4%
Simplified64.4%
if -4.9000000000000002e42 < z < 5.39999999999999968e45Initial program 99.8%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in x around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6473.1%
Simplified73.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.3e+29) (/ y a) (if (<= z 60000000000000.0) (/ x t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.3e+29) {
tmp = y / a;
} else if (z <= 60000000000000.0) {
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 <= (-1.3d+29)) then
tmp = y / a
else if (z <= 60000000000000.0d0) 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 <= -1.3e+29) {
tmp = y / a;
} else if (z <= 60000000000000.0) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.3e+29: tmp = y / a elif z <= 60000000000000.0: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.3e+29) tmp = Float64(y / a); elseif (z <= 60000000000000.0) 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 <= -1.3e+29) tmp = y / a; elseif (z <= 60000000000000.0) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.3e+29], N[(y / a), $MachinePrecision], If[LessEqual[z, 60000000000000.0], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+29}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 60000000000000:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.3e29 or 6e13 < z Initial program 68.1%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6468.1%
Simplified68.1%
Taylor expanded in z around inf
/-lowering-/.f6462.0%
Simplified62.0%
if -1.3e29 < z < 6e13Initial program 99.8%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Taylor expanded in z around 0
/-lowering-/.f6458.4%
Simplified58.4%
(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 84.7%
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6484.7%
Simplified84.7%
Taylor expanded in z around 0
/-lowering-/.f6436.0%
Simplified36.0%
(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 2024163
(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))))