
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x - y) / (z - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x - y) / (z - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x - y) / (z - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
Initial program 98.4%
(FPCore (x y z t) :precision binary64 (if (<= y -8e-24) t (if (<= y 5.6e-25) (/ (* x t) z) (if (<= y 9.8e+113) (* (- t) (/ x y)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8e-24) {
tmp = t;
} else if (y <= 5.6e-25) {
tmp = (x * t) / z;
} else if (y <= 9.8e+113) {
tmp = -t * (x / y);
} else {
tmp = t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-8d-24)) then
tmp = t
else if (y <= 5.6d-25) then
tmp = (x * t) / z
else if (y <= 9.8d+113) then
tmp = -t * (x / y)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8e-24) {
tmp = t;
} else if (y <= 5.6e-25) {
tmp = (x * t) / z;
} else if (y <= 9.8e+113) {
tmp = -t * (x / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8e-24: tmp = t elif y <= 5.6e-25: tmp = (x * t) / z elif y <= 9.8e+113: tmp = -t * (x / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8e-24) tmp = t; elseif (y <= 5.6e-25) tmp = Float64(Float64(x * t) / z); elseif (y <= 9.8e+113) tmp = Float64(Float64(-t) * Float64(x / y)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8e-24) tmp = t; elseif (y <= 5.6e-25) tmp = (x * t) / z; elseif (y <= 9.8e+113) tmp = -t * (x / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8e-24], t, If[LessEqual[y, 5.6e-25], N[(N[(x * t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 9.8e+113], N[((-t) * N[(x / y), $MachinePrecision]), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{-24}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{-25}:\\
\;\;\;\;\frac{x \cdot t}{z}\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{+113}:\\
\;\;\;\;\left(-t\right) \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -7.99999999999999939e-24 or 9.80000000000000043e113 < y Initial program 99.8%
associate-*l/68.1%
associate-/l*74.4%
Simplified74.4%
Taylor expanded in y around inf 63.7%
if -7.99999999999999939e-24 < y < 5.59999999999999976e-25Initial program 96.9%
associate-*l/96.2%
associate-/l*94.1%
Simplified94.1%
Taylor expanded in y around 0 65.0%
if 5.59999999999999976e-25 < y < 9.80000000000000043e113Initial program 99.8%
Taylor expanded in z around 0 78.6%
associate-*r/78.6%
neg-mul-178.6%
neg-sub078.6%
sub-neg78.6%
+-commutative78.6%
associate--r+78.6%
neg-sub078.6%
remove-double-neg78.6%
Simplified78.6%
Taylor expanded in y around 0 62.0%
neg-mul-162.0%
distribute-neg-frac62.0%
Simplified62.0%
Final simplification64.2%
(FPCore (x y z t)
:precision binary64
(if (<= y -2.45e-20)
t
(if (<= y 3.1e-28)
(/ (* x t) z)
(if (<= y 1.85e+114) (* x (/ t (- y))) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.45e-20) {
tmp = t;
} else if (y <= 3.1e-28) {
tmp = (x * t) / z;
} else if (y <= 1.85e+114) {
tmp = x * (t / -y);
} else {
tmp = t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-2.45d-20)) then
tmp = t
else if (y <= 3.1d-28) then
tmp = (x * t) / z
else if (y <= 1.85d+114) then
tmp = x * (t / -y)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.45e-20) {
tmp = t;
} else if (y <= 3.1e-28) {
tmp = (x * t) / z;
} else if (y <= 1.85e+114) {
tmp = x * (t / -y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.45e-20: tmp = t elif y <= 3.1e-28: tmp = (x * t) / z elif y <= 1.85e+114: tmp = x * (t / -y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.45e-20) tmp = t; elseif (y <= 3.1e-28) tmp = Float64(Float64(x * t) / z); elseif (y <= 1.85e+114) tmp = Float64(x * Float64(t / Float64(-y))); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.45e-20) tmp = t; elseif (y <= 3.1e-28) tmp = (x * t) / z; elseif (y <= 1.85e+114) tmp = x * (t / -y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.45e-20], t, If[LessEqual[y, 3.1e-28], N[(N[(x * t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 1.85e+114], N[(x * N[(t / (-y)), $MachinePrecision]), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.45 \cdot 10^{-20}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{-28}:\\
\;\;\;\;\frac{x \cdot t}{z}\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+114}:\\
\;\;\;\;x \cdot \frac{t}{-y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -2.4500000000000001e-20 or 1.85e114 < y Initial program 99.8%
associate-*l/68.1%
associate-/l*74.4%
Simplified74.4%
Taylor expanded in y around inf 63.7%
if -2.4500000000000001e-20 < y < 3.09999999999999992e-28Initial program 96.9%
associate-*l/96.2%
associate-/l*94.1%
Simplified94.1%
Taylor expanded in y around 0 65.0%
if 3.09999999999999992e-28 < y < 1.85e114Initial program 99.8%
associate-*l/87.7%
associate-/l*95.9%
Simplified95.9%
Taylor expanded in x around inf 66.1%
Taylor expanded in z around 0 57.9%
associate-*r/57.9%
neg-mul-157.9%
Simplified57.9%
Final simplification63.9%
(FPCore (x y z t) :precision binary64 (if (<= y -1.5e+152) (* t (/ y (- y z))) (if (<= y 4.4e+142) (* (- x y) (/ t (- z y))) (* t (/ (- y x) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.5e+152) {
tmp = t * (y / (y - z));
} else if (y <= 4.4e+142) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t * ((y - x) / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.5d+152)) then
tmp = t * (y / (y - z))
else if (y <= 4.4d+142) then
tmp = (x - y) * (t / (z - y))
else
tmp = t * ((y - x) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.5e+152) {
tmp = t * (y / (y - z));
} else if (y <= 4.4e+142) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t * ((y - x) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.5e+152: tmp = t * (y / (y - z)) elif y <= 4.4e+142: tmp = (x - y) * (t / (z - y)) else: tmp = t * ((y - x) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.5e+152) tmp = Float64(t * Float64(y / Float64(y - z))); elseif (y <= 4.4e+142) tmp = Float64(Float64(x - y) * Float64(t / Float64(z - y))); else tmp = Float64(t * Float64(Float64(y - x) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.5e+152) tmp = t * (y / (y - z)); elseif (y <= 4.4e+142) tmp = (x - y) * (t / (z - y)); else tmp = t * ((y - x) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.5e+152], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.4e+142], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+152}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+142}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\end{array}
\end{array}
if y < -1.49999999999999995e152Initial program 99.8%
Taylor expanded in x around 0 81.5%
neg-mul-181.5%
distribute-neg-frac281.5%
neg-sub081.5%
sub-neg81.5%
+-commutative81.5%
associate--r+81.5%
neg-sub081.5%
remove-double-neg81.5%
Simplified81.5%
if -1.49999999999999995e152 < y < 4.39999999999999974e142Initial program 97.8%
associate-*l/91.5%
associate-/l*92.0%
Simplified92.0%
if 4.39999999999999974e142 < y Initial program 99.9%
Taylor expanded in z around 0 92.9%
associate-*r/92.9%
neg-mul-192.9%
neg-sub092.9%
sub-neg92.9%
+-commutative92.9%
associate--r+92.9%
neg-sub092.9%
remove-double-neg92.9%
Simplified92.9%
Final simplification90.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -16000000000000.0) (not (<= x 1.9e-19))) (/ t (/ (- z y) x)) (* t (/ y (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -16000000000000.0) || !(x <= 1.9e-19)) {
tmp = t / ((z - y) / x);
} else {
tmp = t * (y / (y - z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-16000000000000.0d0)) .or. (.not. (x <= 1.9d-19))) then
tmp = t / ((z - y) / x)
else
tmp = t * (y / (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -16000000000000.0) || !(x <= 1.9e-19)) {
tmp = t / ((z - y) / x);
} else {
tmp = t * (y / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -16000000000000.0) or not (x <= 1.9e-19): tmp = t / ((z - y) / x) else: tmp = t * (y / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -16000000000000.0) || !(x <= 1.9e-19)) tmp = Float64(t / Float64(Float64(z - y) / x)); else tmp = Float64(t * Float64(y / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -16000000000000.0) || ~((x <= 1.9e-19))) tmp = t / ((z - y) / x); else tmp = t * (y / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -16000000000000.0], N[Not[LessEqual[x, 1.9e-19]], $MachinePrecision]], N[(t / N[(N[(z - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -16000000000000 \lor \neg \left(x \leq 1.9 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{t}{\frac{z - y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\end{array}
\end{array}
if x < -1.6e13 or 1.9e-19 < x Initial program 99.0%
associate-*l/82.9%
associate-/l*86.2%
Simplified86.2%
associate-*r/82.9%
associate-*l/99.0%
*-commutative99.0%
clear-num98.9%
un-div-inv99.0%
Applied egg-rr99.0%
Taylor expanded in x around inf 79.3%
if -1.6e13 < x < 1.9e-19Initial program 97.7%
Taylor expanded in x around 0 84.0%
neg-mul-184.0%
distribute-neg-frac284.0%
neg-sub084.0%
sub-neg84.0%
+-commutative84.0%
associate--r+84.0%
neg-sub084.0%
remove-double-neg84.0%
Simplified84.0%
Final simplification81.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.1e-48) (not (<= z 1.7e-27))) (/ t (/ z (- x y))) (* t (/ (- y x) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.1e-48) || !(z <= 1.7e-27)) {
tmp = t / (z / (x - y));
} else {
tmp = t * ((y - x) / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-3.1d-48)) .or. (.not. (z <= 1.7d-27))) then
tmp = t / (z / (x - y))
else
tmp = t * ((y - x) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.1e-48) || !(z <= 1.7e-27)) {
tmp = t / (z / (x - y));
} else {
tmp = t * ((y - x) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.1e-48) or not (z <= 1.7e-27): tmp = t / (z / (x - y)) else: tmp = t * ((y - x) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.1e-48) || !(z <= 1.7e-27)) tmp = Float64(t / Float64(z / Float64(x - y))); else tmp = Float64(t * Float64(Float64(y - x) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.1e-48) || ~((z <= 1.7e-27))) tmp = t / (z / (x - y)); else tmp = t * ((y - x) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.1e-48], N[Not[LessEqual[z, 1.7e-27]], $MachinePrecision]], N[(t / N[(z / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{-48} \lor \neg \left(z \leq 1.7 \cdot 10^{-27}\right):\\
\;\;\;\;\frac{t}{\frac{z}{x - y}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\end{array}
\end{array}
if z < -3.10000000000000016e-48 or 1.69999999999999985e-27 < z Initial program 97.8%
associate-*l/84.4%
associate-/l*86.6%
Simplified86.6%
associate-*r/84.4%
associate-*l/97.8%
*-commutative97.8%
clear-num97.0%
un-div-inv97.1%
Applied egg-rr97.1%
Taylor expanded in z around inf 73.5%
if -3.10000000000000016e-48 < z < 1.69999999999999985e-27Initial program 99.1%
Taylor expanded in z around 0 88.2%
associate-*r/88.2%
neg-mul-188.2%
neg-sub088.2%
sub-neg88.2%
+-commutative88.2%
associate--r+88.2%
neg-sub088.2%
remove-double-neg88.2%
Simplified88.2%
Final simplification80.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -680000000000.0) (not (<= x 6.6e-19))) (* x (/ t (- z y))) (* t (/ y (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -680000000000.0) || !(x <= 6.6e-19)) {
tmp = x * (t / (z - y));
} else {
tmp = t * (y / (y - z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-680000000000.0d0)) .or. (.not. (x <= 6.6d-19))) then
tmp = x * (t / (z - y))
else
tmp = t * (y / (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -680000000000.0) || !(x <= 6.6e-19)) {
tmp = x * (t / (z - y));
} else {
tmp = t * (y / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -680000000000.0) or not (x <= 6.6e-19): tmp = x * (t / (z - y)) else: tmp = t * (y / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -680000000000.0) || !(x <= 6.6e-19)) tmp = Float64(x * Float64(t / Float64(z - y))); else tmp = Float64(t * Float64(y / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -680000000000.0) || ~((x <= 6.6e-19))) tmp = x * (t / (z - y)); else tmp = t * (y / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -680000000000.0], N[Not[LessEqual[x, 6.6e-19]], $MachinePrecision]], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -680000000000 \lor \neg \left(x \leq 6.6 \cdot 10^{-19}\right):\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\end{array}
\end{array}
if x < -6.8e11 or 6.5999999999999995e-19 < x Initial program 99.0%
associate-*l/82.9%
associate-/l*86.2%
Simplified86.2%
Taylor expanded in x around inf 71.2%
if -6.8e11 < x < 6.5999999999999995e-19Initial program 97.7%
Taylor expanded in x around 0 84.0%
neg-mul-184.0%
distribute-neg-frac284.0%
neg-sub084.0%
sub-neg84.0%
+-commutative84.0%
associate--r+84.0%
neg-sub084.0%
remove-double-neg84.0%
Simplified84.0%
Final simplification77.6%
(FPCore (x y z t) :precision binary64 (if (<= y -9e-87) (* t (/ y (- y z))) (if (<= y 8.5e+22) (* x (/ t (- z y))) (* t (/ (- y x) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9e-87) {
tmp = t * (y / (y - z));
} else if (y <= 8.5e+22) {
tmp = x * (t / (z - y));
} else {
tmp = t * ((y - x) / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-9d-87)) then
tmp = t * (y / (y - z))
else if (y <= 8.5d+22) then
tmp = x * (t / (z - y))
else
tmp = t * ((y - x) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9e-87) {
tmp = t * (y / (y - z));
} else if (y <= 8.5e+22) {
tmp = x * (t / (z - y));
} else {
tmp = t * ((y - x) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -9e-87: tmp = t * (y / (y - z)) elif y <= 8.5e+22: tmp = x * (t / (z - y)) else: tmp = t * ((y - x) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -9e-87) tmp = Float64(t * Float64(y / Float64(y - z))); elseif (y <= 8.5e+22) tmp = Float64(x * Float64(t / Float64(z - y))); else tmp = Float64(t * Float64(Float64(y - x) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -9e-87) tmp = t * (y / (y - z)); elseif (y <= 8.5e+22) tmp = x * (t / (z - y)); else tmp = t * ((y - x) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -9e-87], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.5e+22], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{-87}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+22}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\end{array}
\end{array}
if y < -8.99999999999999915e-87Initial program 99.8%
Taylor expanded in x around 0 67.6%
neg-mul-167.6%
distribute-neg-frac267.6%
neg-sub067.6%
sub-neg67.6%
+-commutative67.6%
associate--r+67.6%
neg-sub067.6%
remove-double-neg67.6%
Simplified67.6%
if -8.99999999999999915e-87 < y < 8.49999999999999979e22Initial program 96.7%
associate-*l/96.0%
associate-/l*95.2%
Simplified95.2%
Taylor expanded in x around inf 80.0%
if 8.49999999999999979e22 < y Initial program 99.9%
Taylor expanded in z around 0 89.9%
associate-*r/89.9%
neg-mul-189.9%
neg-sub089.9%
sub-neg89.9%
+-commutative89.9%
associate--r+89.9%
neg-sub089.9%
remove-double-neg89.9%
Simplified89.9%
Final simplification78.3%
(FPCore (x y z t) :precision binary64 (if (<= y -1.16e+72) t (if (<= y 5.4e+114) (* x (/ t (- z y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.16e+72) {
tmp = t;
} else if (y <= 5.4e+114) {
tmp = x * (t / (z - y));
} else {
tmp = t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.16d+72)) then
tmp = t
else if (y <= 5.4d+114) then
tmp = x * (t / (z - y))
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.16e+72) {
tmp = t;
} else if (y <= 5.4e+114) {
tmp = x * (t / (z - y));
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.16e+72: tmp = t elif y <= 5.4e+114: tmp = x * (t / (z - y)) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.16e+72) tmp = t; elseif (y <= 5.4e+114) tmp = Float64(x * Float64(t / Float64(z - y))); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.16e+72) tmp = t; elseif (y <= 5.4e+114) tmp = x * (t / (z - y)); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.16e+72], t, If[LessEqual[y, 5.4e+114], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.16 \cdot 10^{+72}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+114}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.16000000000000003e72 or 5.4000000000000001e114 < y Initial program 99.9%
associate-*l/63.7%
associate-/l*70.1%
Simplified70.1%
Taylor expanded in y around inf 69.0%
if -1.16000000000000003e72 < y < 5.4000000000000001e114Initial program 97.6%
associate-*l/94.3%
associate-/l*94.4%
Simplified94.4%
Taylor expanded in x around inf 71.6%
(FPCore (x y z t) :precision binary64 (if (<= y -9e-21) t (if (<= y 4.4e+24) (/ (* x t) z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9e-21) {
tmp = t;
} else if (y <= 4.4e+24) {
tmp = (x * t) / z;
} else {
tmp = t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-9d-21)) then
tmp = t
else if (y <= 4.4d+24) then
tmp = (x * t) / z
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9e-21) {
tmp = t;
} else if (y <= 4.4e+24) {
tmp = (x * t) / z;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -9e-21: tmp = t elif y <= 4.4e+24: tmp = (x * t) / z else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -9e-21) tmp = t; elseif (y <= 4.4e+24) tmp = Float64(Float64(x * t) / z); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -9e-21) tmp = t; elseif (y <= 4.4e+24) tmp = (x * t) / z; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -9e-21], t, If[LessEqual[y, 4.4e+24], N[(N[(x * t), $MachinePrecision] / z), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{-21}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+24}:\\
\;\;\;\;\frac{x \cdot t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -8.99999999999999936e-21 or 4.40000000000000003e24 < y Initial program 99.8%
associate-*l/69.8%
associate-/l*76.8%
Simplified76.8%
Taylor expanded in y around inf 59.1%
if -8.99999999999999936e-21 < y < 4.40000000000000003e24Initial program 97.1%
associate-*l/96.4%
associate-/l*94.4%
Simplified94.4%
Taylor expanded in y around 0 62.8%
Final simplification61.1%
(FPCore (x y z t) :precision binary64 (if (<= y -3.5e-22) t (if (<= y 9.5e+22) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.5e-22) {
tmp = t;
} else if (y <= 9.5e+22) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-3.5d-22)) then
tmp = t
else if (y <= 9.5d+22) then
tmp = t * (x / z)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.5e-22) {
tmp = t;
} else if (y <= 9.5e+22) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.5e-22: tmp = t elif y <= 9.5e+22: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.5e-22) tmp = t; elseif (y <= 9.5e+22) tmp = Float64(t * Float64(x / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.5e-22) tmp = t; elseif (y <= 9.5e+22) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.5e-22], t, If[LessEqual[y, 9.5e+22], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-22}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{+22}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -3.50000000000000005e-22 or 9.49999999999999937e22 < y Initial program 99.8%
associate-*l/69.8%
associate-/l*76.8%
Simplified76.8%
Taylor expanded in y around inf 59.1%
if -3.50000000000000005e-22 < y < 9.49999999999999937e22Initial program 97.1%
Taylor expanded in y around 0 61.5%
Final simplification60.4%
(FPCore (x y z t) :precision binary64 (if (<= y -2.3e-20) t (if (<= y 5.6e+24) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.3e-20) {
tmp = t;
} else if (y <= 5.6e+24) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-2.3d-20)) then
tmp = t
else if (y <= 5.6d+24) then
tmp = x * (t / z)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.3e-20) {
tmp = t;
} else if (y <= 5.6e+24) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.3e-20: tmp = t elif y <= 5.6e+24: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.3e-20) tmp = t; elseif (y <= 5.6e+24) tmp = Float64(x * Float64(t / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.3e-20) tmp = t; elseif (y <= 5.6e+24) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.3e-20], t, If[LessEqual[y, 5.6e+24], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{-20}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+24}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -2.2999999999999999e-20 or 5.6000000000000003e24 < y Initial program 99.8%
associate-*l/69.8%
associate-/l*76.8%
Simplified76.8%
Taylor expanded in y around inf 59.1%
if -2.2999999999999999e-20 < y < 5.6000000000000003e24Initial program 97.1%
associate-*l/96.4%
associate-/l*94.4%
Simplified94.4%
Taylor expanded in x around inf 75.9%
Taylor expanded in z around inf 60.6%
(FPCore (x y z t) :precision binary64 (if (<= y -1.1e-85) t (if (<= y 4.2e+21) (* t (/ y z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.1e-85) {
tmp = t;
} else if (y <= 4.2e+21) {
tmp = t * (y / z);
} else {
tmp = t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.1d-85)) then
tmp = t
else if (y <= 4.2d+21) then
tmp = t * (y / z)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.1e-85) {
tmp = t;
} else if (y <= 4.2e+21) {
tmp = t * (y / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.1e-85: tmp = t elif y <= 4.2e+21: tmp = t * (y / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.1e-85) tmp = t; elseif (y <= 4.2e+21) tmp = Float64(t * Float64(y / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.1e-85) tmp = t; elseif (y <= 4.2e+21) tmp = t * (y / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.1e-85], t, If[LessEqual[y, 4.2e+21], N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-85}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+21}:\\
\;\;\;\;t \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.1e-85 or 4.2e21 < y Initial program 99.8%
associate-*l/72.9%
associate-/l*77.9%
Simplified77.9%
Taylor expanded in y around inf 56.2%
if -1.1e-85 < y < 4.2e21Initial program 96.7%
associate-*l/96.1%
associate-/l*95.3%
Simplified95.3%
Taylor expanded in x around 0 39.6%
neg-mul-139.6%
Simplified39.6%
Taylor expanded in y around 0 32.5%
mul-1-neg32.5%
associate-/l*33.5%
distribute-lft-neg-in33.5%
Simplified33.5%
clear-num32.9%
un-div-inv33.0%
add-sqr-sqrt12.8%
sqrt-unprod27.3%
sqr-neg27.3%
sqrt-unprod16.0%
add-sqr-sqrt24.7%
Applied egg-rr24.7%
associate-/r/30.8%
/-rgt-identity30.8%
times-frac24.7%
associate-/l/24.7%
/-rgt-identity24.7%
associate-/l*24.7%
Simplified24.7%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 98.4%
associate-*l/84.0%
associate-/l*86.2%
Simplified86.2%
Taylor expanded in y around inf 32.4%
(FPCore (x y z t) :precision binary64 (/ t (/ (- z y) (- x y))))
double code(double x, double y, double z, double t) {
return t / ((z - y) / (x - y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t / ((z - y) / (x - y))
end function
public static double code(double x, double y, double z, double t) {
return t / ((z - y) / (x - y));
}
def code(x, y, z, t): return t / ((z - y) / (x - y))
function code(x, y, z, t) return Float64(t / Float64(Float64(z - y) / Float64(x - y))) end
function tmp = code(x, y, z, t) tmp = t / ((z - y) / (x - y)); end
code[x_, y_, z_, t_] := N[(t / N[(N[(z - y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t}{\frac{z - y}{x - y}}
\end{array}
herbie shell --seed 2024135
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
:precision binary64
:alt
(! :herbie-platform default (/ t (/ (- z y) (- x y))))
(* (/ (- x y) (- z y)) t))