
(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 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x - y) / (z - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x - y) / (z - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
Initial program 98.3%
Final simplification98.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ (- x y) z))) (t_2 (* t (- 1.0 (/ x y)))))
(if (<= y -4.5e+41)
t_2
(if (<= y 2.75e-216)
t_1
(if (<= y 1e-77) (* t (/ x (- z y))) (if (<= y 1.18e+48) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = t * ((x - y) / z);
double t_2 = t * (1.0 - (x / y));
double tmp;
if (y <= -4.5e+41) {
tmp = t_2;
} else if (y <= 2.75e-216) {
tmp = t_1;
} else if (y <= 1e-77) {
tmp = t * (x / (z - y));
} else if (y <= 1.18e+48) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = t * ((x - y) / z)
t_2 = t * (1.0d0 - (x / y))
if (y <= (-4.5d+41)) then
tmp = t_2
else if (y <= 2.75d-216) then
tmp = t_1
else if (y <= 1d-77) then
tmp = t * (x / (z - y))
else if (y <= 1.18d+48) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * ((x - y) / z);
double t_2 = t * (1.0 - (x / y));
double tmp;
if (y <= -4.5e+41) {
tmp = t_2;
} else if (y <= 2.75e-216) {
tmp = t_1;
} else if (y <= 1e-77) {
tmp = t * (x / (z - y));
} else if (y <= 1.18e+48) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * ((x - y) / z) t_2 = t * (1.0 - (x / y)) tmp = 0 if y <= -4.5e+41: tmp = t_2 elif y <= 2.75e-216: tmp = t_1 elif y <= 1e-77: tmp = t * (x / (z - y)) elif y <= 1.18e+48: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(Float64(x - y) / z)) t_2 = Float64(t * Float64(1.0 - Float64(x / y))) tmp = 0.0 if (y <= -4.5e+41) tmp = t_2; elseif (y <= 2.75e-216) tmp = t_1; elseif (y <= 1e-77) tmp = Float64(t * Float64(x / Float64(z - y))); elseif (y <= 1.18e+48) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * ((x - y) / z); t_2 = t * (1.0 - (x / y)); tmp = 0.0; if (y <= -4.5e+41) tmp = t_2; elseif (y <= 2.75e-216) tmp = t_1; elseif (y <= 1e-77) tmp = t * (x / (z - y)); elseif (y <= 1.18e+48) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.5e+41], t$95$2, If[LessEqual[y, 2.75e-216], t$95$1, If[LessEqual[y, 1e-77], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.18e+48], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x - y}{z}\\
t_2 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;y \leq -4.5 \cdot 10^{+41}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 2.75 \cdot 10^{-216}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 10^{-77}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\mathbf{elif}\;y \leq 1.18 \cdot 10^{+48}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if y < -4.5000000000000001e41 or 1.18000000000000007e48 < y Initial program 99.9%
clear-num99.8%
associate-/r/99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 83.4%
mul-1-neg83.4%
neg-sub083.4%
div-sub83.4%
*-inverses83.4%
associate-+l-83.4%
neg-sub083.4%
neg-mul-183.4%
+-commutative83.4%
neg-mul-183.4%
sub-neg83.4%
Simplified83.4%
if -4.5000000000000001e41 < y < 2.74999999999999995e-216 or 9.9999999999999993e-78 < y < 1.18000000000000007e48Initial program 96.5%
Taylor expanded in z around inf 78.5%
if 2.74999999999999995e-216 < y < 9.9999999999999993e-78Initial program 99.7%
Taylor expanded in x around inf 87.8%
associate-/l*93.6%
Simplified93.6%
Taylor expanded in t around 0 87.8%
associate-*r/93.6%
Simplified93.6%
Final simplification82.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ t (- 1.0 (/ z y)))) (t_2 (* t (/ x (- z y)))))
(if (<= x -0.62)
t_2
(if (<= x 3.2e-106)
t_1
(if (<= x 1.85e-8) (* t (/ (- x y) z)) (if (<= x 9.5e+95) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = t / (1.0 - (z / y));
double t_2 = t * (x / (z - y));
double tmp;
if (x <= -0.62) {
tmp = t_2;
} else if (x <= 3.2e-106) {
tmp = t_1;
} else if (x <= 1.85e-8) {
tmp = t * ((x - y) / z);
} else if (x <= 9.5e+95) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = t / (1.0d0 - (z / y))
t_2 = t * (x / (z - y))
if (x <= (-0.62d0)) then
tmp = t_2
else if (x <= 3.2d-106) then
tmp = t_1
else if (x <= 1.85d-8) then
tmp = t * ((x - y) / z)
else if (x <= 9.5d+95) then
tmp = t_1
else
tmp = t_2
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 t_2 = t * (x / (z - y));
double tmp;
if (x <= -0.62) {
tmp = t_2;
} else if (x <= 3.2e-106) {
tmp = t_1;
} else if (x <= 1.85e-8) {
tmp = t * ((x - y) / z);
} else if (x <= 9.5e+95) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = t / (1.0 - (z / y)) t_2 = t * (x / (z - y)) tmp = 0 if x <= -0.62: tmp = t_2 elif x <= 3.2e-106: tmp = t_1 elif x <= 1.85e-8: tmp = t * ((x - y) / z) elif x <= 9.5e+95: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(t / Float64(1.0 - Float64(z / y))) t_2 = Float64(t * Float64(x / Float64(z - y))) tmp = 0.0 if (x <= -0.62) tmp = t_2; elseif (x <= 3.2e-106) tmp = t_1; elseif (x <= 1.85e-8) tmp = Float64(t * Float64(Float64(x - y) / z)); elseif (x <= 9.5e+95) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t / (1.0 - (z / y)); t_2 = t * (x / (z - y)); tmp = 0.0; if (x <= -0.62) tmp = t_2; elseif (x <= 3.2e-106) tmp = t_1; elseif (x <= 1.85e-8) tmp = t * ((x - y) / z); elseif (x <= 9.5e+95) tmp = t_1; else tmp = t_2; 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]}, Block[{t$95$2 = N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -0.62], t$95$2, If[LessEqual[x, 3.2e-106], t$95$1, If[LessEqual[x, 1.85e-8], N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.5e+95], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{1 - \frac{z}{y}}\\
t_2 := t \cdot \frac{x}{z - y}\\
\mathbf{if}\;x \leq -0.62:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-106}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-8}:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+95}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x < -0.619999999999999996 or 9.5000000000000004e95 < x Initial program 97.3%
Taylor expanded in x around inf 73.9%
associate-/l*83.4%
Simplified83.4%
Taylor expanded in t around 0 73.9%
associate-*r/83.4%
Simplified83.4%
if -0.619999999999999996 < x < 3.2e-106 or 1.85e-8 < x < 9.5000000000000004e95Initial program 99.1%
*-commutative99.1%
associate-*r/84.5%
associate-/l*98.2%
sub-neg98.2%
+-commutative98.2%
neg-sub098.2%
associate-+l-98.2%
sub0-neg98.2%
neg-mul-198.2%
associate-/r*98.2%
Simplified98.2%
Taylor expanded in x around 0 72.1%
expm1-log1p-u60.8%
expm1-udef31.4%
associate-/l*35.8%
div-sub35.8%
*-inverses35.8%
Applied egg-rr35.8%
expm1-def68.0%
expm1-log1p86.4%
Simplified86.4%
if 3.2e-106 < x < 1.85e-8Initial program 99.8%
Taylor expanded in z around inf 77.0%
Final simplification84.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ t (- 1.0 (/ z y)))))
(if (<= x -2900000.0)
(* t (/ x (- z y)))
(if (<= x 3.5e-106)
t_1
(if (<= x 4.4e-5)
(* t (/ (- x y) z))
(if (<= x 2.25e+89) t_1 (/ t (/ (- z y) x))))))))
double code(double x, double y, double z, double t) {
double t_1 = t / (1.0 - (z / y));
double tmp;
if (x <= -2900000.0) {
tmp = t * (x / (z - y));
} else if (x <= 3.5e-106) {
tmp = t_1;
} else if (x <= 4.4e-5) {
tmp = t * ((x - y) / z);
} else if (x <= 2.25e+89) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = t / (1.0d0 - (z / y))
if (x <= (-2900000.0d0)) then
tmp = t * (x / (z - y))
else if (x <= 3.5d-106) then
tmp = t_1
else if (x <= 4.4d-5) then
tmp = t * ((x - y) / z)
else if (x <= 2.25d+89) then
tmp = t_1
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 t_1 = t / (1.0 - (z / y));
double tmp;
if (x <= -2900000.0) {
tmp = t * (x / (z - y));
} else if (x <= 3.5e-106) {
tmp = t_1;
} else if (x <= 4.4e-5) {
tmp = t * ((x - y) / z);
} else if (x <= 2.25e+89) {
tmp = t_1;
} else {
tmp = t / ((z - y) / x);
}
return tmp;
}
def code(x, y, z, t): t_1 = t / (1.0 - (z / y)) tmp = 0 if x <= -2900000.0: tmp = t * (x / (z - y)) elif x <= 3.5e-106: tmp = t_1 elif x <= 4.4e-5: tmp = t * ((x - y) / z) elif x <= 2.25e+89: tmp = t_1 else: tmp = t / ((z - y) / x) return tmp
function code(x, y, z, t) t_1 = Float64(t / Float64(1.0 - Float64(z / y))) tmp = 0.0 if (x <= -2900000.0) tmp = Float64(t * Float64(x / Float64(z - y))); elseif (x <= 3.5e-106) tmp = t_1; elseif (x <= 4.4e-5) tmp = Float64(t * Float64(Float64(x - y) / z)); elseif (x <= 2.25e+89) tmp = t_1; else tmp = Float64(t / Float64(Float64(z - y) / x)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t / (1.0 - (z / y)); tmp = 0.0; if (x <= -2900000.0) tmp = t * (x / (z - y)); elseif (x <= 3.5e-106) tmp = t_1; elseif (x <= 4.4e-5) tmp = t * ((x - y) / z); elseif (x <= 2.25e+89) tmp = t_1; else tmp = t / ((z - y) / x); 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[x, -2900000.0], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-106], t$95$1, If[LessEqual[x, 4.4e-5], N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.25e+89], t$95$1, N[(t / N[(N[(z - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{1 - \frac{z}{y}}\\
\mathbf{if}\;x \leq -2900000:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-106}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{-5}:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{+89}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{z - y}{x}}\\
\end{array}
\end{array}
if x < -2.9e6Initial program 97.2%
Taylor expanded in x around inf 74.8%
associate-/l*80.9%
Simplified80.9%
Taylor expanded in t around 0 74.8%
associate-*r/80.9%
Simplified80.9%
if -2.9e6 < x < 3.5e-106 or 4.3999999999999999e-5 < x < 2.25e89Initial program 99.1%
*-commutative99.1%
associate-*r/84.5%
associate-/l*98.2%
sub-neg98.2%
+-commutative98.2%
neg-sub098.2%
associate-+l-98.2%
sub0-neg98.2%
neg-mul-198.2%
associate-/r*98.2%
Simplified98.2%
Taylor expanded in x around 0 72.1%
expm1-log1p-u60.8%
expm1-udef31.4%
associate-/l*35.8%
div-sub35.8%
*-inverses35.8%
Applied egg-rr35.8%
expm1-def68.0%
expm1-log1p86.4%
Simplified86.4%
if 3.5e-106 < x < 4.3999999999999999e-5Initial program 99.8%
Taylor expanded in z around inf 77.0%
if 2.25e89 < x Initial program 97.4%
Taylor expanded in x around inf 72.3%
associate-/l*87.8%
Simplified87.8%
Final simplification84.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.9e+45) (not (<= y 3.4e+49))) (* t (- 1.0 (/ x y))) (* t (/ x (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.9e+45) || !(y <= 3.4e+49)) {
tmp = t * (1.0 - (x / 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 ((y <= (-1.9d+45)) .or. (.not. (y <= 3.4d+49))) then
tmp = t * (1.0d0 - (x / 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 ((y <= -1.9e+45) || !(y <= 3.4e+49)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t * (x / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.9e+45) or not (y <= 3.4e+49): tmp = t * (1.0 - (x / y)) else: tmp = t * (x / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.9e+45) || !(y <= 3.4e+49)) tmp = Float64(t * Float64(1.0 - Float64(x / 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 ((y <= -1.9e+45) || ~((y <= 3.4e+49))) tmp = t * (1.0 - (x / y)); else tmp = t * (x / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.9e+45], N[Not[LessEqual[y, 3.4e+49]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+45} \lor \neg \left(y \leq 3.4 \cdot 10^{+49}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\end{array}
\end{array}
if y < -1.9000000000000001e45 or 3.4000000000000001e49 < y Initial program 99.9%
clear-num99.9%
associate-/r/99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 83.2%
mul-1-neg83.2%
neg-sub083.2%
div-sub83.2%
*-inverses83.2%
associate-+l-83.2%
neg-sub083.2%
neg-mul-183.2%
+-commutative83.2%
neg-mul-183.2%
sub-neg83.2%
Simplified83.2%
if -1.9000000000000001e45 < y < 3.4000000000000001e49Initial program 97.2%
Taylor expanded in x around inf 74.1%
associate-/l*75.8%
Simplified75.8%
Taylor expanded in t around 0 74.1%
associate-*r/76.2%
Simplified76.2%
Final simplification79.1%
(FPCore (x y z t) :precision binary64 (if (<= y -1.05e+119) t (if (<= y 1.15e+49) (* t (/ x (- z y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.05e+119) {
tmp = t;
} else if (y <= 1.15e+49) {
tmp = t * (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 <= (-1.05d+119)) then
tmp = t
else if (y <= 1.15d+49) then
tmp = t * (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 <= -1.05e+119) {
tmp = t;
} else if (y <= 1.15e+49) {
tmp = t * (x / (z - y));
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.05e+119: tmp = t elif y <= 1.15e+49: tmp = t * (x / (z - y)) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.05e+119) tmp = t; elseif (y <= 1.15e+49) tmp = Float64(t * 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 <= -1.05e+119) tmp = t; elseif (y <= 1.15e+49) tmp = t * (x / (z - y)); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.05e+119], t, If[LessEqual[y, 1.15e+49], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+119}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+49}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.04999999999999991e119 or 1.15000000000000001e49 < y Initial program 99.9%
Taylor expanded in y around inf 64.5%
if -1.04999999999999991e119 < y < 1.15000000000000001e49Initial program 97.4%
Taylor expanded in x around inf 71.9%
associate-/l*75.2%
Simplified75.2%
Taylor expanded in t around 0 71.9%
associate-*r/75.6%
Simplified75.6%
Final simplification71.5%
(FPCore (x y z t) :precision binary64 (if (<= y -1.2e+103) t (if (<= y 2.25e+41) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.2e+103) {
tmp = t;
} else if (y <= 2.25e+41) {
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 <= (-1.2d+103)) then
tmp = t
else if (y <= 2.25d+41) 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 <= -1.2e+103) {
tmp = t;
} else if (y <= 2.25e+41) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.2e+103: tmp = t elif y <= 2.25e+41: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.2e+103) tmp = t; elseif (y <= 2.25e+41) 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 <= -1.2e+103) tmp = t; elseif (y <= 2.25e+41) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.2e+103], t, If[LessEqual[y, 2.25e+41], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+103}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{+41}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.1999999999999999e103 or 2.2500000000000001e41 < y Initial program 99.9%
Taylor expanded in y around inf 62.4%
if -1.1999999999999999e103 < y < 2.2500000000000001e41Initial program 97.4%
clear-num96.7%
associate-/r/97.3%
Applied egg-rr97.3%
Taylor expanded in y around 0 62.9%
associate-*l/58.8%
Simplified58.8%
Final simplification60.2%
(FPCore (x y z t) :precision binary64 (if (<= y -3.7e+107) t (if (<= y 1.6e+51) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.7e+107) {
tmp = t;
} else if (y <= 1.6e+51) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-3.7d+107)) then
tmp = t
else if (y <= 1.6d+51) then
tmp = t * (x / z)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.7e+107) {
tmp = t;
} else if (y <= 1.6e+51) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.7e+107: tmp = t elif y <= 1.6e+51: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.7e+107) tmp = t; elseif (y <= 1.6e+51) tmp = Float64(t * Float64(x / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.7e+107) tmp = t; elseif (y <= 1.6e+51) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.7e+107], t, If[LessEqual[y, 1.6e+51], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{+107}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+51}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -3.7e107 or 1.6000000000000001e51 < y Initial program 99.9%
Taylor expanded in y around inf 63.5%
if -3.7e107 < y < 1.6000000000000001e51Initial program 97.4%
Taylor expanded in y around 0 66.5%
Final simplification65.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 98.3%
Taylor expanded in y around inf 32.6%
Final simplification32.6%
(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 2023297
(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))