
(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 97.3%
Final simplification97.3%
(FPCore (x y z t) :precision binary64 (if (<= y -3.4e+156) (/ (- t) (/ y (- x y))) (if (<= y 1.42e+131) (* (- x y) (/ t (- z y))) (* t (- 1.0 (/ x y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.4e+156) {
tmp = -t / (y / (x - y));
} else if (y <= 1.42e+131) {
tmp = (x - y) * (t / (z - 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 (y <= (-3.4d+156)) then
tmp = -t / (y / (x - y))
else if (y <= 1.42d+131) then
tmp = (x - y) * (t / (z - 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 (y <= -3.4e+156) {
tmp = -t / (y / (x - y));
} else if (y <= 1.42e+131) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.4e+156: tmp = -t / (y / (x - y)) elif y <= 1.42e+131: tmp = (x - y) * (t / (z - y)) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.4e+156) tmp = Float64(Float64(-t) / Float64(y / Float64(x - y))); elseif (y <= 1.42e+131) tmp = Float64(Float64(x - y) * Float64(t / Float64(z - 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 (y <= -3.4e+156) tmp = -t / (y / (x - y)); elseif (y <= 1.42e+131) tmp = (x - y) * (t / (z - y)); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.4e+156], N[((-t) / N[(y / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.42e+131], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+156}:\\
\;\;\;\;\frac{-t}{\frac{y}{x - y}}\\
\mathbf{elif}\;y \leq 1.42 \cdot 10^{+131}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if y < -3.4000000000000001e156Initial program 100.0%
associate-*l/70.9%
*-commutative70.9%
associate-*l/52.6%
Simplified52.6%
Taylor expanded in z around 0 61.9%
mul-1-neg61.9%
associate-/l*88.3%
distribute-neg-frac88.3%
Simplified88.3%
if -3.4000000000000001e156 < y < 1.42e131Initial program 96.3%
associate-*l/92.2%
*-commutative92.2%
associate-*l/95.2%
Simplified95.2%
if 1.42e131 < y Initial program 99.8%
Taylor expanded in z around 0 94.1%
mul-1-neg94.1%
div-sub94.2%
sub-neg94.2%
*-inverses94.2%
metadata-eval94.2%
Simplified94.2%
Taylor expanded in x around 0 83.4%
mul-1-neg83.4%
*-lft-identity83.4%
*-commutative83.4%
associate-*l/94.3%
distribute-lft-neg-out94.3%
distribute-frac-neg94.3%
distribute-rgt-in94.2%
distribute-frac-neg94.2%
sub-neg94.2%
Simplified94.2%
Final simplification94.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7e-5) (not (<= z 0.00105))) (* t (/ (- x y) z)) (/ (- t) (/ y (- x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7e-5) || !(z <= 0.00105)) {
tmp = t * ((x - y) / 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 <= (-7d-5)) .or. (.not. (z <= 0.00105d0))) then
tmp = t * ((x - y) / 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 <= -7e-5) || !(z <= 0.00105)) {
tmp = t * ((x - y) / z);
} else {
tmp = -t / (y / (x - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7e-5) or not (z <= 0.00105): tmp = t * ((x - y) / z) else: tmp = -t / (y / (x - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7e-5) || !(z <= 0.00105)) tmp = Float64(t * Float64(Float64(x - y) / z)); else tmp = Float64(Float64(-t) / Float64(y / Float64(x - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7e-5) || ~((z <= 0.00105))) tmp = t * ((x - y) / z); else tmp = -t / (y / (x - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7e-5], N[Not[LessEqual[z, 0.00105]], $MachinePrecision]], N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[((-t) / N[(y / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-5} \lor \neg \left(z \leq 0.00105\right):\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t}{\frac{y}{x - y}}\\
\end{array}
\end{array}
if z < -6.9999999999999994e-5 or 0.00104999999999999994 < z Initial program 96.5%
Taylor expanded in z around inf 78.9%
if -6.9999999999999994e-5 < z < 0.00104999999999999994Initial program 98.3%
associate-*l/85.0%
*-commutative85.0%
associate-*l/79.2%
Simplified79.2%
Taylor expanded in z around 0 72.1%
mul-1-neg72.1%
associate-/l*84.4%
distribute-neg-frac84.4%
Simplified84.4%
Final simplification81.3%
(FPCore (x y z t)
:precision binary64
(if (<= y -2e+77)
t
(if (<= y -1.75e+33)
(* t (- (/ y z)))
(if (<= y 1.46e+88) (/ t (/ z x)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2e+77) {
tmp = t;
} else if (y <= -1.75e+33) {
tmp = t * -(y / z);
} else if (y <= 1.46e+88) {
tmp = t / (z / 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 <= (-2d+77)) then
tmp = t
else if (y <= (-1.75d+33)) then
tmp = t * -(y / z)
else if (y <= 1.46d+88) then
tmp = t / (z / 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 <= -2e+77) {
tmp = t;
} else if (y <= -1.75e+33) {
tmp = t * -(y / z);
} else if (y <= 1.46e+88) {
tmp = t / (z / x);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2e+77: tmp = t elif y <= -1.75e+33: tmp = t * -(y / z) elif y <= 1.46e+88: tmp = t / (z / x) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2e+77) tmp = t; elseif (y <= -1.75e+33) tmp = Float64(t * Float64(-Float64(y / z))); elseif (y <= 1.46e+88) tmp = Float64(t / Float64(z / x)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2e+77) tmp = t; elseif (y <= -1.75e+33) tmp = t * -(y / z); elseif (y <= 1.46e+88) tmp = t / (z / x); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2e+77], t, If[LessEqual[y, -1.75e+33], N[(t * (-N[(y / z), $MachinePrecision])), $MachinePrecision], If[LessEqual[y, 1.46e+88], N[(t / N[(z / x), $MachinePrecision]), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+77}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -1.75 \cdot 10^{+33}:\\
\;\;\;\;t \cdot \left(-\frac{y}{z}\right)\\
\mathbf{elif}\;y \leq 1.46 \cdot 10^{+88}:\\
\;\;\;\;\frac{t}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.99999999999999997e77 or 1.45999999999999999e88 < y Initial program 99.9%
associate-*l/72.6%
*-commutative72.6%
associate-*l/62.1%
Simplified62.1%
Taylor expanded in y around inf 75.2%
if -1.99999999999999997e77 < y < -1.75000000000000005e33Initial program 99.7%
associate-*l/90.9%
*-commutative90.9%
associate-*l/99.7%
Simplified99.7%
Taylor expanded in z around inf 82.9%
Taylor expanded in x around 0 66.1%
mul-1-neg66.1%
associate-/l*74.6%
Simplified74.6%
clear-num74.5%
associate-/r/74.9%
clear-num74.6%
Applied egg-rr74.6%
if -1.75000000000000005e33 < y < 1.45999999999999999e88Initial program 95.7%
associate-*l/92.7%
*-commutative92.7%
associate-*l/95.7%
Simplified95.7%
Taylor expanded in y around 0 59.5%
associate-/l*63.2%
Simplified63.2%
Final simplification67.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.0002) (not (<= z 0.00135))) (* (- x y) (/ t z)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.0002) || !(z <= 0.00135)) {
tmp = (x - y) * (t / z);
} 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 ((z <= (-0.0002d0)) .or. (.not. (z <= 0.00135d0))) then
tmp = (x - y) * (t / z)
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 ((z <= -0.0002) || !(z <= 0.00135)) {
tmp = (x - y) * (t / z);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.0002) or not (z <= 0.00135): tmp = (x - y) * (t / z) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.0002) || !(z <= 0.00135)) tmp = Float64(Float64(x - y) * Float64(t / z)); 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 ((z <= -0.0002) || ~((z <= 0.00135))) tmp = (x - y) * (t / z); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.0002], N[Not[LessEqual[z, 0.00135]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0002 \lor \neg \left(z \leq 0.00135\right):\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -2.0000000000000001e-4 or 0.0013500000000000001 < z Initial program 96.5%
associate-*l/86.5%
*-commutative86.5%
associate-*l/88.6%
Simplified88.6%
Taylor expanded in z around inf 77.6%
if -2.0000000000000001e-4 < z < 0.0013500000000000001Initial program 98.3%
Taylor expanded in z around 0 84.4%
mul-1-neg84.4%
div-sub84.4%
sub-neg84.4%
*-inverses84.4%
metadata-eval84.4%
Simplified84.4%
Taylor expanded in x around 0 81.0%
mul-1-neg81.0%
*-lft-identity81.0%
*-commutative81.0%
associate-*l/84.4%
distribute-lft-neg-out84.4%
distribute-frac-neg84.4%
distribute-rgt-in84.4%
distribute-frac-neg84.4%
sub-neg84.4%
Simplified84.4%
Final simplification80.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.8e-6) (not (<= z 0.00043))) (* t (/ (- x y) z)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e-6) || !(z <= 0.00043)) {
tmp = t * ((x - y) / z);
} 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 ((z <= (-4.8d-6)) .or. (.not. (z <= 0.00043d0))) then
tmp = t * ((x - y) / z)
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 ((z <= -4.8e-6) || !(z <= 0.00043)) {
tmp = t * ((x - y) / z);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.8e-6) or not (z <= 0.00043): tmp = t * ((x - y) / z) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.8e-6) || !(z <= 0.00043)) tmp = Float64(t * Float64(Float64(x - y) / z)); 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 ((z <= -4.8e-6) || ~((z <= 0.00043))) tmp = t * ((x - y) / z); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.8e-6], N[Not[LessEqual[z, 0.00043]], $MachinePrecision]], N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-6} \lor \neg \left(z \leq 0.00043\right):\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -4.7999999999999998e-6 or 4.29999999999999989e-4 < z Initial program 96.5%
Taylor expanded in z around inf 78.9%
if -4.7999999999999998e-6 < z < 4.29999999999999989e-4Initial program 98.3%
Taylor expanded in z around 0 84.4%
mul-1-neg84.4%
div-sub84.4%
sub-neg84.4%
*-inverses84.4%
metadata-eval84.4%
Simplified84.4%
Taylor expanded in x around 0 81.0%
mul-1-neg81.0%
*-lft-identity81.0%
*-commutative81.0%
associate-*l/84.4%
distribute-lft-neg-out84.4%
distribute-frac-neg84.4%
distribute-rgt-in84.4%
distribute-frac-neg84.4%
sub-neg84.4%
Simplified84.4%
Final simplification81.3%
(FPCore (x y z t) :precision binary64 (if (<= z -0.000175) (/ t (/ z x)) (if (<= z 5e+40) (* t (- 1.0 (/ x y))) (* t (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.000175) {
tmp = t / (z / x);
} else if (z <= 5e+40) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t * (x / 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 (z <= (-0.000175d0)) then
tmp = t / (z / x)
else if (z <= 5d+40) then
tmp = t * (1.0d0 - (x / y))
else
tmp = t * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.000175) {
tmp = t / (z / x);
} else if (z <= 5e+40) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.000175: tmp = t / (z / x) elif z <= 5e+40: tmp = t * (1.0 - (x / y)) else: tmp = t * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.000175) tmp = Float64(t / Float64(z / x)); elseif (z <= 5e+40) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(t * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.000175) tmp = t / (z / x); elseif (z <= 5e+40) tmp = t * (1.0 - (x / y)); else tmp = t * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.000175], N[(t / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+40], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.000175:\\
\;\;\;\;\frac{t}{\frac{z}{x}}\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+40}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -1.74999999999999998e-4Initial program 96.0%
associate-*l/83.5%
*-commutative83.5%
associate-*l/86.6%
Simplified86.6%
Taylor expanded in y around 0 52.3%
associate-/l*54.8%
Simplified54.8%
if -1.74999999999999998e-4 < z < 5.00000000000000003e40Initial program 98.4%
Taylor expanded in z around 0 80.5%
mul-1-neg80.5%
div-sub80.5%
sub-neg80.5%
*-inverses80.5%
metadata-eval80.5%
Simplified80.5%
Taylor expanded in x around 0 77.5%
mul-1-neg77.5%
*-lft-identity77.5%
*-commutative77.5%
associate-*l/80.5%
distribute-lft-neg-out80.5%
distribute-frac-neg80.5%
distribute-rgt-in80.5%
distribute-frac-neg80.5%
sub-neg80.5%
Simplified80.5%
if 5.00000000000000003e40 < z Initial program 96.4%
Taylor expanded in y around 0 65.2%
Final simplification69.6%
(FPCore (x y z t) :precision binary64 (if (<= y -4.5e-33) (* t (/ y (- y z))) (if (<= y 1.46e+88) (* (- x y) (/ t z)) (* t (- 1.0 (/ x y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.5e-33) {
tmp = t * (y / (y - z));
} else if (y <= 1.46e+88) {
tmp = (x - y) * (t / z);
} 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 (y <= (-4.5d-33)) then
tmp = t * (y / (y - z))
else if (y <= 1.46d+88) then
tmp = (x - y) * (t / z)
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 (y <= -4.5e-33) {
tmp = t * (y / (y - z));
} else if (y <= 1.46e+88) {
tmp = (x - y) * (t / z);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4.5e-33: tmp = t * (y / (y - z)) elif y <= 1.46e+88: tmp = (x - y) * (t / z) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4.5e-33) tmp = Float64(t * Float64(y / Float64(y - z))); elseif (y <= 1.46e+88) tmp = Float64(Float64(x - y) * Float64(t / z)); 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 (y <= -4.5e-33) tmp = t * (y / (y - z)); elseif (y <= 1.46e+88) tmp = (x - y) * (t / z); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.5e-33], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.46e+88], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-33}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\mathbf{elif}\;y \leq 1.46 \cdot 10^{+88}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if y < -4.49999999999999991e-33Initial program 99.9%
Taylor expanded in x around 0 77.2%
neg-mul-177.2%
distribute-neg-frac77.2%
Simplified77.2%
frac-2neg77.2%
div-inv77.0%
remove-double-neg77.0%
sub-neg77.0%
distribute-neg-in77.0%
remove-double-neg77.0%
Applied egg-rr77.0%
associate-*r/77.2%
*-rgt-identity77.2%
+-commutative77.2%
unsub-neg77.2%
Simplified77.2%
if -4.49999999999999991e-33 < y < 1.45999999999999999e88Initial program 95.2%
associate-*l/92.7%
*-commutative92.7%
associate-*l/95.3%
Simplified95.3%
Taylor expanded in z around inf 80.6%
if 1.45999999999999999e88 < y Initial program 99.8%
Taylor expanded in z around 0 90.3%
mul-1-neg90.3%
div-sub90.3%
sub-neg90.3%
*-inverses90.3%
metadata-eval90.3%
Simplified90.3%
Taylor expanded in x around 0 81.1%
mul-1-neg81.1%
*-lft-identity81.1%
*-commutative81.1%
associate-*l/90.4%
distribute-lft-neg-out90.4%
distribute-frac-neg90.4%
distribute-rgt-in90.3%
distribute-frac-neg90.3%
sub-neg90.3%
Simplified90.3%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (<= y -2.02e+77) t (if (<= y 1.46e+88) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.02e+77) {
tmp = t;
} else if (y <= 1.46e+88) {
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.02d+77)) then
tmp = t
else if (y <= 1.46d+88) 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.02e+77) {
tmp = t;
} else if (y <= 1.46e+88) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.02e+77: tmp = t elif y <= 1.46e+88: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.02e+77) tmp = t; elseif (y <= 1.46e+88) 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.02e+77) tmp = t; elseif (y <= 1.46e+88) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.02e+77], t, If[LessEqual[y, 1.46e+88], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.02 \cdot 10^{+77}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.46 \cdot 10^{+88}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -2.0199999999999999e77 or 1.45999999999999999e88 < y Initial program 99.9%
associate-*l/72.6%
*-commutative72.6%
associate-*l/62.1%
Simplified62.1%
Taylor expanded in y around inf 75.2%
if -2.0199999999999999e77 < y < 1.45999999999999999e88Initial program 95.9%
associate-*l/92.6%
*-commutative92.6%
associate-*l/95.9%
Simplified95.9%
*-commutative95.9%
clear-num95.3%
div-inv95.8%
div-inv95.7%
associate-/r*95.8%
Applied egg-rr95.8%
Taylor expanded in y around 0 57.7%
associate-*l/60.7%
*-commutative60.7%
Simplified60.7%
Final simplification65.6%
(FPCore (x y z t) :precision binary64 (if (<= y -2e+77) t (if (<= y 1.46e+88) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2e+77) {
tmp = t;
} else if (y <= 1.46e+88) {
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 <= (-2d+77)) then
tmp = t
else if (y <= 1.46d+88) 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 <= -2e+77) {
tmp = t;
} else if (y <= 1.46e+88) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2e+77: tmp = t elif y <= 1.46e+88: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2e+77) tmp = t; elseif (y <= 1.46e+88) 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 <= -2e+77) tmp = t; elseif (y <= 1.46e+88) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2e+77], t, If[LessEqual[y, 1.46e+88], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+77}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.46 \cdot 10^{+88}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.99999999999999997e77 or 1.45999999999999999e88 < y Initial program 99.9%
associate-*l/72.6%
*-commutative72.6%
associate-*l/62.1%
Simplified62.1%
Taylor expanded in y around inf 75.2%
if -1.99999999999999997e77 < y < 1.45999999999999999e88Initial program 95.9%
Taylor expanded in y around 0 61.0%
Final simplification65.8%
(FPCore (x y z t) :precision binary64 (if (<= y -2e+77) t (if (<= y 1.46e+88) (/ t (/ z x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2e+77) {
tmp = t;
} else if (y <= 1.46e+88) {
tmp = t / (z / 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 <= (-2d+77)) then
tmp = t
else if (y <= 1.46d+88) then
tmp = t / (z / 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 <= -2e+77) {
tmp = t;
} else if (y <= 1.46e+88) {
tmp = t / (z / x);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2e+77: tmp = t elif y <= 1.46e+88: tmp = t / (z / x) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2e+77) tmp = t; elseif (y <= 1.46e+88) tmp = Float64(t / Float64(z / x)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2e+77) tmp = t; elseif (y <= 1.46e+88) tmp = t / (z / x); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2e+77], t, If[LessEqual[y, 1.46e+88], N[(t / N[(z / x), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+77}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.46 \cdot 10^{+88}:\\
\;\;\;\;\frac{t}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.99999999999999997e77 or 1.45999999999999999e88 < y Initial program 99.9%
associate-*l/72.6%
*-commutative72.6%
associate-*l/62.1%
Simplified62.1%
Taylor expanded in y around inf 75.2%
if -1.99999999999999997e77 < y < 1.45999999999999999e88Initial program 95.9%
associate-*l/92.6%
*-commutative92.6%
associate-*l/95.9%
Simplified95.9%
Taylor expanded in y around 0 57.7%
associate-/l*61.1%
Simplified61.1%
Final simplification65.9%
(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 97.3%
associate-*l/85.8%
*-commutative85.8%
associate-*l/84.4%
Simplified84.4%
Taylor expanded in y around inf 34.4%
Final simplification34.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 2023310
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
:precision binary64
:herbie-target
(/ t (/ (- z y) (- x y)))
(* (/ (- x y) (- z y)) t))