
(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 (/ 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}
Initial program 97.4%
associate-*l/84.4%
associate-/l*82.2%
Simplified82.2%
associate-*r/84.4%
associate-*l/97.4%
*-commutative97.4%
clear-num97.2%
un-div-inv97.6%
Applied egg-rr97.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.15e+246) (not (<= y 6.4e+125))) (- t (/ t (/ y x))) (* (- x y) (/ t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.15e+246) || !(y <= 6.4e+125)) {
tmp = t - (t / (y / x));
} else {
tmp = (x - y) * (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 <= (-2.15d+246)) .or. (.not. (y <= 6.4d+125))) then
tmp = t - (t / (y / x))
else
tmp = (x - y) * (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 <= -2.15e+246) || !(y <= 6.4e+125)) {
tmp = t - (t / (y / x));
} else {
tmp = (x - y) * (t / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.15e+246) or not (y <= 6.4e+125): tmp = t - (t / (y / x)) else: tmp = (x - y) * (t / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.15e+246) || !(y <= 6.4e+125)) tmp = Float64(t - Float64(t / Float64(y / x))); else tmp = Float64(Float64(x - y) * Float64(t / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.15e+246) || ~((y <= 6.4e+125))) tmp = t - (t / (y / x)); else tmp = (x - y) * (t / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.15e+246], N[Not[LessEqual[y, 6.4e+125]], $MachinePrecision]], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{+246} \lor \neg \left(y \leq 6.4 \cdot 10^{+125}\right):\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\end{array}
\end{array}
if y < -2.15000000000000014e246 or 6.39999999999999967e125 < y Initial program 99.9%
associate-*l/70.6%
associate-/l*57.7%
Simplified57.7%
Taylor expanded in y around inf 84.7%
associate--l+84.7%
distribute-lft-out--84.7%
div-sub84.7%
mul-1-neg84.7%
unsub-neg84.7%
div-sub84.7%
associate-/l*91.2%
associate-/l*96.3%
distribute-lft-out--96.3%
div-sub96.3%
Simplified96.3%
Taylor expanded in x around inf 96.2%
clear-num96.2%
un-div-inv96.2%
Applied egg-rr96.2%
if -2.15000000000000014e246 < y < 6.39999999999999967e125Initial program 96.6%
associate-*l/88.4%
associate-/l*89.4%
Simplified89.4%
Final simplification90.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -36000000.0) (not (<= y 1.35e-21))) (* t (/ y (- y z))) (* x (/ t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -36000000.0) || !(y <= 1.35e-21)) {
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 <= (-36000000.0d0)) .or. (.not. (y <= 1.35d-21))) 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 <= -36000000.0) || !(y <= 1.35e-21)) {
tmp = t * (y / (y - z));
} else {
tmp = x * (t / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -36000000.0) or not (y <= 1.35e-21): tmp = t * (y / (y - z)) else: tmp = x * (t / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -36000000.0) || !(y <= 1.35e-21)) 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 <= -36000000.0) || ~((y <= 1.35e-21))) 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, -36000000.0], N[Not[LessEqual[y, 1.35e-21]], $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 -36000000 \lor \neg \left(y \leq 1.35 \cdot 10^{-21}\right):\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\end{array}
\end{array}
if y < -3.6e7 or 1.3500000000000001e-21 < y Initial program 99.9%
Taylor expanded in x around 0 80.1%
neg-mul-180.1%
distribute-neg-frac280.1%
neg-sub080.1%
sub-neg80.1%
+-commutative80.1%
associate--r+80.1%
neg-sub080.1%
remove-double-neg80.1%
Simplified80.1%
if -3.6e7 < y < 1.3500000000000001e-21Initial program 94.8%
associate-*l/92.9%
associate-/l*89.3%
Simplified89.3%
Taylor expanded in x around inf 76.3%
Final simplification78.3%
(FPCore (x y z t) :precision binary64 (if (<= y -1.9e+17) (- t (* t (/ x y))) (if (<= y 2.2e-22) (/ t (/ (- z y) x)) (* t (/ y (- y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.9e+17) {
tmp = t - (t * (x / y));
} else if (y <= 2.2e-22) {
tmp = t / ((z - y) / x);
} else {
tmp = t * (y / (y - z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.9d+17)) then
tmp = t - (t * (x / y))
else if (y <= 2.2d-22) then
tmp = t / ((z - y) / x)
else
tmp = t * (y / (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.9e+17) {
tmp = t - (t * (x / y));
} else if (y <= 2.2e-22) {
tmp = t / ((z - y) / x);
} else {
tmp = t * (y / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.9e+17: tmp = t - (t * (x / y)) elif y <= 2.2e-22: tmp = t / ((z - y) / x) else: tmp = t * (y / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.9e+17) tmp = Float64(t - Float64(t * Float64(x / y))); elseif (y <= 2.2e-22) tmp = Float64(t / Float64(Float64(z - y) / x)); else tmp = Float64(t * Float64(y / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.9e+17) tmp = t - (t * (x / y)); elseif (y <= 2.2e-22) tmp = t / ((z - y) / x); else tmp = t * (y / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.9e+17], N[(t - N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.2e-22], N[(t / N[(N[(z - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+17}:\\
\;\;\;\;t - t \cdot \frac{x}{y}\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{-22}:\\
\;\;\;\;\frac{t}{\frac{z - y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\end{array}
\end{array}
if y < -1.9e17Initial program 99.8%
associate-*l/73.0%
associate-/l*77.9%
Simplified77.9%
Taylor expanded in y around inf 64.9%
associate--l+64.9%
distribute-lft-out--64.9%
div-sub64.9%
mul-1-neg64.9%
unsub-neg64.9%
div-sub64.9%
associate-/l*72.1%
associate-/l*79.6%
distribute-lft-out--79.6%
div-sub79.6%
Simplified79.6%
Taylor expanded in x around inf 80.2%
if -1.9e17 < y < 2.2000000000000001e-22Initial program 94.8%
associate-*l/92.9%
associate-/l*89.4%
Simplified89.4%
associate-*r/92.9%
associate-*l/94.8%
*-commutative94.8%
clear-num94.4%
un-div-inv95.3%
Applied egg-rr95.3%
Taylor expanded in x around inf 80.9%
if 2.2000000000000001e-22 < y Initial program 100.0%
Taylor expanded in x around 0 85.2%
neg-mul-185.2%
distribute-neg-frac285.2%
neg-sub085.2%
sub-neg85.2%
+-commutative85.2%
associate--r+85.2%
neg-sub085.2%
remove-double-neg85.2%
Simplified85.2%
Final simplification81.8%
(FPCore (x y z t) :precision binary64 (if (<= y -8.6e+15) (- t (* t (/ x y))) (if (<= y 1.8e-25) (* x (/ t (- z y))) (* t (/ y (- y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.6e+15) {
tmp = t - (t * (x / y));
} else if (y <= 1.8e-25) {
tmp = x * (t / (z - y));
} else {
tmp = t * (y / (y - z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-8.6d+15)) then
tmp = t - (t * (x / y))
else if (y <= 1.8d-25) then
tmp = x * (t / (z - y))
else
tmp = t * (y / (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.6e+15) {
tmp = t - (t * (x / y));
} else if (y <= 1.8e-25) {
tmp = x * (t / (z - y));
} else {
tmp = t * (y / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.6e+15: tmp = t - (t * (x / y)) elif y <= 1.8e-25: tmp = x * (t / (z - y)) else: tmp = t * (y / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.6e+15) tmp = Float64(t - Float64(t * Float64(x / y))); elseif (y <= 1.8e-25) tmp = Float64(x * Float64(t / Float64(z - y))); else tmp = Float64(t * Float64(y / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8.6e+15) tmp = t - (t * (x / y)); elseif (y <= 1.8e-25) tmp = x * (t / (z - y)); else tmp = t * (y / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.6e+15], N[(t - N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e-25], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.6 \cdot 10^{+15}:\\
\;\;\;\;t - t \cdot \frac{x}{y}\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-25}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\end{array}
\end{array}
if y < -8.6e15Initial program 99.8%
associate-*l/73.0%
associate-/l*77.9%
Simplified77.9%
Taylor expanded in y around inf 64.9%
associate--l+64.9%
distribute-lft-out--64.9%
div-sub64.9%
mul-1-neg64.9%
unsub-neg64.9%
div-sub64.9%
associate-/l*72.1%
associate-/l*79.6%
distribute-lft-out--79.6%
div-sub79.6%
Simplified79.6%
Taylor expanded in x around inf 80.2%
if -8.6e15 < y < 1.8e-25Initial program 94.8%
associate-*l/92.9%
associate-/l*89.4%
Simplified89.4%
Taylor expanded in x around inf 75.8%
if 1.8e-25 < y Initial program 100.0%
Taylor expanded in x around 0 85.2%
neg-mul-185.2%
distribute-neg-frac285.2%
neg-sub085.2%
sub-neg85.2%
+-commutative85.2%
associate--r+85.2%
neg-sub085.2%
remove-double-neg85.2%
Simplified85.2%
Final simplification79.3%
(FPCore (x y z t) :precision binary64 (if (<= y -1.75e+17) (* t (/ (- y x) y)) (if (<= y 1.52e-25) (* x (/ t (- z y))) (* t (/ y (- y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.75e+17) {
tmp = t * ((y - x) / y);
} else if (y <= 1.52e-25) {
tmp = x * (t / (z - y));
} else {
tmp = t * (y / (y - z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.75d+17)) then
tmp = t * ((y - x) / y)
else if (y <= 1.52d-25) then
tmp = x * (t / (z - y))
else
tmp = t * (y / (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.75e+17) {
tmp = t * ((y - x) / y);
} else if (y <= 1.52e-25) {
tmp = x * (t / (z - y));
} else {
tmp = t * (y / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.75e+17: tmp = t * ((y - x) / y) elif y <= 1.52e-25: tmp = x * (t / (z - y)) else: tmp = t * (y / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.75e+17) tmp = Float64(t * Float64(Float64(y - x) / y)); elseif (y <= 1.52e-25) tmp = Float64(x * Float64(t / Float64(z - y))); else tmp = Float64(t * Float64(y / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.75e+17) tmp = t * ((y - x) / y); elseif (y <= 1.52e-25) tmp = x * (t / (z - y)); else tmp = t * (y / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.75e+17], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.52e-25], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{+17}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{elif}\;y \leq 1.52 \cdot 10^{-25}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\end{array}
\end{array}
if y < -1.75e17Initial program 99.8%
Taylor expanded in z around 0 80.2%
associate-*r/80.2%
neg-mul-180.2%
neg-sub080.2%
sub-neg80.2%
+-commutative80.2%
associate--r+80.2%
neg-sub080.2%
remove-double-neg80.2%
Simplified80.2%
if -1.75e17 < y < 1.52000000000000006e-25Initial program 94.8%
associate-*l/92.9%
associate-/l*89.4%
Simplified89.4%
Taylor expanded in x around inf 75.8%
if 1.52000000000000006e-25 < y Initial program 100.0%
Taylor expanded in x around 0 85.2%
neg-mul-185.2%
distribute-neg-frac285.2%
neg-sub085.2%
sub-neg85.2%
+-commutative85.2%
associate--r+85.2%
neg-sub085.2%
remove-double-neg85.2%
Simplified85.2%
Final simplification79.3%
(FPCore (x y z t) :precision binary64 (if (<= y -3.3e+43) t (if (<= y 1.45e+57) (* x (/ t (- z y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.3e+43) {
tmp = t;
} else if (y <= 1.45e+57) {
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 <= (-3.3d+43)) then
tmp = t
else if (y <= 1.45d+57) 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 <= -3.3e+43) {
tmp = t;
} else if (y <= 1.45e+57) {
tmp = x * (t / (z - y));
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.3e+43: tmp = t elif y <= 1.45e+57: tmp = x * (t / (z - y)) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.3e+43) tmp = t; elseif (y <= 1.45e+57) 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 <= -3.3e+43) tmp = t; elseif (y <= 1.45e+57) tmp = x * (t / (z - y)); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.3e+43], t, If[LessEqual[y, 1.45e+57], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{+43}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+57}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -3.3000000000000001e43 or 1.4500000000000001e57 < y Initial program 99.9%
associate-*l/73.4%
associate-/l*71.4%
Simplified71.4%
Taylor expanded in y around inf 72.3%
if -3.3000000000000001e43 < y < 1.4500000000000001e57Initial program 95.5%
associate-*l/92.7%
associate-/l*90.3%
Simplified90.3%
Taylor expanded in x around inf 71.7%
(FPCore (x y z t) :precision binary64 (if (<= y -260.0) t (if (<= y 1.3e+58) (/ t (/ z x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -260.0) {
tmp = t;
} else if (y <= 1.3e+58) {
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 <= (-260.0d0)) then
tmp = t
else if (y <= 1.3d+58) 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 <= -260.0) {
tmp = t;
} else if (y <= 1.3e+58) {
tmp = t / (z / x);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -260.0: tmp = t elif y <= 1.3e+58: tmp = t / (z / x) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -260.0) tmp = t; elseif (y <= 1.3e+58) 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 <= -260.0) tmp = t; elseif (y <= 1.3e+58) tmp = t / (z / x); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -260.0], t, If[LessEqual[y, 1.3e+58], N[(t / N[(z / x), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -260:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+58}:\\
\;\;\;\;\frac{t}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -260 or 1.29999999999999994e58 < y Initial program 99.9%
associate-*l/75.3%
associate-/l*74.2%
Simplified74.2%
Taylor expanded in y around inf 68.6%
if -260 < y < 1.29999999999999994e58Initial program 95.1%
associate-*l/92.7%
associate-/l*89.5%
Simplified89.5%
associate-*r/92.7%
associate-*l/95.1%
*-commutative95.1%
clear-num94.7%
un-div-inv95.5%
Applied egg-rr95.5%
Taylor expanded in y around 0 63.7%
(FPCore (x y z t) :precision binary64 (if (<= y -2000.0) t (if (<= y 9.8e+55) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2000.0) {
tmp = t;
} else if (y <= 9.8e+55) {
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 <= (-2000.0d0)) then
tmp = t
else if (y <= 9.8d+55) 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 <= -2000.0) {
tmp = t;
} else if (y <= 9.8e+55) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2000.0: tmp = t elif y <= 9.8e+55: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2000.0) tmp = t; elseif (y <= 9.8e+55) 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 <= -2000.0) tmp = t; elseif (y <= 9.8e+55) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2000.0], t, If[LessEqual[y, 9.8e+55], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2000:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{+55}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -2e3 or 9.80000000000000029e55 < y Initial program 99.9%
associate-*l/75.3%
associate-/l*74.2%
Simplified74.2%
Taylor expanded in y around inf 68.6%
if -2e3 < y < 9.80000000000000029e55Initial program 95.1%
Taylor expanded in y around 0 63.6%
Final simplification66.0%
(FPCore (x y z t) :precision binary64 (if (<= y -0.04) t (if (<= y 1.2e+56) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.04) {
tmp = t;
} else if (y <= 1.2e+56) {
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.04d0)) then
tmp = t
else if (y <= 1.2d+56) 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.04) {
tmp = t;
} else if (y <= 1.2e+56) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -0.04: tmp = t elif y <= 1.2e+56: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -0.04) tmp = t; elseif (y <= 1.2e+56) 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.04) tmp = t; elseif (y <= 1.2e+56) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -0.04], t, If[LessEqual[y, 1.2e+56], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.04:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+56}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -0.0400000000000000008 or 1.20000000000000007e56 < y Initial program 99.9%
associate-*l/75.3%
associate-/l*74.2%
Simplified74.2%
Taylor expanded in y around inf 68.6%
if -0.0400000000000000008 < y < 1.20000000000000007e56Initial program 95.1%
associate-*l/92.7%
associate-/l*89.5%
Simplified89.5%
Taylor expanded in x around inf 73.6%
Taylor expanded in z around inf 58.7%
(FPCore (x y z t) :precision binary64 (* t (/ (- x y) (- z y))))
double code(double x, double y, double z, double t) {
return t * ((x - y) / (z - 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 * ((x - y) / (z - y))
end function
public static double code(double x, double y, double z, double t) {
return t * ((x - y) / (z - y));
}
def code(x, y, z, t): return t * ((x - y) / (z - y))
function code(x, y, z, t) return Float64(t * Float64(Float64(x - y) / Float64(z - y))) end
function tmp = code(x, y, z, t) tmp = t * ((x - y) / (z - y)); end
code[x_, y_, z_, t_] := N[(t * N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \frac{x - y}{z - y}
\end{array}
Initial program 97.4%
Final simplification97.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 97.4%
associate-*l/84.4%
associate-/l*82.2%
Simplified82.2%
Taylor expanded in y around inf 38.9%
(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 2024116
(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))