
(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 (or (<= t -7.1e-152) (not (<= t 1.5e-172))) (+ t (* (/ x y) (- z t))) (fma x (/ (- z t) y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.1e-152) || !(t <= 1.5e-172)) {
tmp = t + ((x / y) * (z - t));
} else {
tmp = fma(x, ((z - t) / y), t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.1e-152) || !(t <= 1.5e-172)) tmp = Float64(t + Float64(Float64(x / y) * Float64(z - t))); else tmp = fma(x, Float64(Float64(z - t) / y), t); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7.1e-152], N[Not[LessEqual[t, 1.5e-172]], $MachinePrecision]], N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.1 \cdot 10^{-152} \lor \neg \left(t \leq 1.5 \cdot 10^{-172}\right):\\
\;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)\\
\end{array}
\end{array}
if t < -7.10000000000000011e-152 or 1.49999999999999992e-172 < t Initial program 99.9%
if -7.10000000000000011e-152 < t < 1.49999999999999992e-172Initial program 82.4%
associate-*l/90.4%
associate-/l*99.8%
fma-define99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(if (or (<= t -1.08e+99)
(not
(or (<= t -1.05e-13) (and (not (<= t -1.9e-60)) (<= t 1.1e-55)))))
(* t (- 1.0 (/ x y)))
(+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.08e+99) || !((t <= -1.05e-13) || (!(t <= -1.9e-60) && (t <= 1.1e-55)))) {
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 <= (-1.08d+99)) .or. (.not. (t <= (-1.05d-13)) .or. (.not. (t <= (-1.9d-60))) .and. (t <= 1.1d-55))) 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 <= -1.08e+99) || !((t <= -1.05e-13) || (!(t <= -1.9e-60) && (t <= 1.1e-55)))) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.08e+99) or not ((t <= -1.05e-13) or (not (t <= -1.9e-60) and (t <= 1.1e-55))): 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 <= -1.08e+99) || !((t <= -1.05e-13) || (!(t <= -1.9e-60) && (t <= 1.1e-55)))) 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 <= -1.08e+99) || ~(((t <= -1.05e-13) || (~((t <= -1.9e-60)) && (t <= 1.1e-55))))) 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, -1.08e+99], N[Not[Or[LessEqual[t, -1.05e-13], And[N[Not[LessEqual[t, -1.9e-60]], $MachinePrecision], LessEqual[t, 1.1e-55]]]], $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 -1.08 \cdot 10^{+99} \lor \neg \left(t \leq -1.05 \cdot 10^{-13} \lor \neg \left(t \leq -1.9 \cdot 10^{-60}\right) \land t \leq 1.1 \cdot 10^{-55}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if t < -1.08e99 or -1.04999999999999994e-13 < t < -1.89999999999999997e-60 or 1.1e-55 < t Initial program 99.9%
Taylor expanded in z around 0 88.2%
mul-1-neg88.2%
unsub-neg88.2%
*-rgt-identity88.2%
associate-/l*93.2%
distribute-lft-out--93.2%
Simplified93.2%
if -1.08e99 < t < -1.04999999999999994e-13 or -1.89999999999999997e-60 < t < 1.1e-55Initial program 91.4%
Taylor expanded in z around inf 77.2%
associate-/l*86.6%
Simplified86.6%
Final simplification90.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ t (* x (/ z y)))) (t_2 (* t (- 1.0 (/ x y)))))
(if (<= t -5.5e+98)
t_2
(if (<= t -2.3e-13)
t_1
(if (<= t -9.6e-58) (- t (* x (/ t y))) (if (<= t 8.5e-56) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = t + (x * (z / y));
double t_2 = t * (1.0 - (x / y));
double tmp;
if (t <= -5.5e+98) {
tmp = t_2;
} else if (t <= -2.3e-13) {
tmp = t_1;
} else if (t <= -9.6e-58) {
tmp = t - (x * (t / y));
} else if (t <= 8.5e-56) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t + (x * (z / y))
t_2 = t * (1.0d0 - (x / y))
if (t <= (-5.5d+98)) then
tmp = t_2
else if (t <= (-2.3d-13)) then
tmp = t_1
else if (t <= (-9.6d-58)) then
tmp = t - (x * (t / y))
else if (t <= 8.5d-56) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t + (x * (z / y));
double t_2 = t * (1.0 - (x / y));
double tmp;
if (t <= -5.5e+98) {
tmp = t_2;
} else if (t <= -2.3e-13) {
tmp = t_1;
} else if (t <= -9.6e-58) {
tmp = t - (x * (t / y));
} else if (t <= 8.5e-56) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = t + (x * (z / y)) t_2 = t * (1.0 - (x / y)) tmp = 0 if t <= -5.5e+98: tmp = t_2 elif t <= -2.3e-13: tmp = t_1 elif t <= -9.6e-58: tmp = t - (x * (t / y)) elif t <= 8.5e-56: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(t + Float64(x * Float64(z / y))) t_2 = Float64(t * Float64(1.0 - Float64(x / y))) tmp = 0.0 if (t <= -5.5e+98) tmp = t_2; elseif (t <= -2.3e-13) tmp = t_1; elseif (t <= -9.6e-58) tmp = Float64(t - Float64(x * Float64(t / y))); elseif (t <= 8.5e-56) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t + (x * (z / y)); t_2 = t * (1.0 - (x / y)); tmp = 0.0; if (t <= -5.5e+98) tmp = t_2; elseif (t <= -2.3e-13) tmp = t_1; elseif (t <= -9.6e-58) tmp = t - (x * (t / y)); elseif (t <= 8.5e-56) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.5e+98], t$95$2, If[LessEqual[t, -2.3e-13], t$95$1, If[LessEqual[t, -9.6e-58], N[(t - N[(x * N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.5e-56], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + x \cdot \frac{z}{y}\\
t_2 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;t \leq -5.5 \cdot 10^{+98}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -2.3 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -9.6 \cdot 10^{-58}:\\
\;\;\;\;t - x \cdot \frac{t}{y}\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-56}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -5.49999999999999946e98 or 8.49999999999999932e-56 < t Initial program 99.9%
Taylor expanded in z around 0 87.4%
mul-1-neg87.4%
unsub-neg87.4%
*-rgt-identity87.4%
associate-/l*92.8%
distribute-lft-out--92.8%
Simplified92.8%
if -5.49999999999999946e98 < t < -2.29999999999999979e-13 or -9.6000000000000002e-58 < t < 8.49999999999999932e-56Initial program 91.4%
Taylor expanded in z around inf 77.2%
associate-/l*86.6%
Simplified86.6%
if -2.29999999999999979e-13 < t < -9.6000000000000002e-58Initial program 99.8%
*-commutative99.8%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
div-inv99.8%
clear-num99.8%
div-inv99.8%
associate-*r*100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 100.0%
mul-1-neg100.0%
associate-*r/99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
cancel-sign-sub-inv99.8%
associate-*l/100.0%
associate-/l*100.0%
Simplified100.0%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ t (* (/ x y) (- z t))))) (if (<= t_1 -2.5e+305) (+ t (* (* x (- z t)) (/ 1.0 y))) t_1)))
double code(double x, double y, double z, double t) {
double t_1 = t + ((x / y) * (z - t));
double tmp;
if (t_1 <= -2.5e+305) {
tmp = t + ((x * (z - t)) * (1.0 / y));
} 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 + ((x / y) * (z - t))
if (t_1 <= (-2.5d+305)) then
tmp = t + ((x * (z - t)) * (1.0d0 / y))
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 + ((x / y) * (z - t));
double tmp;
if (t_1 <= -2.5e+305) {
tmp = t + ((x * (z - t)) * (1.0 / y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t + ((x / y) * (z - t)) tmp = 0 if t_1 <= -2.5e+305: tmp = t + ((x * (z - t)) * (1.0 / y)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t + Float64(Float64(x / y) * Float64(z - t))) tmp = 0.0 if (t_1 <= -2.5e+305) tmp = Float64(t + Float64(Float64(x * Float64(z - t)) * Float64(1.0 / y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t + ((x / y) * (z - t)); tmp = 0.0; if (t_1 <= -2.5e+305) tmp = t + ((x * (z - t)) * (1.0 / y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2.5e+305], N[(t + N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -2.5 \cdot 10^{+305}:\\
\;\;\;\;t + \left(x \cdot \left(z - t\right)\right) \cdot \frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) < -2.50000000000000004e305Initial program 84.3%
*-commutative84.3%
clear-num84.4%
un-div-inv84.4%
Applied egg-rr84.4%
div-inv84.4%
clear-num84.3%
div-inv84.4%
associate-*r*100.0%
Applied egg-rr100.0%
if -2.50000000000000004e305 < (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) Initial program 97.7%
Final simplification98.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.9e+37) (not (<= x 4e+29))) (* t (/ x (- y))) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.9e+37) || !(x <= 4e+29)) {
tmp = t * (x / -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 <= (-1.9d+37)) .or. (.not. (x <= 4d+29))) then
tmp = t * (x / -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 <= -1.9e+37) || !(x <= 4e+29)) {
tmp = t * (x / -y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.9e+37) or not (x <= 4e+29): tmp = t * (x / -y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.9e+37) || !(x <= 4e+29)) tmp = Float64(t * Float64(x / Float64(-y))); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.9e+37) || ~((x <= 4e+29))) tmp = t * (x / -y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.9e+37], N[Not[LessEqual[x, 4e+29]], $MachinePrecision]], N[(t * N[(x / (-y)), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{+37} \lor \neg \left(x \leq 4 \cdot 10^{+29}\right):\\
\;\;\;\;t \cdot \frac{x}{-y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if x < -1.89999999999999995e37 or 3.99999999999999966e29 < x Initial program 93.8%
*-commutative93.8%
clear-num93.8%
un-div-inv93.8%
Applied egg-rr93.8%
div-inv93.8%
clear-num93.8%
div-inv93.8%
associate-*r*85.7%
Applied egg-rr85.7%
Taylor expanded in z around 0 54.2%
mul-1-neg54.2%
associate-*r/56.5%
*-commutative56.5%
distribute-lft-neg-in56.5%
cancel-sign-sub-inv56.5%
associate-*l/54.2%
associate-/l*58.8%
Simplified58.8%
Taylor expanded in x around inf 46.5%
mul-1-neg46.5%
associate-*l/48.8%
distribute-rgt-neg-in48.8%
associate-*l/46.5%
associate-*r/46.5%
Simplified46.5%
if -1.89999999999999995e37 < x < 3.99999999999999966e29Initial program 97.8%
Taylor expanded in x around 0 64.2%
Final simplification55.5%
(FPCore (x y z t) :precision binary64 (if (<= x -6.5e+37) (* t (/ x (- y))) (if (<= x 1.52e+18) t (* x (/ t (- y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.5e+37) {
tmp = t * (x / -y);
} else if (x <= 1.52e+18) {
tmp = t;
} else {
tmp = x * (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 <= (-6.5d+37)) then
tmp = t * (x / -y)
else if (x <= 1.52d+18) then
tmp = t
else
tmp = x * (t / -y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.5e+37) {
tmp = t * (x / -y);
} else if (x <= 1.52e+18) {
tmp = t;
} else {
tmp = x * (t / -y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.5e+37: tmp = t * (x / -y) elif x <= 1.52e+18: tmp = t else: tmp = x * (t / -y) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.5e+37) tmp = Float64(t * Float64(x / Float64(-y))); elseif (x <= 1.52e+18) tmp = t; else tmp = Float64(x * Float64(t / Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6.5e+37) tmp = t * (x / -y); elseif (x <= 1.52e+18) tmp = t; else tmp = x * (t / -y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.5e+37], N[(t * N[(x / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.52e+18], t, N[(x * N[(t / (-y)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+37}:\\
\;\;\;\;t \cdot \frac{x}{-y}\\
\mathbf{elif}\;x \leq 1.52 \cdot 10^{+18}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{-y}\\
\end{array}
\end{array}
if x < -6.4999999999999998e37Initial program 95.1%
*-commutative95.1%
clear-num95.1%
un-div-inv95.0%
Applied egg-rr95.0%
div-inv95.1%
clear-num95.1%
div-inv95.1%
associate-*r*88.5%
Applied egg-rr88.5%
Taylor expanded in z around 0 51.2%
mul-1-neg51.2%
associate-*r/54.7%
*-commutative54.7%
distribute-lft-neg-in54.7%
cancel-sign-sub-inv54.7%
associate-*l/51.2%
associate-/l*54.6%
Simplified54.6%
Taylor expanded in x around inf 42.8%
mul-1-neg42.8%
associate-*l/42.8%
distribute-rgt-neg-in42.8%
associate-*l/42.8%
associate-*r/42.9%
Simplified42.9%
if -6.4999999999999998e37 < x < 1.52e18Initial program 97.8%
Taylor expanded in x around 0 64.2%
if 1.52e18 < x Initial program 92.7%
*-commutative92.7%
clear-num92.6%
un-div-inv92.8%
Applied egg-rr92.8%
div-inv92.6%
clear-num92.7%
div-inv92.7%
associate-*r*83.2%
Applied egg-rr83.2%
Taylor expanded in z around 0 56.8%
mul-1-neg56.8%
associate-*r/58.0%
*-commutative58.0%
distribute-lft-neg-in58.0%
cancel-sign-sub-inv58.0%
associate-*l/56.8%
associate-/l*62.4%
Simplified62.4%
Taylor expanded in x around inf 49.7%
mul-1-neg49.7%
associate-*l/53.9%
distribute-rgt-neg-in53.9%
Simplified53.9%
Final simplification56.7%
(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 95.8%
Final simplification95.8%
(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 95.8%
Taylor expanded in z around 0 66.0%
mul-1-neg66.0%
unsub-neg66.0%
*-rgt-identity66.0%
associate-/l*67.7%
distribute-lft-out--67.7%
Simplified67.7%
Final simplification67.7%
(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 95.8%
Taylor expanded in x around 0 38.8%
Final simplification38.8%
(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 2024130
(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))