
(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 12 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 96.4%
(FPCore (x y z t)
:precision binary64
(if (<= z -4.5e+150)
(/ t (- 1.0 (/ z y)))
(if (or (<= z -2.6e-7) (not (<= z 1.92e+31)))
(* (- x y) (/ t z))
(/ t (/ y (- y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e+150) {
tmp = t / (1.0 - (z / y));
} else if ((z <= -2.6e-7) || !(z <= 1.92e+31)) {
tmp = (x - y) * (t / z);
} else {
tmp = t / (y / (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 (z <= (-4.5d+150)) then
tmp = t / (1.0d0 - (z / y))
else if ((z <= (-2.6d-7)) .or. (.not. (z <= 1.92d+31))) then
tmp = (x - y) * (t / z)
else
tmp = t / (y / (y - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e+150) {
tmp = t / (1.0 - (z / y));
} else if ((z <= -2.6e-7) || !(z <= 1.92e+31)) {
tmp = (x - y) * (t / z);
} else {
tmp = t / (y / (y - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.5e+150: tmp = t / (1.0 - (z / y)) elif (z <= -2.6e-7) or not (z <= 1.92e+31): tmp = (x - y) * (t / z) else: tmp = t / (y / (y - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.5e+150) tmp = Float64(t / Float64(1.0 - Float64(z / y))); elseif ((z <= -2.6e-7) || !(z <= 1.92e+31)) tmp = Float64(Float64(x - y) * Float64(t / z)); else tmp = Float64(t / Float64(y / Float64(y - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.5e+150) tmp = t / (1.0 - (z / y)); elseif ((z <= -2.6e-7) || ~((z <= 1.92e+31))) tmp = (x - y) * (t / z); else tmp = t / (y / (y - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.5e+150], N[(t / N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -2.6e-7], N[Not[LessEqual[z, 1.92e+31]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(t / N[(y / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+150}:\\
\;\;\;\;\frac{t}{1 - \frac{z}{y}}\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{-7} \lor \neg \left(z \leq 1.92 \cdot 10^{+31}\right):\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{y}{y - x}}\\
\end{array}
\end{array}
if z < -4.5e150Initial program 96.1%
associate-*l/88.9%
associate-/l*67.5%
Simplified67.5%
associate-*r/88.9%
associate-*l/96.1%
*-commutative96.1%
clear-num96.1%
un-div-inv96.1%
Applied egg-rr96.1%
Taylor expanded in x around 0 81.4%
mul-1-neg81.4%
div-sub81.5%
sub-neg81.5%
*-inverses81.5%
metadata-eval81.5%
Simplified81.5%
Taylor expanded in t around 0 81.5%
if -4.5e150 < z < -2.59999999999999999e-7 or 1.9199999999999999e31 < z Initial program 94.8%
associate-*l/84.8%
associate-/l*87.7%
Simplified87.7%
Taylor expanded in z around inf 76.0%
if -2.59999999999999999e-7 < z < 1.9199999999999999e31Initial program 97.6%
Taylor expanded in z around 0 80.7%
associate-*r/80.7%
neg-mul-180.7%
neg-sub080.7%
sub-neg80.7%
+-commutative80.7%
associate--r+80.7%
neg-sub080.7%
remove-double-neg80.7%
Simplified80.7%
*-commutative80.7%
clear-num80.7%
un-div-inv80.8%
Applied egg-rr80.8%
Final simplification79.0%
(FPCore (x y z t)
:precision binary64
(if (<= z -4.5e+150)
(/ t (- 1.0 (/ z y)))
(if (or (<= z -6.5e-8) (not (<= z 1.8e+31)))
(* (- x y) (/ t z))
(* t (/ (- y x) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e+150) {
tmp = t / (1.0 - (z / y));
} else if ((z <= -6.5e-8) || !(z <= 1.8e+31)) {
tmp = (x - y) * (t / z);
} 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 <= (-4.5d+150)) then
tmp = t / (1.0d0 - (z / y))
else if ((z <= (-6.5d-8)) .or. (.not. (z <= 1.8d+31))) then
tmp = (x - y) * (t / z)
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 <= -4.5e+150) {
tmp = t / (1.0 - (z / y));
} else if ((z <= -6.5e-8) || !(z <= 1.8e+31)) {
tmp = (x - y) * (t / z);
} else {
tmp = t * ((y - x) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.5e+150: tmp = t / (1.0 - (z / y)) elif (z <= -6.5e-8) or not (z <= 1.8e+31): tmp = (x - y) * (t / z) else: tmp = t * ((y - x) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.5e+150) tmp = Float64(t / Float64(1.0 - Float64(z / y))); elseif ((z <= -6.5e-8) || !(z <= 1.8e+31)) tmp = Float64(Float64(x - y) * Float64(t / z)); 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 <= -4.5e+150) tmp = t / (1.0 - (z / y)); elseif ((z <= -6.5e-8) || ~((z <= 1.8e+31))) tmp = (x - y) * (t / z); else tmp = t * ((y - x) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.5e+150], N[(t / N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -6.5e-8], N[Not[LessEqual[z, 1.8e+31]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+150}:\\
\;\;\;\;\frac{t}{1 - \frac{z}{y}}\\
\mathbf{elif}\;z \leq -6.5 \cdot 10^{-8} \lor \neg \left(z \leq 1.8 \cdot 10^{+31}\right):\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\end{array}
\end{array}
if z < -4.5e150Initial program 96.1%
associate-*l/88.9%
associate-/l*67.5%
Simplified67.5%
associate-*r/88.9%
associate-*l/96.1%
*-commutative96.1%
clear-num96.1%
un-div-inv96.1%
Applied egg-rr96.1%
Taylor expanded in x around 0 81.4%
mul-1-neg81.4%
div-sub81.5%
sub-neg81.5%
*-inverses81.5%
metadata-eval81.5%
Simplified81.5%
Taylor expanded in t around 0 81.5%
if -4.5e150 < z < -6.49999999999999997e-8 or 1.79999999999999998e31 < z Initial program 94.8%
associate-*l/84.8%
associate-/l*87.7%
Simplified87.7%
Taylor expanded in z around inf 76.0%
if -6.49999999999999997e-8 < z < 1.79999999999999998e31Initial program 97.6%
Taylor expanded in z around 0 80.7%
associate-*r/80.7%
neg-mul-180.7%
neg-sub080.7%
sub-neg80.7%
+-commutative80.7%
associate--r+80.7%
neg-sub080.7%
remove-double-neg80.7%
Simplified80.7%
Final simplification79.0%
(FPCore (x y z t)
:precision binary64
(if (<= z -4.5e+150)
(* t (/ y (- y z)))
(if (or (<= z -2.2e-6) (not (<= z 2.1e+31)))
(* (- x y) (/ t z))
(* t (/ (- y x) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e+150) {
tmp = t * (y / (y - z));
} else if ((z <= -2.2e-6) || !(z <= 2.1e+31)) {
tmp = (x - y) * (t / z);
} 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 <= (-4.5d+150)) then
tmp = t * (y / (y - z))
else if ((z <= (-2.2d-6)) .or. (.not. (z <= 2.1d+31))) then
tmp = (x - y) * (t / z)
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 <= -4.5e+150) {
tmp = t * (y / (y - z));
} else if ((z <= -2.2e-6) || !(z <= 2.1e+31)) {
tmp = (x - y) * (t / z);
} else {
tmp = t * ((y - x) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.5e+150: tmp = t * (y / (y - z)) elif (z <= -2.2e-6) or not (z <= 2.1e+31): tmp = (x - y) * (t / z) else: tmp = t * ((y - x) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.5e+150) tmp = Float64(t * Float64(y / Float64(y - z))); elseif ((z <= -2.2e-6) || !(z <= 2.1e+31)) tmp = Float64(Float64(x - y) * Float64(t / z)); 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 <= -4.5e+150) tmp = t * (y / (y - z)); elseif ((z <= -2.2e-6) || ~((z <= 2.1e+31))) tmp = (x - y) * (t / z); else tmp = t * ((y - x) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.5e+150], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -2.2e-6], N[Not[LessEqual[z, 2.1e+31]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+150}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\mathbf{elif}\;z \leq -2.2 \cdot 10^{-6} \lor \neg \left(z \leq 2.1 \cdot 10^{+31}\right):\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\end{array}
\end{array}
if z < -4.5e150Initial program 96.1%
Taylor expanded in x around 0 81.4%
neg-mul-181.4%
distribute-neg-frac281.4%
neg-sub081.4%
sub-neg81.4%
+-commutative81.4%
associate--r+81.4%
neg-sub081.4%
remove-double-neg81.4%
Simplified81.4%
if -4.5e150 < z < -2.2000000000000001e-6 or 2.09999999999999979e31 < z Initial program 94.8%
associate-*l/84.8%
associate-/l*87.7%
Simplified87.7%
Taylor expanded in z around inf 76.0%
if -2.2000000000000001e-6 < z < 2.09999999999999979e31Initial program 97.6%
Taylor expanded in z around 0 80.7%
associate-*r/80.7%
neg-mul-180.7%
neg-sub080.7%
sub-neg80.7%
+-commutative80.7%
associate--r+80.7%
neg-sub080.7%
remove-double-neg80.7%
Simplified80.7%
Final simplification78.9%
(FPCore (x y z t) :precision binary64 (if (<= y -4.1e+204) (* t (/ (- y x) y)) (if (<= y 2e+162) (* (- x y) (/ t (- z y))) (/ t (/ y (- y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.1e+204) {
tmp = t * ((y - x) / y);
} else if (y <= 2e+162) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t / (y / (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 (y <= (-4.1d+204)) then
tmp = t * ((y - x) / y)
else if (y <= 2d+162) then
tmp = (x - y) * (t / (z - y))
else
tmp = t / (y / (y - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.1e+204) {
tmp = t * ((y - x) / y);
} else if (y <= 2e+162) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t / (y / (y - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.1e+204: tmp = t * ((y - x) / y) elif y <= 2e+162: tmp = (x - y) * (t / (z - y)) else: tmp = t / (y / (y - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.1e+204) tmp = Float64(t * Float64(Float64(y - x) / y)); elseif (y <= 2e+162) tmp = Float64(Float64(x - y) * Float64(t / Float64(z - y))); else tmp = Float64(t / Float64(y / Float64(y - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4.1e+204) tmp = t * ((y - x) / y); elseif (y <= 2e+162) tmp = (x - y) * (t / (z - y)); else tmp = t / (y / (y - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.1e+204], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e+162], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t / N[(y / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{+204}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+162}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{y}{y - x}}\\
\end{array}
\end{array}
if y < -4.09999999999999975e204Initial program 99.8%
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%
if -4.09999999999999975e204 < y < 1.9999999999999999e162Initial program 95.6%
associate-*l/89.3%
associate-/l*89.3%
Simplified89.3%
if 1.9999999999999999e162 < y Initial program 99.9%
Taylor expanded in z around 0 94.4%
associate-*r/94.4%
neg-mul-194.4%
neg-sub094.4%
sub-neg94.4%
+-commutative94.4%
associate--r+94.4%
neg-sub094.4%
remove-double-neg94.4%
Simplified94.4%
*-commutative94.4%
clear-num94.4%
un-div-inv94.5%
Applied egg-rr94.5%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.4e-7) (not (<= z 3e+31))) (/ t (/ z (- x y))) (/ t (/ y (- y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.4e-7) || !(z <= 3e+31)) {
tmp = t / (z / (x - y));
} else {
tmp = t / (y / (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 ((z <= (-7.4d-7)) .or. (.not. (z <= 3d+31))) then
tmp = t / (z / (x - y))
else
tmp = t / (y / (y - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.4e-7) || !(z <= 3e+31)) {
tmp = t / (z / (x - y));
} else {
tmp = t / (y / (y - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.4e-7) or not (z <= 3e+31): tmp = t / (z / (x - y)) else: tmp = t / (y / (y - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.4e-7) || !(z <= 3e+31)) tmp = Float64(t / Float64(z / Float64(x - y))); else tmp = Float64(t / Float64(y / Float64(y - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.4e-7) || ~((z <= 3e+31))) tmp = t / (z / (x - y)); else tmp = t / (y / (y - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.4e-7], N[Not[LessEqual[z, 3e+31]], $MachinePrecision]], N[(t / N[(z / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t / N[(y / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{-7} \lor \neg \left(z \leq 3 \cdot 10^{+31}\right):\\
\;\;\;\;\frac{t}{\frac{z}{x - y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{y}{y - x}}\\
\end{array}
\end{array}
if z < -7.40000000000000009e-7 or 2.99999999999999989e31 < z Initial program 95.1%
associate-*l/85.7%
associate-/l*83.6%
Simplified83.6%
associate-*r/85.7%
associate-*l/95.1%
*-commutative95.1%
clear-num94.6%
un-div-inv94.7%
Applied egg-rr94.7%
Taylor expanded in z around inf 75.8%
if -7.40000000000000009e-7 < z < 2.99999999999999989e31Initial program 97.6%
Taylor expanded in z around 0 80.7%
associate-*r/80.7%
neg-mul-180.7%
neg-sub080.7%
sub-neg80.7%
+-commutative80.7%
associate--r+80.7%
neg-sub080.7%
remove-double-neg80.7%
Simplified80.7%
*-commutative80.7%
clear-num80.7%
un-div-inv80.8%
Applied egg-rr80.8%
Final simplification78.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -0.00126) (not (<= y 1.4e+65))) (* t (/ y (- y z))) (* x (/ t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -0.00126) || !(y <= 1.4e+65)) {
tmp = t * (y / (y - z));
} else {
tmp = x * (t / (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 ((y <= (-0.00126d0)) .or. (.not. (y <= 1.4d+65))) then
tmp = t * (y / (y - z))
else
tmp = x * (t / (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -0.00126) || !(y <= 1.4e+65)) {
tmp = t * (y / (y - z));
} else {
tmp = x * (t / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -0.00126) or not (y <= 1.4e+65): tmp = t * (y / (y - z)) else: tmp = x * (t / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -0.00126) || !(y <= 1.4e+65)) tmp = Float64(t * Float64(y / Float64(y - z))); else tmp = Float64(x * Float64(t / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -0.00126) || ~((y <= 1.4e+65))) tmp = t * (y / (y - z)); else tmp = x * (t / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -0.00126], N[Not[LessEqual[y, 1.4e+65]], $MachinePrecision]], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00126 \lor \neg \left(y \leq 1.4 \cdot 10^{+65}\right):\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\end{array}
\end{array}
if y < -0.00126000000000000005 or 1.3999999999999999e65 < y Initial program 99.8%
Taylor expanded in x around 0 79.6%
neg-mul-179.6%
distribute-neg-frac279.6%
neg-sub079.6%
sub-neg79.6%
+-commutative79.6%
associate--r+79.6%
neg-sub079.6%
remove-double-neg79.6%
Simplified79.6%
if -0.00126000000000000005 < y < 1.3999999999999999e65Initial program 93.7%
associate-*l/94.0%
associate-/l*90.0%
Simplified90.0%
Taylor expanded in x around inf 72.3%
Final simplification75.5%
(FPCore (x y z t) :precision binary64 (if (<= y -5.8e+54) t (if (<= y 8.5e+124) (* x (/ t (- z y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.8e+54) {
tmp = t;
} else if (y <= 8.5e+124) {
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 <= (-5.8d+54)) then
tmp = t
else if (y <= 8.5d+124) 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 <= -5.8e+54) {
tmp = t;
} else if (y <= 8.5e+124) {
tmp = x * (t / (z - y));
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.8e+54: tmp = t elif y <= 8.5e+124: tmp = x * (t / (z - y)) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.8e+54) tmp = t; elseif (y <= 8.5e+124) 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 <= -5.8e+54) tmp = t; elseif (y <= 8.5e+124) tmp = x * (t / (z - y)); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.8e+54], t, If[LessEqual[y, 8.5e+124], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+54}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+124}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -5.7999999999999997e54 or 8.4999999999999997e124 < y Initial program 99.8%
associate-*l/68.8%
associate-/l*78.3%
Simplified78.3%
Taylor expanded in y around inf 67.5%
if -5.7999999999999997e54 < y < 8.4999999999999997e124Initial program 94.8%
associate-*l/92.4%
associate-/l*89.2%
Simplified89.2%
Taylor expanded in x around inf 66.1%
(FPCore (x y z t) :precision binary64 (if (<= y -0.027) t (if (<= y 1.65e+46) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.027) {
tmp = t;
} else if (y <= 1.65e+46) {
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 <= (-0.027d0)) then
tmp = t
else if (y <= 1.65d+46) 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 <= -0.027) {
tmp = t;
} else if (y <= 1.65e+46) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -0.027: tmp = t elif y <= 1.65e+46: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -0.027) tmp = t; elseif (y <= 1.65e+46) 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 <= -0.027) tmp = t; elseif (y <= 1.65e+46) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -0.027], t, If[LessEqual[y, 1.65e+46], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.027:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{+46}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -0.0269999999999999997 or 1.6499999999999999e46 < y Initial program 99.8%
associate-*l/74.2%
associate-/l*80.6%
Simplified80.6%
Taylor expanded in y around inf 56.5%
if -0.0269999999999999997 < y < 1.6499999999999999e46Initial program 93.4%
Taylor expanded in y around 0 60.6%
Final simplification58.7%
(FPCore (x y z t) :precision binary64 (if (<= y -0.027) t (if (<= y 3.4e+46) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.027) {
tmp = t;
} else if (y <= 3.4e+46) {
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 <= (-0.027d0)) then
tmp = t
else if (y <= 3.4d+46) 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 <= -0.027) {
tmp = t;
} else if (y <= 3.4e+46) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -0.027: tmp = t elif y <= 3.4e+46: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -0.027) tmp = t; elseif (y <= 3.4e+46) 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 <= -0.027) tmp = t; elseif (y <= 3.4e+46) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -0.027], t, If[LessEqual[y, 3.4e+46], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.027:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{+46}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -0.0269999999999999997 or 3.3999999999999998e46 < y Initial program 99.8%
associate-*l/74.2%
associate-/l*80.6%
Simplified80.6%
Taylor expanded in y around inf 56.5%
if -0.0269999999999999997 < y < 3.3999999999999998e46Initial program 93.4%
associate-*l/94.4%
associate-/l*90.3%
Simplified90.3%
Taylor expanded in z around inf 68.6%
Taylor expanded in x around inf 56.6%
(FPCore (x y z t) :precision binary64 (if (<= y -4e-103) t (if (<= y 4.4e-62) (* t (/ y z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4e-103) {
tmp = t;
} else if (y <= 4.4e-62) {
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 <= (-4d-103)) then
tmp = t
else if (y <= 4.4d-62) 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 <= -4e-103) {
tmp = t;
} else if (y <= 4.4e-62) {
tmp = t * (y / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4e-103: tmp = t elif y <= 4.4e-62: tmp = t * (y / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4e-103) tmp = t; elseif (y <= 4.4e-62) 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 <= -4e-103) tmp = t; elseif (y <= 4.4e-62) tmp = t * (y / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4e-103], t, If[LessEqual[y, 4.4e-62], N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-103}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{-62}:\\
\;\;\;\;t \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -3.99999999999999983e-103 or 4.40000000000000035e-62 < y Initial program 98.6%
associate-*l/80.0%
associate-/l*83.6%
Simplified83.6%
Taylor expanded in y around inf 45.7%
if -3.99999999999999983e-103 < y < 4.40000000000000035e-62Initial program 92.5%
associate-*l/93.9%
associate-/l*89.8%
Simplified89.8%
Taylor expanded in z around inf 75.4%
Taylor expanded in x around 0 28.9%
mul-1-neg28.9%
associate-/l*27.5%
distribute-rgt-neg-in27.5%
distribute-neg-frac227.5%
Simplified27.5%
clear-num27.5%
un-div-inv27.5%
add-sqr-sqrt13.0%
sqrt-unprod23.3%
sqr-neg23.3%
sqrt-unprod10.4%
add-sqr-sqrt19.4%
Applied egg-rr19.4%
associate-/r/22.2%
/-rgt-identity22.2%
times-frac19.4%
*-rgt-identity19.4%
associate-*r/19.4%
Simplified19.4%
(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 96.4%
associate-*l/85.2%
associate-/l*85.9%
Simplified85.9%
Taylor expanded in y around inf 31.0%
(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 2024186
(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))