
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + 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 - t)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t): return ((x / y) * (z - t)) + t
function code(x, y, z, t) return Float64(Float64(Float64(x / y) * Float64(z - t)) + t) end
function tmp = code(x, y, z, t) tmp = ((x / y) * (z - t)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} \cdot \left(z - t\right) + 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 t)) t))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + 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 - t)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t): return ((x / y) * (z - t)) + t
function code(x, y, z, t) return Float64(Float64(Float64(x / y) * Float64(z - t)) + t) end
function tmp = code(x, y, z, t) tmp = ((x / y) * (z - t)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} \cdot \left(z - t\right) + t
\end{array}
(FPCore (x y z t) :precision binary64 (+ t (/ (- z t) (/ y x))))
double code(double x, double y, double z, double t) {
return t + ((z - t) / (y / x));
}
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 - t) / (y / x))
end function
public static double code(double x, double y, double z, double t) {
return t + ((z - t) / (y / x));
}
def code(x, y, z, t): return t + ((z - t) / (y / x))
function code(x, y, z, t) return Float64(t + Float64(Float64(z - t) / Float64(y / x))) end
function tmp = code(x, y, z, t) tmp = t + ((z - t) / (y / x)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(z - t), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \frac{z - t}{\frac{y}{x}}
\end{array}
Initial program 98.3%
*-commutative98.3%
clear-num98.2%
un-div-inv98.5%
Applied egg-rr98.5%
Final simplification98.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ z (/ y x))))
(if (<= y -0.00035)
t
(if (<= y 1.55e-241)
t_1
(if (<= y 4.3e-153) (* t (/ x (- y))) (if (<= y 2.5e+27) t_1 t))))))
double code(double x, double y, double z, double t) {
double t_1 = z / (y / x);
double tmp;
if (y <= -0.00035) {
tmp = t;
} else if (y <= 1.55e-241) {
tmp = t_1;
} else if (y <= 4.3e-153) {
tmp = t * (x / -y);
} else if (y <= 2.5e+27) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = z / (y / x)
if (y <= (-0.00035d0)) then
tmp = t
else if (y <= 1.55d-241) then
tmp = t_1
else if (y <= 4.3d-153) then
tmp = t * (x / -y)
else if (y <= 2.5d+27) then
tmp = t_1
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z / (y / x);
double tmp;
if (y <= -0.00035) {
tmp = t;
} else if (y <= 1.55e-241) {
tmp = t_1;
} else if (y <= 4.3e-153) {
tmp = t * (x / -y);
} else if (y <= 2.5e+27) {
tmp = t_1;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): t_1 = z / (y / x) tmp = 0 if y <= -0.00035: tmp = t elif y <= 1.55e-241: tmp = t_1 elif y <= 4.3e-153: tmp = t * (x / -y) elif y <= 2.5e+27: tmp = t_1 else: tmp = t return tmp
function code(x, y, z, t) t_1 = Float64(z / Float64(y / x)) tmp = 0.0 if (y <= -0.00035) tmp = t; elseif (y <= 1.55e-241) tmp = t_1; elseif (y <= 4.3e-153) tmp = Float64(t * Float64(x / Float64(-y))); elseif (y <= 2.5e+27) tmp = t_1; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z / (y / x); tmp = 0.0; if (y <= -0.00035) tmp = t; elseif (y <= 1.55e-241) tmp = t_1; elseif (y <= 4.3e-153) tmp = t * (x / -y); elseif (y <= 2.5e+27) tmp = t_1; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.00035], t, If[LessEqual[y, 1.55e-241], t$95$1, If[LessEqual[y, 4.3e-153], N[(t * N[(x / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e+27], t$95$1, t]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{\frac{y}{x}}\\
\mathbf{if}\;y \leq -0.00035:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{-241}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{-153}:\\
\;\;\;\;t \cdot \frac{x}{-y}\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -3.49999999999999996e-4 or 2.4999999999999999e27 < y Initial program 99.8%
Taylor expanded in x around 0 67.2%
if -3.49999999999999996e-4 < y < 1.55e-241 or 4.3e-153 < y < 2.4999999999999999e27Initial program 96.6%
Taylor expanded in x around inf 73.5%
Taylor expanded in z around inf 49.9%
*-commutative60.5%
associate-/r/73.4%
Applied egg-rr61.5%
if 1.55e-241 < y < 4.3e-153Initial program 99.8%
Taylor expanded in x around inf 63.7%
*-commutative63.7%
sub-div69.9%
associate-*l/81.9%
Applied egg-rr81.9%
Taylor expanded in z around 0 63.7%
mul-1-neg63.7%
distribute-lft-neg-out63.7%
*-commutative63.7%
Simplified63.7%
Taylor expanded in x around 0 63.7%
mul-1-neg63.7%
associate-*r/69.8%
distribute-rgt-neg-in69.8%
distribute-neg-frac269.8%
Simplified69.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -100000000000.0) (not (<= (/ x y) 1e-20))) (/ (- z t) (/ y x)) (+ t (/ z (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -100000000000.0) || !((x / y) <= 1e-20)) {
tmp = (z - t) / (y / x);
} else {
tmp = t + (z / (y / x));
}
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 / y) <= (-100000000000.0d0)) .or. (.not. ((x / y) <= 1d-20))) then
tmp = (z - t) / (y / x)
else
tmp = t + (z / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -100000000000.0) || !((x / y) <= 1e-20)) {
tmp = (z - t) / (y / x);
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -100000000000.0) or not ((x / y) <= 1e-20): tmp = (z - t) / (y / x) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -100000000000.0) || !(Float64(x / y) <= 1e-20)) tmp = Float64(Float64(z - t) / Float64(y / x)); else tmp = Float64(t + Float64(z / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -100000000000.0) || ~(((x / y) <= 1e-20))) tmp = (z - t) / (y / x); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -100000000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e-20]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -100000000000 \lor \neg \left(\frac{x}{y} \leq 10^{-20}\right):\\
\;\;\;\;\frac{z - t}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if (/.f64 x y) < -1e11 or 9.99999999999999945e-21 < (/.f64 x y) Initial program 96.7%
Taylor expanded in x around inf 89.2%
*-commutative89.2%
sub-div91.7%
associate-/r/96.2%
Applied egg-rr96.2%
if -1e11 < (/.f64 x y) < 9.99999999999999945e-21Initial program 99.8%
Taylor expanded in z around inf 95.1%
associate-/l*90.6%
Simplified90.6%
*-commutative90.6%
associate-/r/98.4%
Applied egg-rr98.4%
Final simplification97.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -0.04) (not (<= (/ x y) 1e+52))) (* x (/ (- z t) y)) (+ t (/ z (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -0.04) || !((x / y) <= 1e+52)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + (z / (y / x));
}
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 / y) <= (-0.04d0)) .or. (.not. ((x / y) <= 1d+52))) then
tmp = x * ((z - t) / y)
else
tmp = t + (z / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -0.04) || !((x / y) <= 1e+52)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -0.04) or not ((x / y) <= 1e+52): tmp = x * ((z - t) / y) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -0.04) || !(Float64(x / y) <= 1e+52)) tmp = Float64(x * Float64(Float64(z - t) / y)); else tmp = Float64(t + Float64(z / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -0.04) || ~(((x / y) <= 1e+52))) tmp = x * ((z - t) / y); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -0.04], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e+52]], $MachinePrecision]], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -0.04 \lor \neg \left(\frac{x}{y} \leq 10^{+52}\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if (/.f64 x y) < -0.0400000000000000008 or 9.9999999999999999e51 < (/.f64 x y) Initial program 96.5%
Taylor expanded in x around inf 91.0%
Taylor expanded in y around 0 93.6%
if -0.0400000000000000008 < (/.f64 x y) < 9.9999999999999999e51Initial program 99.8%
Taylor expanded in z around inf 93.6%
associate-/l*88.1%
Simplified88.1%
*-commutative88.1%
associate-/r/96.7%
Applied egg-rr96.7%
Final simplification95.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -100000000000.0) (not (<= (/ x y) 1e-20))) (* x (/ (- z t) y)) (+ t (/ x (/ y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -100000000000.0) || !((x / y) <= 1e-20)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + (x / (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 / y) <= (-100000000000.0d0)) .or. (.not. ((x / y) <= 1d-20))) then
tmp = x * ((z - t) / y)
else
tmp = t + (x / (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -100000000000.0) || !((x / y) <= 1e-20)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + (x / (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -100000000000.0) or not ((x / y) <= 1e-20): tmp = x * ((z - t) / y) else: tmp = t + (x / (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -100000000000.0) || !(Float64(x / y) <= 1e-20)) tmp = Float64(x * Float64(Float64(z - t) / y)); else tmp = Float64(t + Float64(x / Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -100000000000.0) || ~(((x / y) <= 1e-20))) tmp = x * ((z - t) / y); else tmp = t + (x / (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -100000000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e-20]], $MachinePrecision]], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -100000000000 \lor \neg \left(\frac{x}{y} \leq 10^{-20}\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z}}\\
\end{array}
\end{array}
if (/.f64 x y) < -1e11 or 9.99999999999999945e-21 < (/.f64 x y) Initial program 96.7%
Taylor expanded in x around inf 89.2%
Taylor expanded in y around 0 91.7%
if -1e11 < (/.f64 x y) < 9.99999999999999945e-21Initial program 99.8%
Taylor expanded in z around inf 95.1%
associate-/l*90.6%
Simplified90.6%
clear-num90.6%
un-div-inv91.0%
Applied egg-rr91.0%
Final simplification91.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -100000000000.0) (not (<= (/ x y) 1000.0))) (* x (/ (- z t) y)) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -100000000000.0) || !((x / y) <= 1000.0)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + (x * (z / 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 (((x / y) <= (-100000000000.0d0)) .or. (.not. ((x / y) <= 1000.0d0))) then
tmp = x * ((z - t) / y)
else
tmp = t + (x * (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -100000000000.0) || !((x / y) <= 1000.0)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -100000000000.0) or not ((x / y) <= 1000.0): tmp = x * ((z - t) / y) else: tmp = t + (x * (z / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -100000000000.0) || !(Float64(x / y) <= 1000.0)) tmp = Float64(x * Float64(Float64(z - t) / y)); else tmp = Float64(t + Float64(x * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -100000000000.0) || ~(((x / y) <= 1000.0))) tmp = x * ((z - t) / y); else tmp = t + (x * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -100000000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1000.0]], $MachinePrecision]], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -100000000000 \lor \neg \left(\frac{x}{y} \leq 1000\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -1e11 or 1e3 < (/.f64 x y) Initial program 96.6%
Taylor expanded in x around inf 89.8%
Taylor expanded in y around 0 92.3%
if -1e11 < (/.f64 x y) < 1e3Initial program 99.8%
Taylor expanded in z around inf 94.5%
associate-/l*90.1%
Simplified90.1%
Final simplification91.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -4e-48) (not (<= (/ x y) 1e-20))) (* x (/ (- z t) y)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -4e-48) || !((x / y) <= 1e-20)) {
tmp = x * ((z - t) / y);
} else {
tmp = t * (1.0 - (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 (((x / y) <= (-4d-48)) .or. (.not. ((x / y) <= 1d-20))) then
tmp = x * ((z - t) / y)
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -4e-48) || !((x / y) <= 1e-20)) {
tmp = x * ((z - t) / y);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -4e-48) or not ((x / y) <= 1e-20): tmp = x * ((z - t) / y) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -4e-48) || !(Float64(x / y) <= 1e-20)) tmp = Float64(x * Float64(Float64(z - t) / y)); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -4e-48) || ~(((x / y) <= 1e-20))) tmp = x * ((z - t) / y); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -4e-48], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e-20]], $MachinePrecision]], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{-48} \lor \neg \left(\frac{x}{y} \leq 10^{-20}\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -3.9999999999999999e-48 or 9.99999999999999945e-21 < (/.f64 x y) Initial program 96.9%
Taylor expanded in x around inf 85.5%
Taylor expanded in y around 0 87.7%
if -3.9999999999999999e-48 < (/.f64 x y) < 9.99999999999999945e-21Initial program 99.8%
Taylor expanded in z around 0 70.7%
mul-1-neg70.7%
unsub-neg70.7%
*-rgt-identity70.7%
associate-/l*77.1%
distribute-lft-out--77.1%
Simplified77.1%
Final simplification82.7%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -0.04) (* x (/ (- z t) y)) (if (<= (/ x y) 1e-20) (+ t (/ z (/ y x))) (/ (* (- z t) x) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -0.04) {
tmp = x * ((z - t) / y);
} else if ((x / y) <= 1e-20) {
tmp = t + (z / (y / x));
} else {
tmp = ((z - t) * 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 ((x / y) <= (-0.04d0)) then
tmp = x * ((z - t) / y)
else if ((x / y) <= 1d-20) then
tmp = t + (z / (y / x))
else
tmp = ((z - t) * x) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -0.04) {
tmp = x * ((z - t) / y);
} else if ((x / y) <= 1e-20) {
tmp = t + (z / (y / x));
} else {
tmp = ((z - t) * x) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -0.04: tmp = x * ((z - t) / y) elif (x / y) <= 1e-20: tmp = t + (z / (y / x)) else: tmp = ((z - t) * x) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -0.04) tmp = Float64(x * Float64(Float64(z - t) / y)); elseif (Float64(x / y) <= 1e-20) tmp = Float64(t + Float64(z / Float64(y / x))); else tmp = Float64(Float64(Float64(z - t) * x) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -0.04) tmp = x * ((z - t) / y); elseif ((x / y) <= 1e-20) tmp = t + (z / (y / x)); else tmp = ((z - t) * x) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -0.04], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e-20], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -0.04:\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-20}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(z - t\right) \cdot x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -0.0400000000000000008Initial program 94.6%
Taylor expanded in x around inf 91.8%
Taylor expanded in y around 0 93.7%
if -0.0400000000000000008 < (/.f64 x y) < 9.99999999999999945e-21Initial program 99.8%
Taylor expanded in z around inf 95.1%
associate-/l*90.5%
Simplified90.5%
*-commutative90.5%
associate-/r/98.4%
Applied egg-rr98.4%
if 9.99999999999999945e-21 < (/.f64 x y) Initial program 98.3%
Taylor expanded in x around inf 87.4%
*-commutative87.4%
sub-div90.2%
associate-*l/95.9%
Applied egg-rr95.9%
Final simplification96.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.55e-149) (not (<= t 1.55e-137))) (* t (- 1.0 (/ x y))) (/ z (/ y x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.55e-149) || !(t <= 1.55e-137)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = z / (y / x);
}
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 ((t <= (-1.55d-149)) .or. (.not. (t <= 1.55d-137))) then
tmp = t * (1.0d0 - (x / y))
else
tmp = z / (y / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.55e-149) || !(t <= 1.55e-137)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = z / (y / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.55e-149) or not (t <= 1.55e-137): tmp = t * (1.0 - (x / y)) else: tmp = z / (y / x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.55e-149) || !(t <= 1.55e-137)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(z / Float64(y / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.55e-149) || ~((t <= 1.55e-137))) tmp = t * (1.0 - (x / y)); else tmp = z / (y / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.55e-149], N[Not[LessEqual[t, 1.55e-137]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.55 \cdot 10^{-149} \lor \neg \left(t \leq 1.55 \cdot 10^{-137}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if t < -1.54999999999999994e-149 or 1.54999999999999989e-137 < t Initial program 99.4%
Taylor expanded in z around 0 74.1%
mul-1-neg74.1%
unsub-neg74.1%
*-rgt-identity74.1%
associate-/l*80.4%
distribute-lft-out--80.4%
Simplified80.4%
if -1.54999999999999994e-149 < t < 1.54999999999999989e-137Initial program 95.6%
Taylor expanded in x around inf 72.8%
Taylor expanded in z around inf 67.4%
*-commutative83.8%
associate-/r/93.6%
Applied egg-rr77.5%
Final simplification79.6%
(FPCore (x y z t) :precision binary64 (if (<= y -5.7e-8) t (if (<= y 3.6e+29) (/ z (/ y x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.7e-8) {
tmp = t;
} else if (y <= 3.6e+29) {
tmp = z / (y / x);
} 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 <= (-5.7d-8)) then
tmp = t
else if (y <= 3.6d+29) then
tmp = z / (y / x)
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 <= -5.7e-8) {
tmp = t;
} else if (y <= 3.6e+29) {
tmp = z / (y / x);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.7e-8: tmp = t elif y <= 3.6e+29: tmp = z / (y / x) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.7e-8) tmp = t; elseif (y <= 3.6e+29) tmp = Float64(z / Float64(y / x)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -5.7e-8) tmp = t; elseif (y <= 3.6e+29) tmp = z / (y / x); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.7e-8], t, If[LessEqual[y, 3.6e+29], N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.7 \cdot 10^{-8}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+29}:\\
\;\;\;\;\frac{z}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -5.70000000000000009e-8 or 3.59999999999999976e29 < y Initial program 99.8%
Taylor expanded in x around 0 67.2%
if -5.70000000000000009e-8 < y < 3.59999999999999976e29Initial program 97.0%
Taylor expanded in x around inf 72.3%
Taylor expanded in z around inf 47.2%
*-commutative57.8%
associate-/r/71.1%
Applied egg-rr58.8%
(FPCore (x y z t) :precision binary64 (if (<= y -0.00033) t (if (<= y 5.6e+27) (/ x (/ y z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.00033) {
tmp = t;
} else if (y <= 5.6e+27) {
tmp = x / (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 <= (-0.00033d0)) then
tmp = t
else if (y <= 5.6d+27) then
tmp = x / (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 <= -0.00033) {
tmp = t;
} else if (y <= 5.6e+27) {
tmp = x / (y / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -0.00033: tmp = t elif y <= 5.6e+27: tmp = x / (y / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -0.00033) tmp = t; elseif (y <= 5.6e+27) tmp = Float64(x / Float64(y / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -0.00033) tmp = t; elseif (y <= 5.6e+27) tmp = x / (y / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -0.00033], t, If[LessEqual[y, 5.6e+27], N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00033:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+27}:\\
\;\;\;\;\frac{x}{\frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -3.3e-4 or 5.5999999999999999e27 < y Initial program 99.8%
Taylor expanded in x around 0 67.2%
if -3.3e-4 < y < 5.5999999999999999e27Initial program 97.0%
Taylor expanded in x around inf 72.3%
Taylor expanded in z around inf 47.2%
clear-num57.7%
un-div-inv58.1%
Applied egg-rr47.5%
(FPCore (x y z t) :precision binary64 (if (<= y -2.05e-11) t (if (<= y 1.92e+30) (* x (/ z y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.05e-11) {
tmp = t;
} else if (y <= 1.92e+30) {
tmp = x * (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 <= (-2.05d-11)) then
tmp = t
else if (y <= 1.92d+30) then
tmp = x * (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 <= -2.05e-11) {
tmp = t;
} else if (y <= 1.92e+30) {
tmp = x * (z / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.05e-11: tmp = t elif y <= 1.92e+30: tmp = x * (z / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.05e-11) tmp = t; elseif (y <= 1.92e+30) tmp = Float64(x * Float64(z / y)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.05e-11) tmp = t; elseif (y <= 1.92e+30) tmp = x * (z / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.05e-11], t, If[LessEqual[y, 1.92e+30], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{-11}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.92 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -2.05e-11 or 1.9200000000000001e30 < y Initial program 99.8%
Taylor expanded in x around 0 67.2%
if -2.05e-11 < y < 1.9200000000000001e30Initial program 97.0%
Taylor expanded in x around inf 72.3%
Taylor expanded in z around inf 47.2%
(FPCore (x y z t) :precision binary64 (+ t (* (- z t) (/ x y))))
double code(double x, double y, double z, double t) {
return t + ((z - t) * (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 - t) * (x / y))
end function
public static double code(double x, double y, double z, double t) {
return t + ((z - t) * (x / y));
}
def code(x, y, z, t): return t + ((z - t) * (x / y))
function code(x, y, z, t) return Float64(t + Float64(Float64(z - t) * Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = t + ((z - t) * (x / y)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(z - t), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \left(z - t\right) \cdot \frac{x}{y}
\end{array}
Initial program 98.3%
Final simplification98.3%
(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.3%
Taylor expanded in x around 0 39.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (* (/ x y) (- z t)) t)))
(if (< z 2.759456554562692e-282)
t_1
(if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((x / y) * (z - t)) + t;
double tmp;
if (z < 2.759456554562692e-282) {
tmp = t_1;
} else if (z < 2.326994450874436e-110) {
tmp = (x * ((z - t) / y)) + t;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = ((x / y) * (z - t)) + t
if (z < 2.759456554562692d-282) then
tmp = t_1
else if (z < 2.326994450874436d-110) then
tmp = (x * ((z - t) / y)) + t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((x / y) * (z - t)) + t;
double tmp;
if (z < 2.759456554562692e-282) {
tmp = t_1;
} else if (z < 2.326994450874436e-110) {
tmp = (x * ((z - t) / y)) + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((x / y) * (z - t)) + t tmp = 0 if z < 2.759456554562692e-282: tmp = t_1 elif z < 2.326994450874436e-110: tmp = (x * ((z - t) / y)) + t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x / y) * Float64(z - t)) + t) tmp = 0.0 if (z < 2.759456554562692e-282) tmp = t_1; elseif (z < 2.326994450874436e-110) tmp = Float64(Float64(x * Float64(Float64(z - t) / y)) + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((x / y) * (z - t)) + t; tmp = 0.0; if (z < 2.759456554562692e-282) tmp = t_1; elseif (z < 2.326994450874436e-110) tmp = (x * ((z - t) / y)) + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[Less[z, 2.759456554562692e-282], t$95$1, If[Less[z, 2.326994450874436e-110], N[(N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(z - t\right) + t\\
\mathbf{if}\;z < 2.759456554562692 \cdot 10^{-282}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 2.326994450874436 \cdot 10^{-110}:\\
\;\;\;\;x \cdot \frac{z - t}{y} + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024091
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:alt
(if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))
(+ (* (/ x y) (- z t)) t))