
(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 9 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 -2.8e+90) (- (/ y a) (/ (/ x a) z)) (if (<= z 3.4e+111) (/ (- 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 <= -2.8e+90) {
tmp = (y / a) - ((x / a) / z);
} else if (z <= 3.4e+111) {
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 <= (-2.8d+90)) then
tmp = (y / a) - ((x / a) / z)
else if (z <= 3.4d+111) 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 <= -2.8e+90) {
tmp = (y / a) - ((x / a) / z);
} else if (z <= 3.4e+111) {
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 <= -2.8e+90: tmp = (y / a) - ((x / a) / z) elif z <= 3.4e+111: 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 <= -2.8e+90) tmp = Float64(Float64(y / a) - Float64(Float64(x / a) / z)); elseif (z <= 3.4e+111) 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 <= -2.8e+90) tmp = (y / a) - ((x / a) / z); elseif (z <= 3.4e+111) 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, -2.8e+90], N[(N[(y / a), $MachinePrecision] - N[(N[(x / a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.4e+111], 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 -2.8 \cdot 10^{+90}:\\
\;\;\;\;\frac{y}{a} - \frac{\frac{x}{a}}{z}\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+111}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
\end{array}
if z < -2.8e90Initial program 53.0%
*-commutative53.0%
Simplified53.0%
Taylor expanded in y around inf 46.6%
Taylor expanded in t around 0 46.5%
associate-*r/46.5%
mul-1-neg46.5%
distribute-rgt-neg-out46.5%
*-commutative46.5%
times-frac63.9%
sub-neg63.9%
+-commutative63.9%
distribute-neg-in63.9%
remove-double-neg63.9%
unsub-neg63.9%
Simplified63.9%
Taylor expanded in y around 0 81.3%
+-commutative81.3%
mul-1-neg81.3%
unsub-neg81.3%
associate-/r*90.1%
Simplified90.1%
if -2.8e90 < z < 3.4000000000000001e111Initial program 98.2%
if 3.4000000000000001e111 < z Initial program 55.4%
*-commutative55.4%
Simplified55.4%
Taylor expanded in z around inf 55.4%
Taylor expanded in x around 0 84.8%
associate-*r/84.8%
mul-1-neg84.8%
Simplified84.8%
Final simplification94.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.1e+83)
(/ y a)
(if (<= z -7e-36)
(/ (/ x z) (- a))
(if (<= z -1.25e-202)
(/ (* z y) (- t))
(if (<= z 1.55e+82) (/ x t) (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.1e+83) {
tmp = y / a;
} else if (z <= -7e-36) {
tmp = (x / z) / -a;
} else if (z <= -1.25e-202) {
tmp = (z * y) / -t;
} else if (z <= 1.55e+82) {
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 <= (-3.1d+83)) then
tmp = y / a
else if (z <= (-7d-36)) then
tmp = (x / z) / -a
else if (z <= (-1.25d-202)) then
tmp = (z * y) / -t
else if (z <= 1.55d+82) 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 <= -3.1e+83) {
tmp = y / a;
} else if (z <= -7e-36) {
tmp = (x / z) / -a;
} else if (z <= -1.25e-202) {
tmp = (z * y) / -t;
} else if (z <= 1.55e+82) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.1e+83: tmp = y / a elif z <= -7e-36: tmp = (x / z) / -a elif z <= -1.25e-202: tmp = (z * y) / -t elif z <= 1.55e+82: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.1e+83) tmp = Float64(y / a); elseif (z <= -7e-36) tmp = Float64(Float64(x / z) / Float64(-a)); elseif (z <= -1.25e-202) tmp = Float64(Float64(z * y) / Float64(-t)); elseif (z <= 1.55e+82) 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 <= -3.1e+83) tmp = y / a; elseif (z <= -7e-36) tmp = (x / z) / -a; elseif (z <= -1.25e-202) tmp = (z * y) / -t; elseif (z <= 1.55e+82) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.1e+83], N[(y / a), $MachinePrecision], If[LessEqual[z, -7e-36], N[(N[(x / z), $MachinePrecision] / (-a)), $MachinePrecision], If[LessEqual[z, -1.25e-202], N[(N[(z * y), $MachinePrecision] / (-t)), $MachinePrecision], If[LessEqual[z, 1.55e+82], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+83}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -7 \cdot 10^{-36}:\\
\;\;\;\;\frac{\frac{x}{z}}{-a}\\
\mathbf{elif}\;z \leq -1.25 \cdot 10^{-202}:\\
\;\;\;\;\frac{z \cdot y}{-t}\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+82}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -3.09999999999999992e83 or 1.55000000000000016e82 < z Initial program 57.4%
*-commutative57.4%
Simplified57.4%
Taylor expanded in z around inf 70.2%
if -3.09999999999999992e83 < z < -6.9999999999999999e-36Initial program 88.3%
*-commutative88.3%
Simplified88.3%
Taylor expanded in z around inf 88.3%
Taylor expanded in x around inf 57.5%
associate-/r*65.1%
Simplified65.1%
Taylor expanded in t around 0 49.9%
neg-mul-149.9%
Simplified49.9%
if -6.9999999999999999e-36 < z < -1.24999999999999993e-202Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in x around 0 53.8%
mul-1-neg53.8%
associate-/l*46.9%
distribute-rgt-neg-in46.9%
distribute-neg-frac246.9%
cancel-sign-sub-inv46.9%
*-commutative46.9%
+-commutative46.9%
distribute-rgt-neg-out46.9%
distribute-lft-neg-in46.9%
*-commutative46.9%
fma-undefine46.9%
neg-sub046.9%
fma-undefine46.9%
distribute-rgt-neg-in46.9%
mul-1-neg46.9%
associate-*r*46.9%
neg-mul-146.9%
*-commutative46.9%
associate--r+46.9%
neg-sub046.9%
distribute-rgt-neg-out46.9%
remove-double-neg46.9%
Simplified46.9%
Taylor expanded in z around 0 49.5%
associate-*r/49.5%
*-commutative49.5%
neg-mul-149.5%
distribute-lft-neg-in49.5%
Simplified49.5%
if -1.24999999999999993e-202 < z < 1.55000000000000016e82Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 55.7%
Final simplification58.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.5e+88)
(/ y a)
(if (<= z -1.5e-43)
(/ (/ x a) (- z))
(if (<= z -5.1e-203)
(/ (* z y) (- t))
(if (<= z 1.35e+82) (/ x t) (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+88) {
tmp = y / a;
} else if (z <= -1.5e-43) {
tmp = (x / a) / -z;
} else if (z <= -5.1e-203) {
tmp = (z * y) / -t;
} else if (z <= 1.35e+82) {
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 <= (-3.5d+88)) then
tmp = y / a
else if (z <= (-1.5d-43)) then
tmp = (x / a) / -z
else if (z <= (-5.1d-203)) then
tmp = (z * y) / -t
else if (z <= 1.35d+82) 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 <= -3.5e+88) {
tmp = y / a;
} else if (z <= -1.5e-43) {
tmp = (x / a) / -z;
} else if (z <= -5.1e-203) {
tmp = (z * y) / -t;
} else if (z <= 1.35e+82) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.5e+88: tmp = y / a elif z <= -1.5e-43: tmp = (x / a) / -z elif z <= -5.1e-203: tmp = (z * y) / -t elif z <= 1.35e+82: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.5e+88) tmp = Float64(y / a); elseif (z <= -1.5e-43) tmp = Float64(Float64(x / a) / Float64(-z)); elseif (z <= -5.1e-203) tmp = Float64(Float64(z * y) / Float64(-t)); elseif (z <= 1.35e+82) 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 <= -3.5e+88) tmp = y / a; elseif (z <= -1.5e-43) tmp = (x / a) / -z; elseif (z <= -5.1e-203) tmp = (z * y) / -t; elseif (z <= 1.35e+82) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.5e+88], N[(y / a), $MachinePrecision], If[LessEqual[z, -1.5e-43], N[(N[(x / a), $MachinePrecision] / (-z)), $MachinePrecision], If[LessEqual[z, -5.1e-203], N[(N[(z * y), $MachinePrecision] / (-t)), $MachinePrecision], If[LessEqual[z, 1.35e+82], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+88}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{-43}:\\
\;\;\;\;\frac{\frac{x}{a}}{-z}\\
\mathbf{elif}\;z \leq -5.1 \cdot 10^{-203}:\\
\;\;\;\;\frac{z \cdot y}{-t}\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+82}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -3.4999999999999998e88 or 1.35e82 < z Initial program 57.4%
*-commutative57.4%
Simplified57.4%
Taylor expanded in z around inf 70.2%
if -3.4999999999999998e88 < z < -1.50000000000000002e-43Initial program 88.3%
*-commutative88.3%
Simplified88.3%
Taylor expanded in x around inf 57.5%
*-commutative57.5%
Simplified57.5%
Taylor expanded in t around 0 42.1%
mul-1-neg42.1%
associate-/r*49.7%
distribute-neg-frac249.7%
Simplified49.7%
if -1.50000000000000002e-43 < z < -5.09999999999999985e-203Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in x around 0 53.8%
mul-1-neg53.8%
associate-/l*46.9%
distribute-rgt-neg-in46.9%
distribute-neg-frac246.9%
cancel-sign-sub-inv46.9%
*-commutative46.9%
+-commutative46.9%
distribute-rgt-neg-out46.9%
distribute-lft-neg-in46.9%
*-commutative46.9%
fma-undefine46.9%
neg-sub046.9%
fma-undefine46.9%
distribute-rgt-neg-in46.9%
mul-1-neg46.9%
associate-*r*46.9%
neg-mul-146.9%
*-commutative46.9%
associate--r+46.9%
neg-sub046.9%
distribute-rgt-neg-out46.9%
remove-double-neg46.9%
Simplified46.9%
Taylor expanded in z around 0 49.5%
associate-*r/49.5%
*-commutative49.5%
neg-mul-149.5%
distribute-lft-neg-in49.5%
Simplified49.5%
if -5.09999999999999985e-203 < z < 1.35e82Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 55.7%
Final simplification58.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.6e-35)
(- (/ y a) (/ (/ x a) z))
(if (<= z -1.1e-304)
(/ (- x (* z y)) t)
(if (<= z 3.7e+98) (/ 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.6e-35) {
tmp = (y / a) - ((x / a) / z);
} else if (z <= -1.1e-304) {
tmp = (x - (z * y)) / t;
} else if (z <= 3.7e+98) {
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.6d-35)) then
tmp = (y / a) - ((x / a) / z)
else if (z <= (-1.1d-304)) then
tmp = (x - (z * y)) / t
else if (z <= 3.7d+98) 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.6e-35) {
tmp = (y / a) - ((x / a) / z);
} else if (z <= -1.1e-304) {
tmp = (x - (z * y)) / t;
} else if (z <= 3.7e+98) {
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.6e-35: tmp = (y / a) - ((x / a) / z) elif z <= -1.1e-304: tmp = (x - (z * y)) / t elif z <= 3.7e+98: 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.6e-35) tmp = Float64(Float64(y / a) - Float64(Float64(x / a) / z)); elseif (z <= -1.1e-304) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 3.7e+98) 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.6e-35) tmp = (y / a) - ((x / a) / z); elseif (z <= -1.1e-304) tmp = (x - (z * y)) / t; elseif (z <= 3.7e+98) 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.6e-35], N[(N[(y / a), $MachinePrecision] - N[(N[(x / a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.1e-304], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 3.7e+98], 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.6 \cdot 10^{-35}:\\
\;\;\;\;\frac{y}{a} - \frac{\frac{x}{a}}{z}\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-304}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+98}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - \frac{t}{z}}\\
\end{array}
\end{array}
if z < -1.5999999999999999e-35Initial program 66.8%
*-commutative66.8%
Simplified66.8%
Taylor expanded in y around inf 56.7%
Taylor expanded in t around 0 46.0%
associate-*r/46.0%
mul-1-neg46.0%
distribute-rgt-neg-out46.0%
*-commutative46.0%
times-frac56.8%
sub-neg56.8%
+-commutative56.8%
distribute-neg-in56.8%
remove-double-neg56.8%
unsub-neg56.8%
Simplified56.8%
Taylor expanded in y around 0 70.4%
+-commutative70.4%
mul-1-neg70.4%
unsub-neg70.4%
associate-/r*78.7%
Simplified78.7%
if -1.5999999999999999e-35 < z < -1.1e-304Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 84.0%
if -1.1e-304 < z < 3.6999999999999999e98Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 76.5%
*-commutative76.5%
Simplified76.5%
if 3.6999999999999999e98 < z Initial program 58.4%
*-commutative58.4%
Simplified58.4%
Taylor expanded in z around inf 58.4%
Taylor expanded in x around 0 85.8%
associate-*r/85.8%
mul-1-neg85.8%
Simplified85.8%
Final simplification80.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ y (- a (/ t z)))))
(if (<= z -5.8e-9)
t_1
(if (<= z 2.9e-306)
(/ (- x (* z y)) t)
(if (<= z 1.28e+98) (/ 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 <= -5.8e-9) {
tmp = t_1;
} else if (z <= 2.9e-306) {
tmp = (x - (z * y)) / t;
} else if (z <= 1.28e+98) {
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 <= (-5.8d-9)) then
tmp = t_1
else if (z <= 2.9d-306) then
tmp = (x - (z * y)) / t
else if (z <= 1.28d+98) 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 <= -5.8e-9) {
tmp = t_1;
} else if (z <= 2.9e-306) {
tmp = (x - (z * y)) / t;
} else if (z <= 1.28e+98) {
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 <= -5.8e-9: tmp = t_1 elif z <= 2.9e-306: tmp = (x - (z * y)) / t elif z <= 1.28e+98: 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 <= -5.8e-9) tmp = t_1; elseif (z <= 2.9e-306) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 1.28e+98) 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 <= -5.8e-9) tmp = t_1; elseif (z <= 2.9e-306) tmp = (x - (z * y)) / t; elseif (z <= 1.28e+98) 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, -5.8e-9], t$95$1, If[LessEqual[z, 2.9e-306], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1.28e+98], 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 -5.8 \cdot 10^{-9}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-306}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 1.28 \cdot 10^{+98}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.79999999999999982e-9 or 1.28000000000000006e98 < z Initial program 62.4%
*-commutative62.4%
Simplified62.4%
Taylor expanded in z around inf 62.4%
Taylor expanded in x around 0 76.3%
associate-*r/76.3%
mul-1-neg76.3%
Simplified76.3%
if -5.79999999999999982e-9 < z < 2.8999999999999999e-306Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 83.2%
if 2.8999999999999999e-306 < z < 1.28000000000000006e98Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 76.5%
*-commutative76.5%
Simplified76.5%
Final simplification78.1%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.6e+43)
(/ y a)
(if (<= z -6.4e-305)
(/ (- x (* z y)) t)
(if (<= z 7.2e+99) (/ x (- t (* z a))) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.6e+43) {
tmp = y / a;
} else if (z <= -6.4e-305) {
tmp = (x - (z * y)) / t;
} else if (z <= 7.2e+99) {
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 <= (-2.6d+43)) then
tmp = y / a
else if (z <= (-6.4d-305)) then
tmp = (x - (z * y)) / t
else if (z <= 7.2d+99) 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 <= -2.6e+43) {
tmp = y / a;
} else if (z <= -6.4e-305) {
tmp = (x - (z * y)) / t;
} else if (z <= 7.2e+99) {
tmp = x / (t - (z * a));
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.6e+43: tmp = y / a elif z <= -6.4e-305: tmp = (x - (z * y)) / t elif z <= 7.2e+99: tmp = x / (t - (z * a)) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.6e+43) tmp = Float64(y / a); elseif (z <= -6.4e-305) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 7.2e+99) 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 <= -2.6e+43) tmp = y / a; elseif (z <= -6.4e-305) tmp = (x - (z * y)) / t; elseif (z <= 7.2e+99) tmp = x / (t - (z * a)); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.6e+43], N[(y / a), $MachinePrecision], If[LessEqual[z, -6.4e-305], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 7.2e+99], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+43}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq -6.4 \cdot 10^{-305}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+99}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.60000000000000021e43 or 7.2000000000000003e99 < z Initial program 58.5%
*-commutative58.5%
Simplified58.5%
Taylor expanded in z around inf 67.3%
if -2.60000000000000021e43 < z < -6.40000000000000018e-305Initial program 98.5%
*-commutative98.5%
Simplified98.5%
Taylor expanded in t around inf 77.1%
if -6.40000000000000018e-305 < z < 7.2000000000000003e99Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 76.5%
*-commutative76.5%
Simplified76.5%
Final simplification73.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.4e+81) (not (<= z 6.8e+99))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.4e+81) || !(z <= 6.8e+99)) {
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 <= (-3.4d+81)) .or. (.not. (z <= 6.8d+99))) 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 <= -3.4e+81) || !(z <= 6.8e+99)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.4e+81) or not (z <= 6.8e+99): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.4e+81) || !(z <= 6.8e+99)) 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 <= -3.4e+81) || ~((z <= 6.8e+99))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.4e+81], N[Not[LessEqual[z, 6.8e+99]], $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 -3.4 \cdot 10^{+81} \lor \neg \left(z \leq 6.8 \cdot 10^{+99}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -3.40000000000000003e81 or 6.79999999999999968e99 < z Initial program 55.9%
*-commutative55.9%
Simplified55.9%
Taylor expanded in z around inf 71.5%
if -3.40000000000000003e81 < z < 6.79999999999999968e99Initial program 98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in x around inf 69.2%
*-commutative69.2%
Simplified69.2%
Final simplification70.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7e+37) (not (<= z 1.35e+82))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7e+37) || !(z <= 1.35e+82)) {
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 <= (-7d+37)) .or. (.not. (z <= 1.35d+82))) 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 <= -7e+37) || !(z <= 1.35e+82)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7e+37) or not (z <= 1.35e+82): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7e+37) || !(z <= 1.35e+82)) 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 <= -7e+37) || ~((z <= 1.35e+82))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7e+37], N[Not[LessEqual[z, 1.35e+82]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+37} \lor \neg \left(z \leq 1.35 \cdot 10^{+82}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -7e37 or 1.35e82 < z Initial program 60.7%
*-commutative60.7%
Simplified60.7%
Taylor expanded in z around inf 65.3%
if -7e37 < z < 1.35e82Initial program 99.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in z around 0 50.7%
Final simplification56.3%
(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.4%
*-commutative84.4%
Simplified84.4%
Taylor expanded in z around 0 35.6%
(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 2024090
(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))))