
(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 11 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 (let* ((t_1 (* t (/ (- x y) (- z y))))) (if (<= t_1 1e+292) t_1 (* x (/ t (- z y))))))
double code(double x, double y, double z, double t) {
double t_1 = t * ((x - y) / (z - y));
double tmp;
if (t_1 <= 1e+292) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = t * ((x - y) / (z - y))
if (t_1 <= 1d+292) then
tmp = t_1
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 t_1 = t * ((x - y) / (z - y));
double tmp;
if (t_1 <= 1e+292) {
tmp = t_1;
} else {
tmp = x * (t / (z - y));
}
return tmp;
}
def code(x, y, z, t): t_1 = t * ((x - y) / (z - y)) tmp = 0 if t_1 <= 1e+292: tmp = t_1 else: tmp = x * (t / (z - y)) return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(Float64(x - y) / Float64(z - y))) tmp = 0.0 if (t_1 <= 1e+292) tmp = t_1; else tmp = Float64(x * Float64(t / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * ((x - y) / (z - y)); tmp = 0.0; if (t_1 <= 1e+292) tmp = t_1; else tmp = x * (t / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+292], t$95$1, N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x - y}{z - y}\\
\mathbf{if}\;t_1 \leq 10^{+292}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\end{array}
\end{array}
if (*.f64 (/.f64 (-.f64 x y) (-.f64 z y)) t) < 1e292Initial program 98.2%
if 1e292 < (*.f64 (/.f64 (-.f64 x y) (-.f64 z y)) t) Initial program 68.4%
associate-*l/99.8%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in x around inf 99.8%
associate-*l/99.9%
*-commutative99.9%
Simplified99.9%
Final simplification98.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ x (- z y)))))
(if (<= y -3.5e+97)
t
(if (<= y -2.1e+26)
t_1
(if (<= y -8e+15)
t
(if (<= y 2.05e-246)
(* x (/ t (- z y)))
(if (<= y 5.2e+35) t_1 t)))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / (z - y));
double tmp;
if (y <= -3.5e+97) {
tmp = t;
} else if (y <= -2.1e+26) {
tmp = t_1;
} else if (y <= -8e+15) {
tmp = t;
} else if (y <= 2.05e-246) {
tmp = x * (t / (z - y));
} else if (y <= 5.2e+35) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = t * (x / (z - y))
if (y <= (-3.5d+97)) then
tmp = t
else if (y <= (-2.1d+26)) then
tmp = t_1
else if (y <= (-8d+15)) then
tmp = t
else if (y <= 2.05d-246) then
tmp = x * (t / (z - y))
else if (y <= 5.2d+35) then
tmp = t_1
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * (x / (z - y));
double tmp;
if (y <= -3.5e+97) {
tmp = t;
} else if (y <= -2.1e+26) {
tmp = t_1;
} else if (y <= -8e+15) {
tmp = t;
} else if (y <= 2.05e-246) {
tmp = x * (t / (z - y));
} else if (y <= 5.2e+35) {
tmp = t_1;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (x / (z - y)) tmp = 0 if y <= -3.5e+97: tmp = t elif y <= -2.1e+26: tmp = t_1 elif y <= -8e+15: tmp = t elif y <= 2.05e-246: tmp = x * (t / (z - y)) elif y <= 5.2e+35: tmp = t_1 else: tmp = t return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(x / Float64(z - y))) tmp = 0.0 if (y <= -3.5e+97) tmp = t; elseif (y <= -2.1e+26) tmp = t_1; elseif (y <= -8e+15) tmp = t; elseif (y <= 2.05e-246) tmp = Float64(x * Float64(t / Float64(z - y))); elseif (y <= 5.2e+35) tmp = t_1; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (x / (z - y)); tmp = 0.0; if (y <= -3.5e+97) tmp = t; elseif (y <= -2.1e+26) tmp = t_1; elseif (y <= -8e+15) tmp = t; elseif (y <= 2.05e-246) tmp = x * (t / (z - y)); elseif (y <= 5.2e+35) tmp = t_1; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.5e+97], t, If[LessEqual[y, -2.1e+26], t$95$1, If[LessEqual[y, -8e+15], t, If[LessEqual[y, 2.05e-246], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.2e+35], t$95$1, t]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{z - y}\\
\mathbf{if}\;y \leq -3.5 \cdot 10^{+97}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{+26}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -8 \cdot 10^{+15}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{-246}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+35}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -3.5000000000000001e97 or -2.1000000000000001e26 < y < -8e15 or 5.20000000000000013e35 < y Initial program 99.8%
associate-*l/60.8%
associate-*r/74.3%
Simplified74.3%
Taylor expanded in y around inf 68.2%
if -3.5000000000000001e97 < y < -2.1000000000000001e26 or 2.04999999999999993e-246 < y < 5.20000000000000013e35Initial program 96.0%
Taylor expanded in x around inf 67.5%
if -8e15 < y < 2.04999999999999993e-246Initial program 92.3%
associate-*l/98.5%
associate-*r/97.4%
Simplified97.4%
Taylor expanded in x around inf 86.3%
associate-*l/85.2%
*-commutative85.2%
Simplified85.2%
Final simplification73.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ x (- z y)))))
(if (<= y -1.2e+100)
t
(if (<= y -1.65e+26)
t_1
(if (<= y -2e+15)
t
(if (<= y 3.4e-248)
(* x (/ t (- z y)))
(if (<= y 1.75e+35) t_1 (+ t (/ t (/ y z))))))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / (z - y));
double tmp;
if (y <= -1.2e+100) {
tmp = t;
} else if (y <= -1.65e+26) {
tmp = t_1;
} else if (y <= -2e+15) {
tmp = t;
} else if (y <= 3.4e-248) {
tmp = x * (t / (z - y));
} else if (y <= 1.75e+35) {
tmp = t_1;
} else {
tmp = t + (t / (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) :: t_1
real(8) :: tmp
t_1 = t * (x / (z - y))
if (y <= (-1.2d+100)) then
tmp = t
else if (y <= (-1.65d+26)) then
tmp = t_1
else if (y <= (-2d+15)) then
tmp = t
else if (y <= 3.4d-248) then
tmp = x * (t / (z - y))
else if (y <= 1.75d+35) then
tmp = t_1
else
tmp = t + (t / (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * (x / (z - y));
double tmp;
if (y <= -1.2e+100) {
tmp = t;
} else if (y <= -1.65e+26) {
tmp = t_1;
} else if (y <= -2e+15) {
tmp = t;
} else if (y <= 3.4e-248) {
tmp = x * (t / (z - y));
} else if (y <= 1.75e+35) {
tmp = t_1;
} else {
tmp = t + (t / (y / z));
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (x / (z - y)) tmp = 0 if y <= -1.2e+100: tmp = t elif y <= -1.65e+26: tmp = t_1 elif y <= -2e+15: tmp = t elif y <= 3.4e-248: tmp = x * (t / (z - y)) elif y <= 1.75e+35: tmp = t_1 else: tmp = t + (t / (y / z)) return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(x / Float64(z - y))) tmp = 0.0 if (y <= -1.2e+100) tmp = t; elseif (y <= -1.65e+26) tmp = t_1; elseif (y <= -2e+15) tmp = t; elseif (y <= 3.4e-248) tmp = Float64(x * Float64(t / Float64(z - y))); elseif (y <= 1.75e+35) tmp = t_1; else tmp = Float64(t + Float64(t / Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (x / (z - y)); tmp = 0.0; if (y <= -1.2e+100) tmp = t; elseif (y <= -1.65e+26) tmp = t_1; elseif (y <= -2e+15) tmp = t; elseif (y <= 3.4e-248) tmp = x * (t / (z - y)); elseif (y <= 1.75e+35) tmp = t_1; else tmp = t + (t / (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.2e+100], t, If[LessEqual[y, -1.65e+26], t$95$1, If[LessEqual[y, -2e+15], t, If[LessEqual[y, 3.4e-248], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.75e+35], t$95$1, N[(t + N[(t / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{z - y}\\
\mathbf{if}\;y \leq -1.2 \cdot 10^{+100}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -1.65 \cdot 10^{+26}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -2 \cdot 10^{+15}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{-248}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{+35}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t + \frac{t}{\frac{y}{z}}\\
\end{array}
\end{array}
if y < -1.20000000000000006e100 or -1.64999999999999997e26 < y < -2e15Initial program 99.8%
associate-*l/58.6%
associate-*r/72.1%
Simplified72.1%
Taylor expanded in y around inf 73.4%
if -1.20000000000000006e100 < y < -1.64999999999999997e26 or 3.3999999999999998e-248 < y < 1.75e35Initial program 96.0%
Taylor expanded in x around inf 67.5%
if -2e15 < y < 3.3999999999999998e-248Initial program 92.3%
associate-*l/98.5%
associate-*r/97.4%
Simplified97.4%
Taylor expanded in x around inf 86.3%
associate-*l/85.2%
*-commutative85.2%
Simplified85.2%
if 1.75e35 < y Initial program 99.8%
associate-*l/62.7%
associate-*r/76.3%
Simplified76.3%
Taylor expanded in y around inf 72.2%
associate--l+72.2%
distribute-lft-out--72.2%
div-sub72.2%
mul-1-neg72.2%
unsub-neg72.2%
distribute-lft-out--72.4%
Simplified72.4%
Taylor expanded in x around 0 59.0%
sub-neg59.0%
mul-1-neg59.0%
remove-double-neg59.0%
associate-/l*64.0%
Simplified64.0%
Final simplification73.2%
(FPCore (x y z t) :precision binary64 (if (<= y -2.5e+154) (- t (* t (/ x y))) (if (<= y 3.8e+158) (* (- x y) (/ t (- z y))) (* t (/ (- y) (- z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.5e+154) {
tmp = t - (t * (x / y));
} else if (y <= 3.8e+158) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t * (-y / (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.5d+154)) then
tmp = t - (t * (x / y))
else if (y <= 3.8d+158) then
tmp = (x - y) * (t / (z - y))
else
tmp = t * (-y / (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.5e+154) {
tmp = t - (t * (x / y));
} else if (y <= 3.8e+158) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t * (-y / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.5e+154: tmp = t - (t * (x / y)) elif y <= 3.8e+158: tmp = (x - y) * (t / (z - y)) else: tmp = t * (-y / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.5e+154) tmp = Float64(t - Float64(t * Float64(x / y))); elseif (y <= 3.8e+158) tmp = Float64(Float64(x - y) * Float64(t / Float64(z - y))); else tmp = Float64(t * Float64(Float64(-y) / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.5e+154) tmp = t - (t * (x / y)); elseif (y <= 3.8e+158) tmp = (x - y) * (t / (z - y)); else tmp = t * (-y / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.5e+154], N[(t - N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.8e+158], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[((-y) / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+154}:\\
\;\;\;\;t - t \cdot \frac{x}{y}\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+158}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{-y}{z - y}\\
\end{array}
\end{array}
if y < -2.50000000000000002e154Initial program 99.9%
associate-*l/52.6%
associate-*r/64.8%
Simplified64.8%
Taylor expanded in y around inf 69.1%
associate--l+69.1%
distribute-lft-out--69.1%
div-sub69.1%
mul-1-neg69.1%
unsub-neg69.1%
distribute-lft-out--69.1%
Simplified69.1%
Taylor expanded in x around inf 77.8%
associate-/l*88.2%
Simplified88.2%
clear-num88.1%
associate-/r/88.2%
clear-num88.2%
Applied egg-rr88.2%
if -2.50000000000000002e154 < y < 3.7999999999999998e158Initial program 95.2%
associate-*l/92.8%
associate-*r/91.0%
Simplified91.0%
if 3.7999999999999998e158 < y Initial program 99.8%
Taylor expanded in x around 0 86.3%
neg-mul-186.3%
distribute-neg-frac86.3%
Simplified86.3%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.24e-36) (not (<= y 4.7e-39))) (- t (* t (/ x y))) (* x (/ t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.24e-36) || !(y <= 4.7e-39)) {
tmp = t - (t * (x / y));
} 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 <= (-1.24d-36)) .or. (.not. (y <= 4.7d-39))) then
tmp = t - (t * (x / y))
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 <= -1.24e-36) || !(y <= 4.7e-39)) {
tmp = t - (t * (x / y));
} else {
tmp = x * (t / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.24e-36) or not (y <= 4.7e-39): tmp = t - (t * (x / y)) else: tmp = x * (t / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.24e-36) || !(y <= 4.7e-39)) tmp = Float64(t - Float64(t * Float64(x / y))); 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 <= -1.24e-36) || ~((y <= 4.7e-39))) tmp = t - (t * (x / y)); else tmp = x * (t / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.24e-36], N[Not[LessEqual[y, 4.7e-39]], $MachinePrecision]], N[(t - N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.24 \cdot 10^{-36} \lor \neg \left(y \leq 4.7 \cdot 10^{-39}\right):\\
\;\;\;\;t - t \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\end{array}
\end{array}
if y < -1.23999999999999997e-36 or 4.7000000000000002e-39 < y Initial program 99.8%
associate-*l/68.4%
associate-*r/78.6%
Simplified78.6%
Taylor expanded in y around inf 68.8%
associate--l+68.8%
distribute-lft-out--68.8%
div-sub68.8%
mul-1-neg68.8%
unsub-neg68.8%
distribute-lft-out--68.8%
Simplified68.8%
Taylor expanded in x around inf 72.8%
associate-/l*77.8%
Simplified77.8%
clear-num77.8%
associate-/r/77.8%
clear-num77.8%
Applied egg-rr77.8%
if -1.23999999999999997e-36 < y < 4.7000000000000002e-39Initial program 92.1%
associate-*l/97.2%
associate-*r/92.0%
Simplified92.0%
Taylor expanded in x around inf 85.4%
associate-*l/80.9%
*-commutative80.9%
Simplified80.9%
Final simplification79.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.48e-36) (not (<= y 9.6e-39))) (- t (* t (/ x y))) (/ (* t x) (- z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.48e-36) || !(y <= 9.6e-39)) {
tmp = t - (t * (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.48d-36)) .or. (.not. (y <= 9.6d-39))) then
tmp = t - (t * (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.48e-36) || !(y <= 9.6e-39)) {
tmp = t - (t * (x / y));
} else {
tmp = (t * x) / (z - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.48e-36) or not (y <= 9.6e-39): tmp = t - (t * (x / y)) else: tmp = (t * x) / (z - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.48e-36) || !(y <= 9.6e-39)) tmp = Float64(t - Float64(t * Float64(x / y))); else tmp = Float64(Float64(t * x) / Float64(z - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.48e-36) || ~((y <= 9.6e-39))) tmp = t - (t * (x / y)); else tmp = (t * x) / (z - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.48e-36], N[Not[LessEqual[y, 9.6e-39]], $MachinePrecision]], N[(t - N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t * x), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.48 \cdot 10^{-36} \lor \neg \left(y \leq 9.6 \cdot 10^{-39}\right):\\
\;\;\;\;t - t \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot x}{z - y}\\
\end{array}
\end{array}
if y < -1.48e-36 or 9.60000000000000063e-39 < y Initial program 99.8%
associate-*l/68.4%
associate-*r/78.6%
Simplified78.6%
Taylor expanded in y around inf 68.8%
associate--l+68.8%
distribute-lft-out--68.8%
div-sub68.8%
mul-1-neg68.8%
unsub-neg68.8%
distribute-lft-out--68.8%
Simplified68.8%
Taylor expanded in x around inf 72.8%
associate-/l*77.8%
Simplified77.8%
clear-num77.8%
associate-/r/77.8%
clear-num77.8%
Applied egg-rr77.8%
if -1.48e-36 < y < 9.60000000000000063e-39Initial program 92.1%
associate-*l/97.2%
associate-*r/92.0%
Simplified92.0%
Taylor expanded in x around inf 85.4%
Final simplification81.1%
(FPCore (x y z t) :precision binary64 (if (<= y -1.45e+16) t (if (<= y 4.5e+34) (* x (/ t (- z y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.45e+16) {
tmp = t;
} else if (y <= 4.5e+34) {
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 <= (-1.45d+16)) then
tmp = t
else if (y <= 4.5d+34) 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 <= -1.45e+16) {
tmp = t;
} else if (y <= 4.5e+34) {
tmp = x * (t / (z - y));
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.45e+16: tmp = t elif y <= 4.5e+34: tmp = x * (t / (z - y)) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.45e+16) tmp = t; elseif (y <= 4.5e+34) 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 <= -1.45e+16) tmp = t; elseif (y <= 4.5e+34) tmp = x * (t / (z - y)); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.45e+16], t, If[LessEqual[y, 4.5e+34], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{+16}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+34}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.45e16 or 4.5e34 < y Initial program 99.8%
associate-*l/62.8%
associate-*r/74.8%
Simplified74.8%
Taylor expanded in y around inf 63.5%
if -1.45e16 < y < 4.5e34Initial program 93.3%
associate-*l/97.6%
associate-*r/93.3%
Simplified93.3%
Taylor expanded in x around inf 80.6%
associate-*l/77.0%
*-commutative77.0%
Simplified77.0%
Final simplification70.6%
(FPCore (x y z t) :precision binary64 (if (<= y -1.45e-36) t (if (<= y 1.1e+22) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.45e-36) {
tmp = t;
} else if (y <= 1.1e+22) {
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.45d-36)) then
tmp = t
else if (y <= 1.1d+22) 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.45e-36) {
tmp = t;
} else if (y <= 1.1e+22) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.45e-36: tmp = t elif y <= 1.1e+22: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.45e-36) tmp = t; elseif (y <= 1.1e+22) 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.45e-36) tmp = t; elseif (y <= 1.1e+22) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.45e-36], t, If[LessEqual[y, 1.1e+22], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{-36}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+22}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.45000000000000006e-36 or 1.1e22 < y Initial program 99.8%
associate-*l/66.1%
associate-*r/77.1%
Simplified77.1%
Taylor expanded in y around inf 60.3%
if -1.45000000000000006e-36 < y < 1.1e22Initial program 92.7%
associate-*l/97.4%
associate-*r/92.6%
Simplified92.6%
Taylor expanded in x around inf 82.7%
associate-*l/78.6%
*-commutative78.6%
Simplified78.6%
Taylor expanded in z around inf 67.8%
Final simplification63.9%
(FPCore (x y z t) :precision binary64 (if (<= y -1.18e-36) t (if (<= y 2.8e+27) (/ (* t x) z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.18e-36) {
tmp = t;
} else if (y <= 2.8e+27) {
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.18d-36)) then
tmp = t
else if (y <= 2.8d+27) 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.18e-36) {
tmp = t;
} else if (y <= 2.8e+27) {
tmp = (t * x) / z;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.18e-36: tmp = t elif y <= 2.8e+27: tmp = (t * x) / z else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.18e-36) tmp = t; elseif (y <= 2.8e+27) tmp = Float64(Float64(t * x) / z); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.18e-36) tmp = t; elseif (y <= 2.8e+27) tmp = (t * x) / z; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.18e-36], t, If[LessEqual[y, 2.8e+27], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.18 \cdot 10^{-36}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+27}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.1799999999999999e-36 or 2.7999999999999999e27 < y Initial program 99.8%
associate-*l/66.1%
associate-*r/77.1%
Simplified77.1%
Taylor expanded in y around inf 60.3%
if -1.1799999999999999e-36 < y < 2.7999999999999999e27Initial program 92.7%
associate-*l/97.4%
associate-*r/92.6%
Simplified92.6%
Taylor expanded in y around 0 70.3%
Final simplification65.1%
(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 96.4%
associate-*l/81.0%
associate-*r/84.5%
Simplified84.5%
associate-*r/81.0%
associate-*l/96.4%
*-commutative96.4%
clear-num96.4%
un-div-inv96.8%
Applied egg-rr96.8%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 96.4%
associate-*l/81.0%
associate-*r/84.5%
Simplified84.5%
Taylor expanded in y around inf 36.7%
Final simplification36.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 2023224
(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))