
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + 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 - t)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t): return ((x / y) * (z - t)) + t
function code(x, y, z, t) return Float64(Float64(Float64(x / y) * Float64(z - t)) + t) end
function tmp = code(x, y, z, t) tmp = ((x / y) * (z - t)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} \cdot \left(z - t\right) + 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 t)) t))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + 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 - t)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t): return ((x / y) * (z - t)) + t
function code(x, y, z, t) return Float64(Float64(Float64(x / y) * Float64(z - t)) + t) end
function tmp = code(x, y, z, t) tmp = ((x / y) * (z - t)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} \cdot \left(z - t\right) + t
\end{array}
(FPCore (x y z t) :precision binary64 (fma (/ x y) (- z t) t))
double code(double x, double y, double z, double t) {
return fma((x / y), (z - t), t);
}
function code(x, y, z, t) return fma(Float64(x / y), Float64(z - t), t) end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)
\end{array}
Initial program 98.4%
fma-define98.4%
Simplified98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x z) y)) (t_2 (* t (- 1.0 (/ x y)))))
(if (<= z -4.2e+130)
t_1
(if (<= z 0.000195)
t_2
(if (<= z 1.25e+76) (* x (/ z y)) (if (<= z 7.6e+127) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * z) / y;
double t_2 = t * (1.0 - (x / y));
double tmp;
if (z <= -4.2e+130) {
tmp = t_1;
} else if (z <= 0.000195) {
tmp = t_2;
} else if (z <= 1.25e+76) {
tmp = x * (z / y);
} else if (z <= 7.6e+127) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = (x * z) / y
t_2 = t * (1.0d0 - (x / y))
if (z <= (-4.2d+130)) then
tmp = t_1
else if (z <= 0.000195d0) then
tmp = t_2
else if (z <= 1.25d+76) then
tmp = x * (z / y)
else if (z <= 7.6d+127) then
tmp = t_2
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 = (x * z) / y;
double t_2 = t * (1.0 - (x / y));
double tmp;
if (z <= -4.2e+130) {
tmp = t_1;
} else if (z <= 0.000195) {
tmp = t_2;
} else if (z <= 1.25e+76) {
tmp = x * (z / y);
} else if (z <= 7.6e+127) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * z) / y t_2 = t * (1.0 - (x / y)) tmp = 0 if z <= -4.2e+130: tmp = t_1 elif z <= 0.000195: tmp = t_2 elif z <= 1.25e+76: tmp = x * (z / y) elif z <= 7.6e+127: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * z) / y) t_2 = Float64(t * Float64(1.0 - Float64(x / y))) tmp = 0.0 if (z <= -4.2e+130) tmp = t_1; elseif (z <= 0.000195) tmp = t_2; elseif (z <= 1.25e+76) tmp = Float64(x * Float64(z / y)); elseif (z <= 7.6e+127) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * z) / y; t_2 = t * (1.0 - (x / y)); tmp = 0.0; if (z <= -4.2e+130) tmp = t_1; elseif (z <= 0.000195) tmp = t_2; elseif (z <= 1.25e+76) tmp = x * (z / y); elseif (z <= 7.6e+127) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.2e+130], t$95$1, If[LessEqual[z, 0.000195], t$95$2, If[LessEqual[z, 1.25e+76], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.6e+127], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot z}{y}\\
t_2 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{+130}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.000195:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+76}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+127}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.19999999999999981e130 or 7.59999999999999961e127 < z Initial program 98.7%
Taylor expanded in x around inf 76.6%
associate--l+76.6%
div-sub79.1%
Simplified79.1%
Taylor expanded in t around 0 69.0%
*-commutative69.0%
associate-*l/75.9%
Applied egg-rr75.9%
if -4.19999999999999981e130 < z < 1.94999999999999996e-4 or 1.24999999999999998e76 < z < 7.59999999999999961e127Initial program 98.2%
Taylor expanded in z around 0 74.8%
mul-1-neg74.8%
unsub-neg74.8%
*-rgt-identity74.8%
associate-/l*77.7%
distribute-lft-out--77.7%
Simplified77.7%
if 1.94999999999999996e-4 < z < 1.24999999999999998e76Initial program 99.4%
Taylor expanded in x around inf 94.2%
associate--l+94.2%
div-sub94.3%
Simplified94.3%
Taylor expanded in t around 0 73.2%
Final simplification76.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x z) y)))
(if (<= y -9.5e+74)
t
(if (<= y -1.3e-70)
t_1
(if (<= y -4.5e-87) (/ (* x t) x) (if (<= y 4.4e+127) t_1 t))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * z) / y;
double tmp;
if (y <= -9.5e+74) {
tmp = t;
} else if (y <= -1.3e-70) {
tmp = t_1;
} else if (y <= -4.5e-87) {
tmp = (x * t) / x;
} else if (y <= 4.4e+127) {
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 = (x * z) / y
if (y <= (-9.5d+74)) then
tmp = t
else if (y <= (-1.3d-70)) then
tmp = t_1
else if (y <= (-4.5d-87)) then
tmp = (x * t) / x
else if (y <= 4.4d+127) 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 = (x * z) / y;
double tmp;
if (y <= -9.5e+74) {
tmp = t;
} else if (y <= -1.3e-70) {
tmp = t_1;
} else if (y <= -4.5e-87) {
tmp = (x * t) / x;
} else if (y <= 4.4e+127) {
tmp = t_1;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * z) / y tmp = 0 if y <= -9.5e+74: tmp = t elif y <= -1.3e-70: tmp = t_1 elif y <= -4.5e-87: tmp = (x * t) / x elif y <= 4.4e+127: tmp = t_1 else: tmp = t return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * z) / y) tmp = 0.0 if (y <= -9.5e+74) tmp = t; elseif (y <= -1.3e-70) tmp = t_1; elseif (y <= -4.5e-87) tmp = Float64(Float64(x * t) / x); elseif (y <= 4.4e+127) tmp = t_1; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * z) / y; tmp = 0.0; if (y <= -9.5e+74) tmp = t; elseif (y <= -1.3e-70) tmp = t_1; elseif (y <= -4.5e-87) tmp = (x * t) / x; elseif (y <= 4.4e+127) tmp = t_1; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -9.5e+74], t, If[LessEqual[y, -1.3e-70], t$95$1, If[LessEqual[y, -4.5e-87], N[(N[(x * t), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 4.4e+127], t$95$1, t]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot z}{y}\\
\mathbf{if}\;y \leq -9.5 \cdot 10^{+74}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -1.3 \cdot 10^{-70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -4.5 \cdot 10^{-87}:\\
\;\;\;\;\frac{x \cdot t}{x}\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+127}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -9.5000000000000006e74 or 4.4000000000000003e127 < y Initial program 98.8%
Taylor expanded in x around 0 62.1%
if -9.5000000000000006e74 < y < -1.30000000000000001e-70 or -4.49999999999999958e-87 < y < 4.4000000000000003e127Initial program 98.1%
Taylor expanded in x around inf 80.1%
associate--l+80.1%
div-sub82.0%
Simplified82.0%
Taylor expanded in t around 0 55.1%
*-commutative55.1%
associate-*l/62.6%
Applied egg-rr62.6%
if -1.30000000000000001e-70 < y < -4.49999999999999958e-87Initial program 99.8%
Taylor expanded in x around inf 86.3%
associate--l+86.3%
div-sub86.3%
Simplified86.3%
Taylor expanded in x around 0 31.2%
associate-*r/71.9%
Applied egg-rr71.9%
Final simplification62.7%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -50000000000.0) (* x (/ (- z t) y)) (if (<= (/ x y) 1e-14) (+ t (* (/ x y) z)) (* (/ 1.0 y) (* x (- z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -50000000000.0) {
tmp = x * ((z - t) / y);
} else if ((x / y) <= 1e-14) {
tmp = t + ((x / y) * z);
} else {
tmp = (1.0 / y) * (x * (z - 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 ((x / y) <= (-50000000000.0d0)) then
tmp = x * ((z - t) / y)
else if ((x / y) <= 1d-14) then
tmp = t + ((x / y) * z)
else
tmp = (1.0d0 / y) * (x * (z - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -50000000000.0) {
tmp = x * ((z - t) / y);
} else if ((x / y) <= 1e-14) {
tmp = t + ((x / y) * z);
} else {
tmp = (1.0 / y) * (x * (z - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -50000000000.0: tmp = x * ((z - t) / y) elif (x / y) <= 1e-14: tmp = t + ((x / y) * z) else: tmp = (1.0 / y) * (x * (z - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -50000000000.0) tmp = Float64(x * Float64(Float64(z - t) / y)); elseif (Float64(x / y) <= 1e-14) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(Float64(1.0 / y) * Float64(x * Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -50000000000.0) tmp = x * ((z - t) / y); elseif ((x / y) <= 1e-14) tmp = t + ((x / y) * z); else tmp = (1.0 / y) * (x * (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -50000000000.0], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e-14], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] * N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -50000000000:\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-14}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y} \cdot \left(x \cdot \left(z - t\right)\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -5e10Initial program 98.5%
Taylor expanded in x around inf 92.6%
associate--l+92.6%
div-sub92.7%
Simplified92.7%
Taylor expanded in x around inf 92.2%
div-sub92.3%
Simplified92.3%
if -5e10 < (/.f64 x y) < 9.99999999999999999e-15Initial program 99.1%
Taylor expanded in z around inf 94.8%
associate-/l*90.1%
Simplified90.1%
clear-num90.1%
un-div-inv90.5%
Applied egg-rr90.5%
associate-/r/98.9%
Applied egg-rr98.9%
if 9.99999999999999999e-15 < (/.f64 x y) Initial program 97.1%
*-commutative97.1%
clear-num97.0%
un-div-inv97.0%
Applied egg-rr97.0%
Taylor expanded in y around 0 95.7%
Taylor expanded in x around -inf 95.0%
clear-num94.9%
associate-/r/95.0%
Applied egg-rr95.0%
Final simplification96.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -50000000000.0) (not (<= (/ x y) 5e-22))) (* x (/ (- z t) y)) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -50000000000.0) || !((x / y) <= 5e-22)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + ((x / 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 (((x / y) <= (-50000000000.0d0)) .or. (.not. ((x / y) <= 5d-22))) then
tmp = x * ((z - t) / y)
else
tmp = t + ((x / y) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -50000000000.0) || !((x / y) <= 5e-22)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -50000000000.0) or not ((x / y) <= 5e-22): tmp = x * ((z - t) / y) else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -50000000000.0) || !(Float64(x / y) <= 5e-22)) tmp = Float64(x * Float64(Float64(z - t) / y)); else tmp = Float64(t + Float64(Float64(x / y) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -50000000000.0) || ~(((x / y) <= 5e-22))) tmp = x * ((z - t) / y); else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -50000000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e-22]], $MachinePrecision]], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -50000000000 \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-22}\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if (/.f64 x y) < -5e10 or 4.99999999999999954e-22 < (/.f64 x y) Initial program 97.8%
Taylor expanded in x around inf 91.4%
associate--l+91.4%
div-sub93.6%
Simplified93.6%
Taylor expanded in x around inf 90.4%
div-sub92.6%
Simplified92.6%
if -5e10 < (/.f64 x y) < 4.99999999999999954e-22Initial program 99.1%
Taylor expanded in z around inf 95.5%
associate-/l*90.0%
Simplified90.0%
clear-num90.0%
un-div-inv90.4%
Applied egg-rr90.4%
associate-/r/98.9%
Applied egg-rr98.9%
Final simplification95.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1e-10) (not (<= (/ x y) 5e-22))) (* x (/ (- z t) y)) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e-10) || !((x / y) <= 5e-22)) {
tmp = x * ((z - t) / 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 (((x / y) <= (-1d-10)) .or. (.not. ((x / y) <= 5d-22))) then
tmp = x * ((z - t) / 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 (((x / y) <= -1e-10) || !((x / y) <= 5e-22)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1e-10) or not ((x / y) <= 5e-22): tmp = x * ((z - t) / y) else: tmp = t + (x * (z / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1e-10) || !(Float64(x / y) <= 5e-22)) tmp = Float64(x * Float64(Float64(z - t) / 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 (((x / y) <= -1e-10) || ~(((x / y) <= 5e-22))) tmp = x * ((z - t) / y); else tmp = t + (x * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1e-10], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e-22]], $MachinePrecision]], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{-10} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-22}\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -1.00000000000000004e-10 or 4.99999999999999954e-22 < (/.f64 x y) Initial program 97.9%
Taylor expanded in x around inf 90.9%
associate--l+90.9%
div-sub93.1%
Simplified93.1%
Taylor expanded in x around inf 90.0%
div-sub92.1%
Simplified92.1%
if -1.00000000000000004e-10 < (/.f64 x y) < 4.99999999999999954e-22Initial program 99.0%
Taylor expanded in z around inf 97.0%
associate-/l*90.5%
Simplified90.5%
Final simplification91.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e-35) (not (<= (/ x y) 5e-66))) (* x (/ (- z t) y)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e-35) || !((x / y) <= 5e-66)) {
tmp = x * ((z - t) / 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 (((x / y) <= (-2d-35)) .or. (.not. ((x / y) <= 5d-66))) then
tmp = x * ((z - t) / 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 (((x / y) <= -2e-35) || !((x / y) <= 5e-66)) {
tmp = x * ((z - t) / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e-35) or not ((x / y) <= 5e-66): tmp = x * ((z - t) / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2e-35) || !(Float64(x / y) <= 5e-66)) tmp = Float64(x * Float64(Float64(z - t) / y)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2e-35) || ~(((x / y) <= 5e-66))) tmp = x * ((z - t) / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2e-35], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e-66]], $MachinePrecision]], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{-35} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-66}\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -2.00000000000000002e-35 or 4.99999999999999962e-66 < (/.f64 x y) Initial program 98.0%
Taylor expanded in x around inf 88.2%
associate--l+88.2%
div-sub90.2%
Simplified90.2%
Taylor expanded in x around inf 85.6%
div-sub87.5%
Simplified87.5%
if -2.00000000000000002e-35 < (/.f64 x y) < 4.99999999999999962e-66Initial program 98.9%
Taylor expanded in x around 0 74.8%
Final simplification82.6%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -50000000000.0) (* x (/ (- z t) y)) (if (<= (/ x y) 1e-14) (+ t (* (/ x y) z)) (/ (* x (- z t)) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -50000000000.0) {
tmp = x * ((z - t) / y);
} else if ((x / y) <= 1e-14) {
tmp = t + ((x / y) * z);
} else {
tmp = (x * (z - t)) / 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 ((x / y) <= (-50000000000.0d0)) then
tmp = x * ((z - t) / y)
else if ((x / y) <= 1d-14) then
tmp = t + ((x / y) * z)
else
tmp = (x * (z - t)) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -50000000000.0) {
tmp = x * ((z - t) / y);
} else if ((x / y) <= 1e-14) {
tmp = t + ((x / y) * z);
} else {
tmp = (x * (z - t)) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -50000000000.0: tmp = x * ((z - t) / y) elif (x / y) <= 1e-14: tmp = t + ((x / y) * z) else: tmp = (x * (z - t)) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -50000000000.0) tmp = Float64(x * Float64(Float64(z - t) / y)); elseif (Float64(x / y) <= 1e-14) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(Float64(x * Float64(z - t)) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -50000000000.0) tmp = x * ((z - t) / y); elseif ((x / y) <= 1e-14) tmp = t + ((x / y) * z); else tmp = (x * (z - t)) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -50000000000.0], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e-14], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -50000000000:\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-14}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(z - t\right)}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -5e10Initial program 98.5%
Taylor expanded in x around inf 92.6%
associate--l+92.6%
div-sub92.7%
Simplified92.7%
Taylor expanded in x around inf 92.2%
div-sub92.3%
Simplified92.3%
if -5e10 < (/.f64 x y) < 9.99999999999999999e-15Initial program 99.1%
Taylor expanded in z around inf 94.8%
associate-/l*90.1%
Simplified90.1%
clear-num90.1%
un-div-inv90.5%
Applied egg-rr90.5%
associate-/r/98.9%
Applied egg-rr98.9%
if 9.99999999999999999e-15 < (/.f64 x y) Initial program 97.1%
*-commutative97.1%
clear-num97.0%
un-div-inv97.0%
Applied egg-rr97.0%
Taylor expanded in y around 0 95.7%
Taylor expanded in x around -inf 95.0%
Final simplification96.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5e-75) (not (<= x 1.3e+25))) (* x (/ z y)) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5e-75) || !(x <= 1.3e+25)) {
tmp = 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 ((x <= (-5d-75)) .or. (.not. (x <= 1.3d+25))) then
tmp = 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 ((x <= -5e-75) || !(x <= 1.3e+25)) {
tmp = x * (z / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5e-75) or not (x <= 1.3e+25): tmp = x * (z / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5e-75) || !(x <= 1.3e+25)) tmp = Float64(x * Float64(z / y)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5e-75) || ~((x <= 1.3e+25))) tmp = x * (z / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5e-75], N[Not[LessEqual[x, 1.3e+25]], $MachinePrecision]], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-75} \lor \neg \left(x \leq 1.3 \cdot 10^{+25}\right):\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if x < -4.99999999999999979e-75 or 1.2999999999999999e25 < x Initial program 98.1%
Taylor expanded in x around inf 93.6%
associate--l+93.6%
div-sub95.5%
Simplified95.5%
Taylor expanded in t around 0 60.1%
if -4.99999999999999979e-75 < x < 1.2999999999999999e25Initial program 98.9%
Taylor expanded in x around 0 59.9%
Final simplification60.0%
(FPCore (x y z t) :precision binary64 (if (<= x -4.5e-75) (/ x (/ y z)) (if (<= x 1.3e+25) t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.5e-75) {
tmp = x / (y / z);
} else if (x <= 1.3e+25) {
tmp = t;
} else {
tmp = 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 (x <= (-4.5d-75)) then
tmp = x / (y / z)
else if (x <= 1.3d+25) then
tmp = t
else
tmp = x * (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.5e-75) {
tmp = x / (y / z);
} else if (x <= 1.3e+25) {
tmp = t;
} else {
tmp = x * (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.5e-75: tmp = x / (y / z) elif x <= 1.3e+25: tmp = t else: tmp = x * (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.5e-75) tmp = Float64(x / Float64(y / z)); elseif (x <= 1.3e+25) tmp = t; else tmp = Float64(x * Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -4.5e-75) tmp = x / (y / z); elseif (x <= 1.3e+25) tmp = t; else tmp = x * (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.5e-75], N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.3e+25], t, N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-75}:\\
\;\;\;\;\frac{x}{\frac{y}{z}}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+25}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if x < -4.5000000000000003e-75Initial program 98.8%
Taylor expanded in x around inf 92.5%
associate--l+92.5%
div-sub94.6%
Simplified94.6%
Taylor expanded in t around 0 58.4%
clear-num73.9%
un-div-inv74.0%
Applied egg-rr58.5%
if -4.5000000000000003e-75 < x < 1.2999999999999999e25Initial program 98.9%
Taylor expanded in x around 0 59.9%
if 1.2999999999999999e25 < x Initial program 96.9%
Taylor expanded in x around inf 95.3%
associate--l+95.3%
div-sub96.8%
Simplified96.8%
Taylor expanded in t around 0 62.6%
(FPCore (x y z t) :precision binary64 (+ t (* (/ x y) (- z t))))
double code(double x, double y, double z, double t) {
return t + ((x / y) * (z - 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 + ((x / y) * (z - t))
end function
public static double code(double x, double y, double z, double t) {
return t + ((x / y) * (z - t));
}
def code(x, y, z, t): return t + ((x / y) * (z - t))
function code(x, y, z, t) return Float64(t + Float64(Float64(x / y) * Float64(z - t))) end
function tmp = code(x, y, z, t) tmp = t + ((x / y) * (z - t)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \frac{x}{y} \cdot \left(z - t\right)
\end{array}
Initial program 98.4%
Final simplification98.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.4%
Taylor expanded in x around 0 32.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (* (/ x y) (- z t)) t)))
(if (< z 2.759456554562692e-282)
t_1
(if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((x / y) * (z - t)) + t;
double tmp;
if (z < 2.759456554562692e-282) {
tmp = t_1;
} else if (z < 2.326994450874436e-110) {
tmp = (x * ((z - t) / y)) + t;
} 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 = ((x / y) * (z - t)) + t
if (z < 2.759456554562692d-282) then
tmp = t_1
else if (z < 2.326994450874436d-110) then
tmp = (x * ((z - t) / y)) + t
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 = ((x / y) * (z - t)) + t;
double tmp;
if (z < 2.759456554562692e-282) {
tmp = t_1;
} else if (z < 2.326994450874436e-110) {
tmp = (x * ((z - t) / y)) + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((x / y) * (z - t)) + t tmp = 0 if z < 2.759456554562692e-282: tmp = t_1 elif z < 2.326994450874436e-110: tmp = (x * ((z - t) / y)) + t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x / y) * Float64(z - t)) + t) tmp = 0.0 if (z < 2.759456554562692e-282) tmp = t_1; elseif (z < 2.326994450874436e-110) tmp = Float64(Float64(x * Float64(Float64(z - t) / y)) + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((x / y) * (z - t)) + t; tmp = 0.0; if (z < 2.759456554562692e-282) tmp = t_1; elseif (z < 2.326994450874436e-110) tmp = (x * ((z - t) / y)) + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[Less[z, 2.759456554562692e-282], t$95$1, If[Less[z, 2.326994450874436e-110], N[(N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(z - t\right) + t\\
\mathbf{if}\;z < 2.759456554562692 \cdot 10^{-282}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 2.326994450874436 \cdot 10^{-110}:\\
\;\;\;\;x \cdot \frac{z - t}{y} + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024101
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:alt
(if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))
(+ (* (/ x y) (- z t)) t))