
(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 9 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 (if (<= x 1.65e-116) (+ t (* (/ x y) (- z t))) (+ t (/ x (/ y (- z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.65e-116) {
tmp = t + ((x / y) * (z - t));
} else {
tmp = t + (x / (y / (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 <= 1.65d-116) then
tmp = t + ((x / y) * (z - t))
else
tmp = t + (x / (y / (z - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.65e-116) {
tmp = t + ((x / y) * (z - t));
} else {
tmp = t + (x / (y / (z - t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 1.65e-116: tmp = t + ((x / y) * (z - t)) else: tmp = t + (x / (y / (z - t))) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 1.65e-116) tmp = Float64(t + Float64(Float64(x / y) * Float64(z - t))); else tmp = Float64(t + Float64(x / Float64(y / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 1.65e-116) tmp = t + ((x / y) * (z - t)); else tmp = t + (x / (y / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 1.65e-116], N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(x / N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.65 \cdot 10^{-116}:\\
\;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z - t}}\\
\end{array}
\end{array}
if x < 1.65e-116Initial program 97.6%
if 1.65e-116 < x Initial program 94.6%
div-inv94.6%
associate-*l*99.8%
associate-/r/99.7%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- 1.0 (/ x y)))))
(if (<= t -2.2e+91)
t_1
(if (<= t -2.5e-33)
(+ t (* x (/ z y)))
(if (<= t -5.2e-56)
(- t (* x (/ t y)))
(if (<= t 4.4e+189) (+ t (* (/ x y) z)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (1.0 - (x / y));
double tmp;
if (t <= -2.2e+91) {
tmp = t_1;
} else if (t <= -2.5e-33) {
tmp = t + (x * (z / y));
} else if (t <= -5.2e-56) {
tmp = t - (x * (t / y));
} else if (t <= 4.4e+189) {
tmp = t + ((x / y) * z);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = t * (1.0d0 - (x / y))
if (t <= (-2.2d+91)) then
tmp = t_1
else if (t <= (-2.5d-33)) then
tmp = t + (x * (z / y))
else if (t <= (-5.2d-56)) then
tmp = t - (x * (t / y))
else if (t <= 4.4d+189) then
tmp = t + ((x / y) * z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * (1.0 - (x / y));
double tmp;
if (t <= -2.2e+91) {
tmp = t_1;
} else if (t <= -2.5e-33) {
tmp = t + (x * (z / y));
} else if (t <= -5.2e-56) {
tmp = t - (x * (t / y));
} else if (t <= 4.4e+189) {
tmp = t + ((x / y) * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (1.0 - (x / y)) tmp = 0 if t <= -2.2e+91: tmp = t_1 elif t <= -2.5e-33: tmp = t + (x * (z / y)) elif t <= -5.2e-56: tmp = t - (x * (t / y)) elif t <= 4.4e+189: tmp = t + ((x / y) * z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(1.0 - Float64(x / y))) tmp = 0.0 if (t <= -2.2e+91) tmp = t_1; elseif (t <= -2.5e-33) tmp = Float64(t + Float64(x * Float64(z / y))); elseif (t <= -5.2e-56) tmp = Float64(t - Float64(x * Float64(t / y))); elseif (t <= 4.4e+189) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (1.0 - (x / y)); tmp = 0.0; if (t <= -2.2e+91) tmp = t_1; elseif (t <= -2.5e-33) tmp = t + (x * (z / y)); elseif (t <= -5.2e-56) tmp = t - (x * (t / y)); elseif (t <= 4.4e+189) tmp = t + ((x / y) * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.2e+91], t$95$1, If[LessEqual[t, -2.5e-33], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -5.2e-56], N[(t - N[(x * N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.4e+189], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;t \leq -2.2 \cdot 10^{+91}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2.5 \cdot 10^{-33}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\mathbf{elif}\;t \leq -5.2 \cdot 10^{-56}:\\
\;\;\;\;t - x \cdot \frac{t}{y}\\
\mathbf{elif}\;t \leq 4.4 \cdot 10^{+189}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.19999999999999999e91 or 4.4000000000000001e189 < t Initial program 99.9%
associate-*l/94.7%
associate-/l*81.9%
fma-define81.9%
Simplified81.9%
Taylor expanded in z around 0 89.5%
mul-1-neg89.5%
*-rgt-identity89.5%
associate-/l*94.8%
distribute-rgt-neg-in94.8%
mul-1-neg94.8%
distribute-lft-in94.7%
mul-1-neg94.7%
unsub-neg94.7%
Simplified94.7%
if -2.19999999999999999e91 < t < -2.50000000000000014e-33Initial program 99.9%
Taylor expanded in z around inf 93.4%
associate-/l*96.6%
Simplified96.6%
if -2.50000000000000014e-33 < t < -5.19999999999999994e-56Initial program 88.3%
Taylor expanded in z around 0 99.8%
associate-*r/99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-rgt-neg-out99.8%
associate-/l*99.6%
distribute-neg-frac99.6%
distribute-neg-frac299.6%
Simplified99.6%
if -5.19999999999999994e-56 < t < 4.4000000000000001e189Initial program 94.7%
div-inv94.6%
associate-*l*93.3%
associate-/r/93.3%
un-div-inv94.0%
Applied egg-rr94.0%
Taylor expanded in z around inf 80.0%
associate-/r/85.2%
Applied egg-rr85.2%
Final simplification89.6%
(FPCore (x y z t)
:precision binary64
(if (<= t -2.3e+91)
(* t (- 1.0 (/ x y)))
(if (<= t -2.5e-33)
(+ t (* x (/ z y)))
(if (<= t -6.2e-58)
(- t (* x (/ t y)))
(if (<= t 1.75e+189) (+ t (* (/ x y) z)) (- t (* (/ x y) t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.3e+91) {
tmp = t * (1.0 - (x / y));
} else if (t <= -2.5e-33) {
tmp = t + (x * (z / y));
} else if (t <= -6.2e-58) {
tmp = t - (x * (t / y));
} else if (t <= 1.75e+189) {
tmp = t + ((x / y) * z);
} else {
tmp = t - ((x / y) * 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 (t <= (-2.3d+91)) then
tmp = t * (1.0d0 - (x / y))
else if (t <= (-2.5d-33)) then
tmp = t + (x * (z / y))
else if (t <= (-6.2d-58)) then
tmp = t - (x * (t / y))
else if (t <= 1.75d+189) then
tmp = t + ((x / y) * z)
else
tmp = t - ((x / y) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.3e+91) {
tmp = t * (1.0 - (x / y));
} else if (t <= -2.5e-33) {
tmp = t + (x * (z / y));
} else if (t <= -6.2e-58) {
tmp = t - (x * (t / y));
} else if (t <= 1.75e+189) {
tmp = t + ((x / y) * z);
} else {
tmp = t - ((x / y) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.3e+91: tmp = t * (1.0 - (x / y)) elif t <= -2.5e-33: tmp = t + (x * (z / y)) elif t <= -6.2e-58: tmp = t - (x * (t / y)) elif t <= 1.75e+189: tmp = t + ((x / y) * z) else: tmp = t - ((x / y) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.3e+91) tmp = Float64(t * Float64(1.0 - Float64(x / y))); elseif (t <= -2.5e-33) tmp = Float64(t + Float64(x * Float64(z / y))); elseif (t <= -6.2e-58) tmp = Float64(t - Float64(x * Float64(t / y))); elseif (t <= 1.75e+189) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(t - Float64(Float64(x / y) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.3e+91) tmp = t * (1.0 - (x / y)); elseif (t <= -2.5e-33) tmp = t + (x * (z / y)); elseif (t <= -6.2e-58) tmp = t - (x * (t / y)); elseif (t <= 1.75e+189) tmp = t + ((x / y) * z); else tmp = t - ((x / y) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.3e+91], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2.5e-33], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -6.2e-58], N[(t - N[(x * N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.75e+189], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{+91}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{elif}\;t \leq -2.5 \cdot 10^{-33}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\mathbf{elif}\;t \leq -6.2 \cdot 10^{-58}:\\
\;\;\;\;t - x \cdot \frac{t}{y}\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{+189}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\end{array}
\end{array}
if t < -2.29999999999999991e91Initial program 99.9%
associate-*l/93.1%
associate-/l*86.7%
fma-define86.7%
Simplified86.7%
Taylor expanded in z around 0 86.8%
mul-1-neg86.8%
*-rgt-identity86.8%
associate-/l*93.5%
distribute-rgt-neg-in93.5%
mul-1-neg93.5%
distribute-lft-in93.5%
mul-1-neg93.5%
unsub-neg93.5%
Simplified93.5%
if -2.29999999999999991e91 < t < -2.50000000000000014e-33Initial program 99.9%
Taylor expanded in z around inf 93.4%
associate-/l*96.6%
Simplified96.6%
if -2.50000000000000014e-33 < t < -6.1999999999999998e-58Initial program 88.3%
Taylor expanded in z around 0 99.8%
associate-*r/99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-rgt-neg-out99.8%
associate-/l*99.6%
distribute-neg-frac99.6%
distribute-neg-frac299.6%
Simplified99.6%
if -6.1999999999999998e-58 < t < 1.74999999999999998e189Initial program 94.7%
div-inv94.6%
associate-*l*93.3%
associate-/r/93.3%
un-div-inv94.0%
Applied egg-rr94.0%
Taylor expanded in z around inf 80.0%
associate-/r/85.2%
Applied egg-rr85.2%
if 1.74999999999999998e189 < t Initial program 99.9%
Taylor expanded in z around 0 93.5%
mul-1-neg93.5%
associate-/l*96.6%
distribute-lft-neg-out96.6%
*-commutative96.6%
Simplified96.6%
Final simplification89.6%
(FPCore (x y z t)
:precision binary64
(if (<= t -1.7e+89)
(* t (- 1.0 (/ x y)))
(if (<= t -2.5e-33)
(+ t (* x (/ z y)))
(if (<= t -6.2e-58)
(- t (/ (* x t) y))
(if (<= t 1.75e+189) (+ t (* (/ x y) z)) (- t (* (/ x y) t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.7e+89) {
tmp = t * (1.0 - (x / y));
} else if (t <= -2.5e-33) {
tmp = t + (x * (z / y));
} else if (t <= -6.2e-58) {
tmp = t - ((x * t) / y);
} else if (t <= 1.75e+189) {
tmp = t + ((x / y) * z);
} else {
tmp = t - ((x / y) * 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 (t <= (-1.7d+89)) then
tmp = t * (1.0d0 - (x / y))
else if (t <= (-2.5d-33)) then
tmp = t + (x * (z / y))
else if (t <= (-6.2d-58)) then
tmp = t - ((x * t) / y)
else if (t <= 1.75d+189) then
tmp = t + ((x / y) * z)
else
tmp = t - ((x / y) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.7e+89) {
tmp = t * (1.0 - (x / y));
} else if (t <= -2.5e-33) {
tmp = t + (x * (z / y));
} else if (t <= -6.2e-58) {
tmp = t - ((x * t) / y);
} else if (t <= 1.75e+189) {
tmp = t + ((x / y) * z);
} else {
tmp = t - ((x / y) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.7e+89: tmp = t * (1.0 - (x / y)) elif t <= -2.5e-33: tmp = t + (x * (z / y)) elif t <= -6.2e-58: tmp = t - ((x * t) / y) elif t <= 1.75e+189: tmp = t + ((x / y) * z) else: tmp = t - ((x / y) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.7e+89) tmp = Float64(t * Float64(1.0 - Float64(x / y))); elseif (t <= -2.5e-33) tmp = Float64(t + Float64(x * Float64(z / y))); elseif (t <= -6.2e-58) tmp = Float64(t - Float64(Float64(x * t) / y)); elseif (t <= 1.75e+189) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(t - Float64(Float64(x / y) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.7e+89) tmp = t * (1.0 - (x / y)); elseif (t <= -2.5e-33) tmp = t + (x * (z / y)); elseif (t <= -6.2e-58) tmp = t - ((x * t) / y); elseif (t <= 1.75e+189) tmp = t + ((x / y) * z); else tmp = t - ((x / y) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.7e+89], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2.5e-33], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -6.2e-58], N[(t - N[(N[(x * t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.75e+189], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{+89}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{elif}\;t \leq -2.5 \cdot 10^{-33}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\mathbf{elif}\;t \leq -6.2 \cdot 10^{-58}:\\
\;\;\;\;t - \frac{x \cdot t}{y}\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{+189}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\end{array}
\end{array}
if t < -1.7000000000000001e89Initial program 99.9%
associate-*l/93.1%
associate-/l*86.7%
fma-define86.7%
Simplified86.7%
Taylor expanded in z around 0 86.8%
mul-1-neg86.8%
*-rgt-identity86.8%
associate-/l*93.5%
distribute-rgt-neg-in93.5%
mul-1-neg93.5%
distribute-lft-in93.5%
mul-1-neg93.5%
unsub-neg93.5%
Simplified93.5%
if -1.7000000000000001e89 < t < -2.50000000000000014e-33Initial program 99.9%
Taylor expanded in z around inf 93.4%
associate-/l*96.6%
Simplified96.6%
if -2.50000000000000014e-33 < t < -6.1999999999999998e-58Initial program 88.3%
Taylor expanded in z around 0 99.8%
associate-*r/99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-rgt-neg-out99.8%
associate-/l*99.6%
distribute-neg-frac99.6%
distribute-neg-frac299.6%
Simplified99.6%
*-commutative99.6%
distribute-frac-neg299.6%
distribute-frac-neg99.6%
associate-*l/99.8%
Applied egg-rr99.8%
if -6.1999999999999998e-58 < t < 1.74999999999999998e189Initial program 94.7%
div-inv94.6%
associate-*l*93.3%
associate-/r/93.3%
un-div-inv94.0%
Applied egg-rr94.0%
Taylor expanded in z around inf 80.0%
associate-/r/85.2%
Applied egg-rr85.2%
if 1.74999999999999998e189 < t Initial program 99.9%
Taylor expanded in z around 0 93.5%
mul-1-neg93.5%
associate-/l*96.6%
distribute-lft-neg-out96.6%
*-commutative96.6%
Simplified96.6%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.6e+88) (not (<= t 1.02e-61))) (* t (- 1.0 (/ x y))) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.6e+88) || !(t <= 1.02e-61)) {
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 ((t <= (-4.6d+88)) .or. (.not. (t <= 1.02d-61))) 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 ((t <= -4.6e+88) || !(t <= 1.02e-61)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.6e+88) or not (t <= 1.02e-61): tmp = t * (1.0 - (x / y)) else: tmp = t + (x * (z / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.6e+88) || !(t <= 1.02e-61)) 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 ((t <= -4.6e+88) || ~((t <= 1.02e-61))) 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[t, -4.6e+88], N[Not[LessEqual[t, 1.02e-61]], $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}\;t \leq -4.6 \cdot 10^{+88} \lor \neg \left(t \leq 1.02 \cdot 10^{-61}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if t < -4.6000000000000003e88 or 1.02e-61 < t Initial program 98.3%
associate-*l/94.3%
associate-/l*87.1%
fma-define87.1%
Simplified87.1%
Taylor expanded in z around 0 84.1%
mul-1-neg84.1%
*-rgt-identity84.1%
associate-/l*87.4%
distribute-rgt-neg-in87.4%
mul-1-neg87.4%
distribute-lft-in87.4%
mul-1-neg87.4%
unsub-neg87.4%
Simplified87.4%
if -4.6000000000000003e88 < t < 1.02e-61Initial program 95.0%
Taylor expanded in z around inf 81.0%
associate-/l*83.7%
Simplified83.7%
Final simplification85.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.8e+90) (not (<= t 1.75e+189))) (* t (- 1.0 (/ x y))) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.8e+90) || !(t <= 1.75e+189)) {
tmp = t * (1.0 - (x / 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 ((t <= (-3.8d+90)) .or. (.not. (t <= 1.75d+189))) then
tmp = t * (1.0d0 - (x / 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 ((t <= -3.8e+90) || !(t <= 1.75e+189)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.8e+90) or not (t <= 1.75e+189): tmp = t * (1.0 - (x / y)) else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.8e+90) || !(t <= 1.75e+189)) tmp = Float64(t * Float64(1.0 - Float64(x / 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 ((t <= -3.8e+90) || ~((t <= 1.75e+189))) tmp = t * (1.0 - (x / y)); else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.8e+90], N[Not[LessEqual[t, 1.75e+189]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+90} \lor \neg \left(t \leq 1.75 \cdot 10^{+189}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if t < -3.8000000000000001e90 or 1.74999999999999998e189 < t Initial program 99.9%
associate-*l/94.7%
associate-/l*81.9%
fma-define81.9%
Simplified81.9%
Taylor expanded in z around 0 89.5%
mul-1-neg89.5%
*-rgt-identity89.5%
associate-/l*94.8%
distribute-rgt-neg-in94.8%
mul-1-neg94.8%
distribute-lft-in94.7%
mul-1-neg94.7%
unsub-neg94.7%
Simplified94.7%
if -3.8000000000000001e90 < t < 1.74999999999999998e189Initial program 95.2%
div-inv95.2%
associate-*l*94.1%
associate-/r/94.1%
un-div-inv94.7%
Applied egg-rr94.7%
Taylor expanded in z around inf 80.8%
associate-/r/85.0%
Applied egg-rr85.0%
Final simplification87.8%
(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 96.6%
Final simplification96.6%
(FPCore (x y z t) :precision binary64 (* t (- 1.0 (/ x y))))
double code(double x, double y, double z, double t) {
return t * (1.0 - (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 * (1.0d0 - (x / y))
end function
public static double code(double x, double y, double z, double t) {
return t * (1.0 - (x / y));
}
def code(x, y, z, t): return t * (1.0 - (x / y))
function code(x, y, z, t) return Float64(t * Float64(1.0 - Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = t * (1.0 - (x / y)); end
code[x_, y_, z_, t_] := N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(1 - \frac{x}{y}\right)
\end{array}
Initial program 96.6%
associate-*l/92.5%
associate-/l*90.6%
fma-define90.6%
Simplified90.6%
Taylor expanded in z around 0 62.3%
mul-1-neg62.3%
*-rgt-identity62.3%
associate-/l*64.5%
distribute-rgt-neg-in64.5%
mul-1-neg64.5%
distribute-lft-in64.5%
mul-1-neg64.5%
unsub-neg64.5%
Simplified64.5%
Final simplification64.5%
(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.6%
associate-*l/92.5%
associate-/l*90.6%
fma-define90.6%
Simplified90.6%
Taylor expanded in x around 0 38.2%
Final simplification38.2%
(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 2024078
(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))