
(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 10 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
(let* ((t_1 (/ (- x (* y z)) (- t (* z a)))))
(if (<= t_1 -5e-304)
t_1
(if (<= t_1 0.0)
(* y (- (/ 1.0 a) (/ (/ x a) (* y z))))
(if (<= t_1 5e+301) t_1 (/ (- y (/ x z)) 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-304) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = y * ((1.0 / a) - ((x / a) / (y * z)));
} else if (t_1 <= 5e+301) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (x - (y * z)) / (t - (z * a))
if (t_1 <= (-5d-304)) then
tmp = t_1
else if (t_1 <= 0.0d0) then
tmp = y * ((1.0d0 / a) - ((x / a) / (y * z)))
else if (t_1 <= 5d+301) then
tmp = t_1
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 t_1 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_1 <= -5e-304) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = y * ((1.0 / a) - ((x / a) / (y * z)));
} else if (t_1 <= 5e+301) {
tmp = t_1;
} else {
tmp = (y - (x / z)) / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (y * z)) / (t - (z * a)) tmp = 0 if t_1 <= -5e-304: tmp = t_1 elif t_1 <= 0.0: tmp = y * ((1.0 / a) - ((x / a) / (y * z))) elif t_1 <= 5e+301: tmp = t_1 else: tmp = (y - (x / z)) / 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-304) tmp = t_1; elseif (t_1 <= 0.0) tmp = Float64(y * Float64(Float64(1.0 / a) - Float64(Float64(x / a) / Float64(y * z)))); elseif (t_1 <= 5e+301) tmp = t_1; else tmp = Float64(Float64(y - Float64(x / z)) / 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-304) tmp = t_1; elseif (t_1 <= 0.0) tmp = y * ((1.0 / a) - ((x / a) / (y * z))); elseif (t_1 <= 5e+301) tmp = t_1; else tmp = (y - (x / z)) / 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-304], t$95$1, If[LessEqual[t$95$1, 0.0], N[(y * N[(N[(1.0 / a), $MachinePrecision] - N[(N[(x / a), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+301], t$95$1, N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / 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^{-304}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;y \cdot \left(\frac{1}{a} - \frac{\frac{x}{a}}{y \cdot z}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+301}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -4.99999999999999965e-304 or 0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 5.0000000000000004e301Initial program 97.7%
if -4.99999999999999965e-304 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 0.0Initial program 51.3%
*-commutative51.3%
Simplified51.3%
Taylor expanded in t around 0 22.4%
associate-*r/22.4%
neg-mul-122.4%
neg-sub022.4%
sub-neg22.4%
distribute-rgt-neg-out22.4%
+-commutative22.4%
associate--r+22.4%
neg-sub022.4%
distribute-rgt-neg-out22.4%
remove-double-neg22.4%
*-commutative22.4%
Simplified22.4%
Taylor expanded in y around 0 36.3%
+-commutative36.3%
mul-1-neg36.3%
unsub-neg36.3%
*-commutative36.3%
Simplified36.3%
Taylor expanded in y around inf 58.2%
+-commutative58.2%
mul-1-neg58.2%
unsub-neg58.2%
associate-/r*70.9%
Simplified70.9%
if 5.0000000000000004e301 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 40.0%
*-commutative40.0%
Simplified40.0%
Taylor expanded in t around 0 40.0%
associate-*r/40.0%
neg-mul-140.0%
neg-sub040.0%
sub-neg40.0%
distribute-rgt-neg-out40.0%
+-commutative40.0%
associate--r+40.0%
neg-sub040.0%
distribute-rgt-neg-out40.0%
remove-double-neg40.0%
*-commutative40.0%
Simplified40.0%
Taylor expanded in y around 0 93.0%
+-commutative93.0%
mul-1-neg93.0%
unsub-neg93.0%
*-commutative93.0%
Simplified93.0%
Taylor expanded in y around 0 93.0%
*-commutative93.0%
associate-/r*93.0%
div-sub96.6%
Simplified96.6%
Final simplification94.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x (* y z)) (- t (* z a)))))
(if (<= t_1 -5e-304)
t_1
(if (<= t_1 0.0)
(- (/ y a) (* (/ x a) (/ 1.0 z)))
(if (<= t_1 5e+301) t_1 (/ (- y (/ x z)) 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-304) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (y / a) - ((x / a) * (1.0 / z));
} else if (t_1 <= 5e+301) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (x - (y * z)) / (t - (z * a))
if (t_1 <= (-5d-304)) then
tmp = t_1
else if (t_1 <= 0.0d0) then
tmp = (y / a) - ((x / a) * (1.0d0 / z))
else if (t_1 <= 5d+301) then
tmp = t_1
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 t_1 = (x - (y * z)) / (t - (z * a));
double tmp;
if (t_1 <= -5e-304) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (y / a) - ((x / a) * (1.0 / z));
} else if (t_1 <= 5e+301) {
tmp = t_1;
} else {
tmp = (y - (x / z)) / a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (y * z)) / (t - (z * a)) tmp = 0 if t_1 <= -5e-304: tmp = t_1 elif t_1 <= 0.0: tmp = (y / a) - ((x / a) * (1.0 / z)) elif t_1 <= 5e+301: tmp = t_1 else: tmp = (y - (x / z)) / 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-304) tmp = t_1; elseif (t_1 <= 0.0) tmp = Float64(Float64(y / a) - Float64(Float64(x / a) * Float64(1.0 / z))); elseif (t_1 <= 5e+301) tmp = t_1; else tmp = Float64(Float64(y - Float64(x / z)) / 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-304) tmp = t_1; elseif (t_1 <= 0.0) tmp = (y / a) - ((x / a) * (1.0 / z)); elseif (t_1 <= 5e+301) tmp = t_1; else tmp = (y - (x / z)) / 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-304], t$95$1, If[LessEqual[t$95$1, 0.0], N[(N[(y / a), $MachinePrecision] - N[(N[(x / a), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+301], t$95$1, N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / 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^{-304}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{y}{a} - \frac{x}{a} \cdot \frac{1}{z}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+301}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < -4.99999999999999965e-304 or 0.0 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 5.0000000000000004e301Initial program 97.7%
if -4.99999999999999965e-304 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) < 0.0Initial program 51.3%
*-commutative51.3%
Simplified51.3%
Taylor expanded in t around 0 22.4%
associate-*r/22.4%
neg-mul-122.4%
neg-sub022.4%
sub-neg22.4%
distribute-rgt-neg-out22.4%
+-commutative22.4%
associate--r+22.4%
neg-sub022.4%
distribute-rgt-neg-out22.4%
remove-double-neg22.4%
*-commutative22.4%
Simplified22.4%
Taylor expanded in y around 0 36.3%
+-commutative36.3%
mul-1-neg36.3%
unsub-neg36.3%
*-commutative36.3%
Simplified36.3%
*-un-lft-identity36.3%
times-frac70.8%
Applied egg-rr70.8%
if 5.0000000000000004e301 < (/.f64 (-.f64 x (*.f64 y z)) (-.f64 t (*.f64 a z))) Initial program 40.0%
*-commutative40.0%
Simplified40.0%
Taylor expanded in t around 0 40.0%
associate-*r/40.0%
neg-mul-140.0%
neg-sub040.0%
sub-neg40.0%
distribute-rgt-neg-out40.0%
+-commutative40.0%
associate--r+40.0%
neg-sub040.0%
distribute-rgt-neg-out40.0%
remove-double-neg40.0%
*-commutative40.0%
Simplified40.0%
Taylor expanded in y around 0 93.0%
+-commutative93.0%
mul-1-neg93.0%
unsub-neg93.0%
*-commutative93.0%
Simplified93.0%
Taylor expanded in y around 0 93.0%
*-commutative93.0%
associate-/r*93.0%
div-sub96.6%
Simplified96.6%
Final simplification94.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -6.2e+57)
(/ y a)
(if (<= z -1.1e-7)
(* (- y) (/ z t))
(if (or (<= z -1.32e-83) (not (<= z 4.4e+52))) (/ y a) (/ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.2e+57) {
tmp = y / a;
} else if (z <= -1.1e-7) {
tmp = -y * (z / t);
} else if ((z <= -1.32e-83) || !(z <= 4.4e+52)) {
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 <= (-6.2d+57)) then
tmp = y / a
else if (z <= (-1.1d-7)) then
tmp = -y * (z / t)
else if ((z <= (-1.32d-83)) .or. (.not. (z <= 4.4d+52))) 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 <= -6.2e+57) {
tmp = y / a;
} else if (z <= -1.1e-7) {
tmp = -y * (z / t);
} else if ((z <= -1.32e-83) || !(z <= 4.4e+52)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6.2e+57: tmp = y / a elif z <= -1.1e-7: tmp = -y * (z / t) elif (z <= -1.32e-83) or not (z <= 4.4e+52): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.2e+57) tmp = Float64(y / a); elseif (z <= -1.1e-7) tmp = Float64(Float64(-y) * Float64(z / t)); elseif ((z <= -1.32e-83) || !(z <= 4.4e+52)) 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 <= -6.2e+57) tmp = y / a; elseif (z <= -1.1e-7) tmp = -y * (z / t); elseif ((z <= -1.32e-83) || ~((z <= 4.4e+52))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.2e+57], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.1e-7], N[((-y) * N[(z / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.32e-83], N[Not[LessEqual[z, 4.4e+52]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+57}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-7}:\\
\;\;\;\;\left(-y\right) \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq -1.32 \cdot 10^{-83} \lor \neg \left(z \leq 4.4 \cdot 10^{+52}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -6.20000000000000026e57 or -1.1000000000000001e-7 < z < -1.31999999999999994e-83 or 4.4e52 < z Initial program 68.3%
*-commutative68.3%
Simplified68.3%
Taylor expanded in z around inf 59.9%
if -6.20000000000000026e57 < z < -1.1000000000000001e-7Initial program 99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in t around inf 55.2%
Taylor expanded in x around 0 41.9%
neg-mul-141.9%
associate-/l*41.7%
distribute-rgt-neg-in41.7%
distribute-neg-frac241.7%
Simplified41.7%
if -1.31999999999999994e-83 < z < 4.4e52Initial program 99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in z around 0 55.3%
Final simplification56.1%
(FPCore (x y z t a)
:precision binary64
(if (<= z -9.5e+55)
(/ y a)
(if (<= z -2.6e-7)
(/ (* y z) (- t))
(if (or (<= z -1.3e-81) (not (<= z 5.3e+51))) (/ y a) (/ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.5e+55) {
tmp = y / a;
} else if (z <= -2.6e-7) {
tmp = (y * z) / -t;
} else if ((z <= -1.3e-81) || !(z <= 5.3e+51)) {
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 <= (-9.5d+55)) then
tmp = y / a
else if (z <= (-2.6d-7)) then
tmp = (y * z) / -t
else if ((z <= (-1.3d-81)) .or. (.not. (z <= 5.3d+51))) 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 <= -9.5e+55) {
tmp = y / a;
} else if (z <= -2.6e-7) {
tmp = (y * z) / -t;
} else if ((z <= -1.3e-81) || !(z <= 5.3e+51)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -9.5e+55: tmp = y / a elif z <= -2.6e-7: tmp = (y * z) / -t elif (z <= -1.3e-81) or not (z <= 5.3e+51): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.5e+55) tmp = Float64(y / a); elseif (z <= -2.6e-7) tmp = Float64(Float64(y * z) / Float64(-t)); elseif ((z <= -1.3e-81) || !(z <= 5.3e+51)) 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 <= -9.5e+55) tmp = y / a; elseif (z <= -2.6e-7) tmp = (y * z) / -t; elseif ((z <= -1.3e-81) || ~((z <= 5.3e+51))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.5e+55], N[(y / a), $MachinePrecision], If[LessEqual[z, -2.6e-7], N[(N[(y * z), $MachinePrecision] / (-t)), $MachinePrecision], If[Or[LessEqual[z, -1.3e-81], N[Not[LessEqual[z, 5.3e+51]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+55}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{-7}:\\
\;\;\;\;\frac{y \cdot z}{-t}\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{-81} \lor \neg \left(z \leq 5.3 \cdot 10^{+51}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -9.49999999999999989e55 or -2.59999999999999999e-7 < z < -1.2999999999999999e-81 or 5.2999999999999997e51 < z Initial program 68.3%
*-commutative68.3%
Simplified68.3%
Taylor expanded in z around inf 59.9%
if -9.49999999999999989e55 < z < -2.59999999999999999e-7Initial program 99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in t around inf 55.2%
Taylor expanded in x around 0 41.9%
mul-1-neg41.9%
distribute-rgt-neg-out41.9%
Simplified41.9%
if -1.2999999999999999e-81 < z < 5.2999999999999997e51Initial program 99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in z around 0 55.3%
Final simplification56.1%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.35e+56)
(/ y a)
(if (<= z -1.46e-230)
(/ (- x (* y z)) t)
(if (<= z 6e+82) (/ x (- t (* z a))) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.35e+56) {
tmp = y / a;
} else if (z <= -1.46e-230) {
tmp = (x - (y * z)) / t;
} else if (z <= 6e+82) {
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 <= (-1.35d+56)) then
tmp = y / a
else if (z <= (-1.46d-230)) then
tmp = (x - (y * z)) / t
else if (z <= 6d+82) 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 <= -1.35e+56) {
tmp = y / a;
} else if (z <= -1.46e-230) {
tmp = (x - (y * z)) / t;
} else if (z <= 6e+82) {
tmp = x / (t - (z * a));
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.35e+56: tmp = y / a elif z <= -1.46e-230: tmp = (x - (y * z)) / t elif z <= 6e+82: tmp = x / (t - (z * a)) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.35e+56) tmp = Float64(y / a); elseif (z <= -1.46e-230) tmp = Float64(Float64(x - Float64(y * z)) / t); elseif (z <= 6e+82) 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 <= -1.35e+56) tmp = y / a; elseif (z <= -1.46e-230) tmp = (x - (y * z)) / t; elseif (z <= 6e+82) tmp = x / (t - (z * a)); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.35e+56], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.46e-230], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 6e+82], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+56}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.46 \cdot 10^{-230}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+82}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.35000000000000005e56 or 5.99999999999999978e82 < z Initial program 60.6%
*-commutative60.6%
Simplified60.6%
Taylor expanded in z around inf 62.1%
if -1.35000000000000005e56 < z < -1.4599999999999999e-230Initial program 99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in t around inf 65.2%
if -1.4599999999999999e-230 < z < 5.99999999999999978e82Initial program 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in x around inf 75.6%
*-commutative75.6%
Simplified75.6%
Final simplification68.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.35e+40) (not (<= a 7.8e+26))) (- (/ y a) (* (/ x a) (/ 1.0 z))) (/ (- x (* y z)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.35e+40) || !(a <= 7.8e+26)) {
tmp = (y / a) - ((x / a) * (1.0 / z));
} 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 ((a <= (-1.35d+40)) .or. (.not. (a <= 7.8d+26))) then
tmp = (y / a) - ((x / a) * (1.0d0 / z))
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 ((a <= -1.35e+40) || !(a <= 7.8e+26)) {
tmp = (y / a) - ((x / a) * (1.0 / z));
} else {
tmp = (x - (y * z)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.35e+40) or not (a <= 7.8e+26): tmp = (y / a) - ((x / a) * (1.0 / z)) else: tmp = (x - (y * z)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.35e+40) || !(a <= 7.8e+26)) tmp = Float64(Float64(y / a) - Float64(Float64(x / a) * Float64(1.0 / z))); 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 ((a <= -1.35e+40) || ~((a <= 7.8e+26))) tmp = (y / a) - ((x / a) * (1.0 / z)); else tmp = (x - (y * z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.35e+40], N[Not[LessEqual[a, 7.8e+26]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] - N[(N[(x / a), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.35 \cdot 10^{+40} \lor \neg \left(a \leq 7.8 \cdot 10^{+26}\right):\\
\;\;\;\;\frac{y}{a} - \frac{x}{a} \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\end{array}
\end{array}
if a < -1.35000000000000005e40 or 7.8e26 < a Initial program 75.5%
*-commutative75.5%
Simplified75.5%
Taylor expanded in t around 0 50.7%
associate-*r/50.7%
neg-mul-150.7%
neg-sub050.7%
sub-neg50.7%
distribute-rgt-neg-out50.7%
+-commutative50.7%
associate--r+50.7%
neg-sub050.7%
distribute-rgt-neg-out50.7%
remove-double-neg50.7%
*-commutative50.7%
Simplified50.7%
Taylor expanded in y around 0 66.6%
+-commutative66.6%
mul-1-neg66.6%
unsub-neg66.6%
*-commutative66.6%
Simplified66.6%
*-un-lft-identity66.6%
times-frac73.9%
Applied egg-rr73.9%
if -1.35000000000000005e40 < a < 7.8e26Initial program 95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in t around inf 75.6%
Final simplification74.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.9e+59) (not (<= z 1.06e+86))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.9e+59) || !(z <= 1.06e+86)) {
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 <= (-2.9d+59)) .or. (.not. (z <= 1.06d+86))) 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 <= -2.9e+59) || !(z <= 1.06e+86)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.9e+59) or not (z <= 1.06e+86): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.9e+59) || !(z <= 1.06e+86)) 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 <= -2.9e+59) || ~((z <= 1.06e+86))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.9e+59], N[Not[LessEqual[z, 1.06e+86]], $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 -2.9 \cdot 10^{+59} \lor \neg \left(z \leq 1.06 \cdot 10^{+86}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -2.89999999999999991e59 or 1.06e86 < z Initial program 60.6%
*-commutative60.6%
Simplified60.6%
Taylor expanded in z around inf 62.1%
if -2.89999999999999991e59 < z < 1.06e86Initial program 99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in x around inf 65.7%
*-commutative65.7%
Simplified65.7%
Final simplification64.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -8.2e+45) (not (<= a 4.7e+25))) (/ (- y (/ x z)) a) (/ (- x (* y z)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8.2e+45) || !(a <= 4.7e+25)) {
tmp = (y - (x / z)) / 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 ((a <= (-8.2d+45)) .or. (.not. (a <= 4.7d+25))) then
tmp = (y - (x / z)) / 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 ((a <= -8.2e+45) || !(a <= 4.7e+25)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (y * z)) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -8.2e+45) or not (a <= 4.7e+25): tmp = (y - (x / z)) / a else: tmp = (x - (y * z)) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -8.2e+45) || !(a <= 4.7e+25)) tmp = Float64(Float64(y - Float64(x / z)) / 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 ((a <= -8.2e+45) || ~((a <= 4.7e+25))) tmp = (y - (x / z)) / a; else tmp = (x - (y * z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -8.2e+45], N[Not[LessEqual[a, 4.7e+25]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.2 \cdot 10^{+45} \lor \neg \left(a \leq 4.7 \cdot 10^{+25}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y \cdot z}{t}\\
\end{array}
\end{array}
if a < -8.20000000000000025e45 or 4.6999999999999998e25 < a Initial program 75.5%
*-commutative75.5%
Simplified75.5%
Taylor expanded in t around 0 50.7%
associate-*r/50.7%
neg-mul-150.7%
neg-sub050.7%
sub-neg50.7%
distribute-rgt-neg-out50.7%
+-commutative50.7%
associate--r+50.7%
neg-sub050.7%
distribute-rgt-neg-out50.7%
remove-double-neg50.7%
*-commutative50.7%
Simplified50.7%
Taylor expanded in y around 0 66.6%
+-commutative66.6%
mul-1-neg66.6%
unsub-neg66.6%
*-commutative66.6%
Simplified66.6%
Taylor expanded in y around 0 66.6%
*-commutative66.6%
associate-/r*68.8%
div-sub68.9%
Simplified68.9%
if -8.20000000000000025e45 < a < 4.6999999999999998e25Initial program 95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in t around inf 75.6%
Final simplification72.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.35e-81) (not (<= z 5.3e+51))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.35e-81) || !(z <= 5.3e+51)) {
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 <= (-1.35d-81)) .or. (.not. (z <= 5.3d+51))) 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 <= -1.35e-81) || !(z <= 5.3e+51)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.35e-81) or not (z <= 5.3e+51): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.35e-81) || !(z <= 5.3e+51)) 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 <= -1.35e-81) || ~((z <= 5.3e+51))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.35e-81], N[Not[LessEqual[z, 5.3e+51]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{-81} \lor \neg \left(z \leq 5.3 \cdot 10^{+51}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -1.34999999999999995e-81 or 5.2999999999999997e51 < z Initial program 73.3%
*-commutative73.3%
Simplified73.3%
Taylor expanded in z around inf 52.4%
if -1.34999999999999995e-81 < z < 5.2999999999999997e51Initial program 99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in z around 0 55.3%
Final simplification53.9%
(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 86.2%
*-commutative86.2%
Simplified86.2%
Taylor expanded in z around 0 34.2%
Final simplification34.2%
(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 2024071
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:alt
(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))))