
(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 8 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
(let* ((t_1 (* t (/ (- y x) y))))
(if (<= y -1.85e-17)
t_1
(if (<= y -2.1e-94)
(* (- x y) (/ t z))
(if (<= y 3.3e+31) (* x (/ t (- z y))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t * ((y - x) / y);
double tmp;
if (y <= -1.85e-17) {
tmp = t_1;
} else if (y <= -2.1e-94) {
tmp = (x - y) * (t / z);
} else if (y <= 3.3e+31) {
tmp = x * (t / (z - y));
} 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 = t * ((y - x) / y)
if (y <= (-1.85d-17)) then
tmp = t_1
else if (y <= (-2.1d-94)) then
tmp = (x - y) * (t / z)
else if (y <= 3.3d+31) then
tmp = x * (t / (z - y))
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 = t * ((y - x) / y);
double tmp;
if (y <= -1.85e-17) {
tmp = t_1;
} else if (y <= -2.1e-94) {
tmp = (x - y) * (t / z);
} else if (y <= 3.3e+31) {
tmp = x * (t / (z - y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * ((y - x) / y) tmp = 0 if y <= -1.85e-17: tmp = t_1 elif y <= -2.1e-94: tmp = (x - y) * (t / z) elif y <= 3.3e+31: tmp = x * (t / (z - y)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(Float64(y - x) / y)) tmp = 0.0 if (y <= -1.85e-17) tmp = t_1; elseif (y <= -2.1e-94) tmp = Float64(Float64(x - y) * Float64(t / z)); elseif (y <= 3.3e+31) tmp = Float64(x * Float64(t / Float64(z - y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * ((y - x) / y); tmp = 0.0; if (y <= -1.85e-17) tmp = t_1; elseif (y <= -2.1e-94) tmp = (x - y) * (t / z); elseif (y <= 3.3e+31) tmp = x * (t / (z - y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.85e-17], t$95$1, If[LessEqual[y, -2.1e-94], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.3e+31], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{y - x}{y}\\
\mathbf{if}\;y \leq -1.85 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-94}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+31}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -1.8499999999999999e-17 or 3.29999999999999992e31 < y Initial program 99.8%
Taylor expanded in z around 0 62.3%
associate-*r/62.3%
*-commutative62.3%
neg-mul-162.3%
distribute-lft-neg-in62.3%
*-commutative62.3%
associate-/l*79.8%
neg-sub079.8%
associate--r-79.8%
neg-sub079.8%
+-commutative79.8%
sub-neg79.8%
Simplified79.8%
Taylor expanded in t around 0 62.3%
associate-*r/79.8%
Simplified79.8%
if -1.8499999999999999e-17 < y < -2.1000000000000001e-94Initial program 99.9%
Taylor expanded in z around inf 73.0%
associate-/l*78.2%
associate-/r/78.1%
Simplified78.1%
if -2.1000000000000001e-94 < y < 3.29999999999999992e31Initial program 94.7%
*-commutative94.7%
associate-*r/87.0%
associate-/l*94.5%
sub-neg94.5%
+-commutative94.5%
neg-sub094.5%
associate-+l-94.5%
sub0-neg94.5%
neg-mul-194.5%
associate-/r*94.5%
Simplified94.5%
Taylor expanded in x around inf 82.7%
associate-*r/82.7%
neg-mul-182.7%
neg-sub082.7%
associate--r-82.7%
neg-sub082.7%
neg-mul-182.7%
+-commutative82.7%
neg-mul-182.7%
sub-neg82.7%
Simplified82.7%
associate-/r/82.0%
Applied egg-rr82.0%
Final simplification80.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ t (- 1.0 (/ z y)))))
(if (<= y -1.45e-78)
t_1
(if (<= y 1.95e+28)
(* x (/ t (- z y)))
(if (<= y 1.2e+183) (* t (/ (- y x) y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t / (1.0 - (z / y));
double tmp;
if (y <= -1.45e-78) {
tmp = t_1;
} else if (y <= 1.95e+28) {
tmp = x * (t / (z - y));
} else if (y <= 1.2e+183) {
tmp = t * ((y - x) / y);
} 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 = t / (1.0d0 - (z / y))
if (y <= (-1.45d-78)) then
tmp = t_1
else if (y <= 1.95d+28) then
tmp = x * (t / (z - y))
else if (y <= 1.2d+183) then
tmp = t * ((y - x) / y)
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 = t / (1.0 - (z / y));
double tmp;
if (y <= -1.45e-78) {
tmp = t_1;
} else if (y <= 1.95e+28) {
tmp = x * (t / (z - y));
} else if (y <= 1.2e+183) {
tmp = t * ((y - x) / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t / (1.0 - (z / y)) tmp = 0 if y <= -1.45e-78: tmp = t_1 elif y <= 1.95e+28: tmp = x * (t / (z - y)) elif y <= 1.2e+183: tmp = t * ((y - x) / y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t / Float64(1.0 - Float64(z / y))) tmp = 0.0 if (y <= -1.45e-78) tmp = t_1; elseif (y <= 1.95e+28) tmp = Float64(x * Float64(t / Float64(z - y))); elseif (y <= 1.2e+183) tmp = Float64(t * Float64(Float64(y - x) / y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t / (1.0 - (z / y)); tmp = 0.0; if (y <= -1.45e-78) tmp = t_1; elseif (y <= 1.95e+28) tmp = x * (t / (z - y)); elseif (y <= 1.2e+183) tmp = t * ((y - x) / y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t / N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.45e-78], t$95$1, If[LessEqual[y, 1.95e+28], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e+183], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{1 - \frac{z}{y}}\\
\mathbf{if}\;y \leq -1.45 \cdot 10^{-78}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+28}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+183}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -1.45e-78 or 1.2000000000000001e183 < y Initial program 99.8%
*-commutative99.8%
associate-*r/73.9%
associate-/l*99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in x around 0 84.9%
div-sub84.9%
*-inverses84.9%
Simplified84.9%
if -1.45e-78 < y < 1.9499999999999999e28Initial program 94.9%
*-commutative94.9%
associate-*r/86.6%
associate-/l*94.7%
sub-neg94.7%
+-commutative94.7%
neg-sub094.7%
associate-+l-94.7%
sub0-neg94.7%
neg-mul-194.7%
associate-/r*94.7%
Simplified94.7%
Taylor expanded in x around inf 82.6%
associate-*r/82.6%
neg-mul-182.6%
neg-sub082.6%
associate--r-82.6%
neg-sub082.6%
neg-mul-182.6%
+-commutative82.6%
neg-mul-182.6%
sub-neg82.6%
Simplified82.6%
associate-/r/81.9%
Applied egg-rr81.9%
if 1.9499999999999999e28 < y < 1.2000000000000001e183Initial program 99.8%
Taylor expanded in z around 0 70.6%
associate-*r/70.6%
*-commutative70.6%
neg-mul-170.6%
distribute-lft-neg-in70.6%
*-commutative70.6%
associate-/l*82.2%
neg-sub082.2%
associate--r-82.2%
neg-sub082.2%
+-commutative82.2%
sub-neg82.2%
Simplified82.2%
Taylor expanded in t around 0 70.6%
associate-*r/82.2%
Simplified82.2%
Final simplification83.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ t (- 1.0 (/ z y)))))
(if (<= y -2e-78)
t_1
(if (<= y 5.3e+28)
(/ t (/ (- z y) x))
(if (<= y 9.8e+182) (* t (/ (- y x) y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t / (1.0 - (z / y));
double tmp;
if (y <= -2e-78) {
tmp = t_1;
} else if (y <= 5.3e+28) {
tmp = t / ((z - y) / x);
} else if (y <= 9.8e+182) {
tmp = t * ((y - x) / y);
} 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 = t / (1.0d0 - (z / y))
if (y <= (-2d-78)) then
tmp = t_1
else if (y <= 5.3d+28) then
tmp = t / ((z - y) / x)
else if (y <= 9.8d+182) then
tmp = t * ((y - x) / y)
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 = t / (1.0 - (z / y));
double tmp;
if (y <= -2e-78) {
tmp = t_1;
} else if (y <= 5.3e+28) {
tmp = t / ((z - y) / x);
} else if (y <= 9.8e+182) {
tmp = t * ((y - x) / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t / (1.0 - (z / y)) tmp = 0 if y <= -2e-78: tmp = t_1 elif y <= 5.3e+28: tmp = t / ((z - y) / x) elif y <= 9.8e+182: tmp = t * ((y - x) / y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t / Float64(1.0 - Float64(z / y))) tmp = 0.0 if (y <= -2e-78) tmp = t_1; elseif (y <= 5.3e+28) tmp = Float64(t / Float64(Float64(z - y) / x)); elseif (y <= 9.8e+182) tmp = Float64(t * Float64(Float64(y - x) / y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t / (1.0 - (z / y)); tmp = 0.0; if (y <= -2e-78) tmp = t_1; elseif (y <= 5.3e+28) tmp = t / ((z - y) / x); elseif (y <= 9.8e+182) tmp = t * ((y - x) / y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t / N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2e-78], t$95$1, If[LessEqual[y, 5.3e+28], N[(t / N[(N[(z - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.8e+182], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{1 - \frac{z}{y}}\\
\mathbf{if}\;y \leq -2 \cdot 10^{-78}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.3 \cdot 10^{+28}:\\
\;\;\;\;\frac{t}{\frac{z - y}{x}}\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{+182}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -2e-78 or 9.7999999999999999e182 < y Initial program 99.8%
*-commutative99.8%
associate-*r/73.9%
associate-/l*99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
associate-/r*99.9%
Simplified99.9%
Taylor expanded in x around 0 84.9%
div-sub84.9%
*-inverses84.9%
Simplified84.9%
if -2e-78 < y < 5.3000000000000004e28Initial program 94.9%
*-commutative94.9%
associate-*r/86.6%
associate-/l*94.7%
sub-neg94.7%
+-commutative94.7%
neg-sub094.7%
associate-+l-94.7%
sub0-neg94.7%
neg-mul-194.7%
associate-/r*94.7%
Simplified94.7%
Taylor expanded in x around inf 82.6%
associate-*r/82.6%
neg-mul-182.6%
neg-sub082.6%
associate--r-82.6%
neg-sub082.6%
neg-mul-182.6%
+-commutative82.6%
neg-mul-182.6%
sub-neg82.6%
Simplified82.6%
if 5.3000000000000004e28 < y < 9.7999999999999999e182Initial program 99.8%
Taylor expanded in z around 0 70.6%
associate-*r/70.6%
*-commutative70.6%
neg-mul-170.6%
distribute-lft-neg-in70.6%
*-commutative70.6%
associate-/l*82.2%
neg-sub082.2%
associate--r-82.2%
neg-sub082.2%
+-commutative82.2%
sub-neg82.2%
Simplified82.2%
Taylor expanded in t around 0 70.6%
associate-*r/82.2%
Simplified82.2%
Final simplification83.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8e-19) (not (<= y 1.85e-163))) (* t (/ (- y x) y)) (* t (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8e-19) || !(y <= 1.85e-163)) {
tmp = t * ((y - 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 ((y <= (-8d-19)) .or. (.not. (y <= 1.85d-163))) then
tmp = t * ((y - 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 ((y <= -8e-19) || !(y <= 1.85e-163)) {
tmp = t * ((y - x) / y);
} else {
tmp = t * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -8e-19) or not (y <= 1.85e-163): tmp = t * ((y - x) / y) else: tmp = t * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -8e-19) || !(y <= 1.85e-163)) tmp = Float64(t * Float64(Float64(y - 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 ((y <= -8e-19) || ~((y <= 1.85e-163))) tmp = t * ((y - x) / y); else tmp = t * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -8e-19], N[Not[LessEqual[y, 1.85e-163]], $MachinePrecision]], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{-19} \lor \neg \left(y \leq 1.85 \cdot 10^{-163}\right):\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -7.9999999999999998e-19 or 1.85e-163 < y Initial program 99.8%
Taylor expanded in z around 0 58.9%
associate-*r/58.9%
*-commutative58.9%
neg-mul-158.9%
distribute-lft-neg-in58.9%
*-commutative58.9%
associate-/l*73.8%
neg-sub073.8%
associate--r-73.8%
neg-sub073.8%
+-commutative73.8%
sub-neg73.8%
Simplified73.8%
Taylor expanded in t around 0 58.9%
associate-*r/73.8%
Simplified73.8%
if -7.9999999999999998e-19 < y < 1.85e-163Initial program 93.5%
associate-*l/88.3%
clear-num86.9%
Applied egg-rr86.9%
Taylor expanded in y around 0 69.2%
associate-*r/75.0%
Simplified75.0%
Final simplification74.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.7e-17) (not (<= y 7.2e-164))) (* t (/ (- y x) y)) (* (- x y) (/ t z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.7e-17) || !(y <= 7.2e-164)) {
tmp = t * ((y - x) / y);
} else {
tmp = (x - y) * (t / 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 ((y <= (-1.7d-17)) .or. (.not. (y <= 7.2d-164))) then
tmp = t * ((y - x) / y)
else
tmp = (x - y) * (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.7e-17) || !(y <= 7.2e-164)) {
tmp = t * ((y - x) / y);
} else {
tmp = (x - y) * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.7e-17) or not (y <= 7.2e-164): tmp = t * ((y - x) / y) else: tmp = (x - y) * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.7e-17) || !(y <= 7.2e-164)) tmp = Float64(t * Float64(Float64(y - x) / y)); else tmp = Float64(Float64(x - y) * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.7e-17) || ~((y <= 7.2e-164))) tmp = t * ((y - x) / y); else tmp = (x - y) * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.7e-17], N[Not[LessEqual[y, 7.2e-164]], $MachinePrecision]], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{-17} \lor \neg \left(y \leq 7.2 \cdot 10^{-164}\right):\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\end{array}
\end{array}
if y < -1.6999999999999999e-17 or 7.19999999999999988e-164 < y Initial program 99.8%
Taylor expanded in z around 0 58.9%
associate-*r/58.9%
*-commutative58.9%
neg-mul-158.9%
distribute-lft-neg-in58.9%
*-commutative58.9%
associate-/l*73.8%
neg-sub073.8%
associate--r-73.8%
neg-sub073.8%
+-commutative73.8%
sub-neg73.8%
Simplified73.8%
Taylor expanded in t around 0 58.9%
associate-*r/73.8%
Simplified73.8%
if -1.6999999999999999e-17 < y < 7.19999999999999988e-164Initial program 93.5%
Taylor expanded in z around inf 76.3%
associate-/l*81.3%
associate-/r/80.6%
Simplified80.6%
Final simplification76.5%
(FPCore (x y z t) :precision binary64 (if (<= y -1.02e-16) t (if (<= y 6.2e+31) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.02e-16) {
tmp = t;
} else if (y <= 6.2e+31) {
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 <= (-1.02d-16)) then
tmp = t
else if (y <= 6.2d+31) 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 <= -1.02e-16) {
tmp = t;
} else if (y <= 6.2e+31) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.02e-16: tmp = t elif y <= 6.2e+31: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.02e-16) tmp = t; elseif (y <= 6.2e+31) 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 <= -1.02e-16) tmp = t; elseif (y <= 6.2e+31) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.02e-16], t, If[LessEqual[y, 6.2e+31], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.02 \cdot 10^{-16}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+31}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.0200000000000001e-16 or 6.2000000000000004e31 < y Initial program 99.8%
Taylor expanded in y around inf 62.0%
if -1.0200000000000001e-16 < y < 6.2000000000000004e31Initial program 95.4%
associate-*l/87.9%
clear-num86.7%
Applied egg-rr86.7%
Taylor expanded in y around 0 60.7%
associate-*r/66.0%
Simplified66.0%
Final simplification64.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 97.3%
Taylor expanded in y around inf 34.7%
Final simplification34.7%
(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 2023293
(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))