
(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 11 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 97.7%
fma-define97.8%
Simplified97.8%
Final simplification97.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ z y))))
(if (<= x -2e+165)
t_1
(if (<= x -9.2e+91)
(* x (/ t (- y)))
(if (<= x -1.35e-55) (/ (* x z) y) (if (<= x 90000.0) t t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z / y);
double tmp;
if (x <= -2e+165) {
tmp = t_1;
} else if (x <= -9.2e+91) {
tmp = x * (t / -y);
} else if (x <= -1.35e-55) {
tmp = (x * z) / y;
} else if (x <= 90000.0) {
tmp = 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 * (z / y)
if (x <= (-2d+165)) then
tmp = t_1
else if (x <= (-9.2d+91)) then
tmp = x * (t / -y)
else if (x <= (-1.35d-55)) then
tmp = (x * z) / y
else if (x <= 90000.0d0) then
tmp = 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 * (z / y);
double tmp;
if (x <= -2e+165) {
tmp = t_1;
} else if (x <= -9.2e+91) {
tmp = x * (t / -y);
} else if (x <= -1.35e-55) {
tmp = (x * z) / y;
} else if (x <= 90000.0) {
tmp = t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z / y) tmp = 0 if x <= -2e+165: tmp = t_1 elif x <= -9.2e+91: tmp = x * (t / -y) elif x <= -1.35e-55: tmp = (x * z) / y elif x <= 90000.0: tmp = t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(z / y)) tmp = 0.0 if (x <= -2e+165) tmp = t_1; elseif (x <= -9.2e+91) tmp = Float64(x * Float64(t / Float64(-y))); elseif (x <= -1.35e-55) tmp = Float64(Float64(x * z) / y); elseif (x <= 90000.0) tmp = t; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (z / y); tmp = 0.0; if (x <= -2e+165) tmp = t_1; elseif (x <= -9.2e+91) tmp = x * (t / -y); elseif (x <= -1.35e-55) tmp = (x * z) / y; elseif (x <= 90000.0) tmp = t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2e+165], t$95$1, If[LessEqual[x, -9.2e+91], N[(x * N[(t / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.35e-55], N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 90000.0], t, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{z}{y}\\
\mathbf{if}\;x \leq -2 \cdot 10^{+165}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{+91}:\\
\;\;\;\;x \cdot \frac{t}{-y}\\
\mathbf{elif}\;x \leq -1.35 \cdot 10^{-55}:\\
\;\;\;\;\frac{x \cdot z}{y}\\
\mathbf{elif}\;x \leq 90000:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.9999999999999998e165 or 9e4 < x Initial program 95.7%
Taylor expanded in x around 0 84.5%
Taylor expanded in x around -inf 78.2%
Taylor expanded in z around inf 56.3%
associate-*r/62.3%
Simplified62.3%
if -1.9999999999999998e165 < x < -9.19999999999999965e91Initial program 93.9%
Taylor expanded in x around 0 88.2%
Taylor expanded in x around -inf 82.2%
Taylor expanded in z around 0 63.4%
mul-1-neg63.4%
associate-*l/63.5%
*-commutative63.5%
distribute-rgt-neg-in63.5%
distribute-frac-neg63.5%
Simplified63.5%
if -9.19999999999999965e91 < x < -1.35000000000000002e-55Initial program 99.7%
Taylor expanded in x around 0 99.7%
Taylor expanded in x around -inf 88.4%
Taylor expanded in z around inf 63.2%
if -1.35000000000000002e-55 < x < 9e4Initial program 99.3%
Taylor expanded in x around 0 63.3%
Final simplification62.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e+41) (not (<= (/ x y) 4000000000000.0))) (* x (/ (- z t) y)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+41) || !((x / y) <= 4000000000000.0)) {
tmp = x * ((z - t) / y);
} else {
tmp = t * (1.0 - (x / 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) <= (-5d+41)) .or. (.not. ((x / y) <= 4000000000000.0d0))) then
tmp = x * ((z - t) / y)
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+41) || !((x / y) <= 4000000000000.0)) {
tmp = x * ((z - t) / y);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e+41) or not ((x / y) <= 4000000000000.0): tmp = x * ((z - t) / y) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e+41) || !(Float64(x / y) <= 4000000000000.0)) tmp = Float64(x * Float64(Float64(z - t) / y)); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -5e+41) || ~(((x / y) <= 4000000000000.0))) tmp = x * ((z - t) / y); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e+41], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4000000000000.0]], $MachinePrecision]], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+41} \lor \neg \left(\frac{x}{y} \leq 4000000000000\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -5.00000000000000022e41 or 4e12 < (/.f64 x y) Initial program 96.3%
Taylor expanded in x around 0 91.4%
Taylor expanded in x around -inf 91.4%
associate-/l*93.5%
*-commutative93.5%
Applied egg-rr93.5%
if -5.00000000000000022e41 < (/.f64 x y) < 4e12Initial program 99.2%
Taylor expanded in z around 0 73.3%
mul-1-neg73.3%
*-rgt-identity73.3%
associate-/l*77.1%
distribute-rgt-neg-in77.1%
mul-1-neg77.1%
distribute-lft-in77.2%
mul-1-neg77.2%
unsub-neg77.2%
Simplified77.2%
Final simplification85.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e-26) (not (<= (/ x y) 4e-12))) (* x (/ (- z t) y)) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e-26) || !((x / y) <= 4e-12)) {
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) <= (-5d-26)) .or. (.not. ((x / y) <= 4d-12))) 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) <= -5e-26) || !((x / y) <= 4e-12)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e-26) or not ((x / y) <= 4e-12): 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) <= -5e-26) || !(Float64(x / y) <= 4e-12)) 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) <= -5e-26) || ~(((x / y) <= 4e-12))) 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], -5e-26], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4e-12]], $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 -5 \cdot 10^{-26} \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{-12}\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.00000000000000019e-26 or 3.99999999999999992e-12 < (/.f64 x y) Initial program 96.5%
Taylor expanded in x around 0 90.6%
Taylor expanded in x around -inf 90.2%
associate-/l*91.3%
*-commutative91.3%
Applied egg-rr91.3%
if -5.00000000000000019e-26 < (/.f64 x y) < 3.99999999999999992e-12Initial program 99.3%
Taylor expanded in z around inf 98.1%
associate-/l*95.5%
Simplified95.5%
Final simplification93.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e-25) (not (<= (/ x y) 4e-12))) (* x (/ (- z t) y)) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e-25) || !((x / y) <= 4e-12)) {
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) <= (-5d-25)) .or. (.not. ((x / y) <= 4d-12))) 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) <= -5e-25) || !((x / y) <= 4e-12)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e-25) or not ((x / y) <= 4e-12): 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) <= -5e-25) || !(Float64(x / y) <= 4e-12)) 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) <= -5e-25) || ~(((x / y) <= 4e-12))) 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], -5e-25], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4e-12]], $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 -5 \cdot 10^{-25} \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{-12}\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if (/.f64 x y) < -4.99999999999999962e-25 or 3.99999999999999992e-12 < (/.f64 x y) Initial program 96.4%
Taylor expanded in x around 0 90.5%
Taylor expanded in x around -inf 90.1%
associate-/l*91.9%
*-commutative91.9%
Applied egg-rr91.9%
if -4.99999999999999962e-25 < (/.f64 x y) < 3.99999999999999992e-12Initial program 99.3%
Taylor expanded in z around inf 98.1%
*-commutative98.1%
associate-/l*99.1%
Applied egg-rr99.1%
Final simplification95.1%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e-25) (/ (* x (- z t)) y) (if (<= (/ x y) 4e-12) (+ t (* (/ x y) z)) (* x (/ (- z t) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e-25) {
tmp = (x * (z - t)) / y;
} else if ((x / y) <= 4e-12) {
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) <= (-5d-25)) then
tmp = (x * (z - t)) / y
else if ((x / y) <= 4d-12) 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) <= -5e-25) {
tmp = (x * (z - t)) / y;
} else if ((x / y) <= 4e-12) {
tmp = t + ((x / y) * z);
} else {
tmp = x * ((z - t) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e-25: tmp = (x * (z - t)) / y elif (x / y) <= 4e-12: 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) <= -5e-25) tmp = Float64(Float64(x * Float64(z - t)) / y); elseif (Float64(x / y) <= 4e-12) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(x * Float64(Float64(z - t) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e-25) tmp = (x * (z - t)) / y; elseif ((x / y) <= 4e-12) 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], -5e-25], N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 4e-12], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-25}:\\
\;\;\;\;\frac{x \cdot \left(z - t\right)}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-12}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -4.99999999999999962e-25Initial program 96.8%
Taylor expanded in x around 0 91.2%
Taylor expanded in x around -inf 90.3%
if -4.99999999999999962e-25 < (/.f64 x y) < 3.99999999999999992e-12Initial program 99.3%
Taylor expanded in z around inf 98.1%
*-commutative98.1%
associate-/l*99.1%
Applied egg-rr99.1%
if 3.99999999999999992e-12 < (/.f64 x y) Initial program 96.1%
Taylor expanded in x around 0 89.9%
Taylor expanded in x around -inf 89.9%
associate-/l*95.8%
*-commutative95.8%
Applied egg-rr95.8%
Final simplification95.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e-26) (* (/ x y) (- t)) (if (<= (/ x y) 4e-12) t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e-26) {
tmp = (x / y) * -t;
} else if ((x / y) <= 4e-12) {
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 / y) <= (-5d-26)) then
tmp = (x / y) * -t
else if ((x / y) <= 4d-12) 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 / y) <= -5e-26) {
tmp = (x / y) * -t;
} else if ((x / y) <= 4e-12) {
tmp = t;
} else {
tmp = x * (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e-26: tmp = (x / y) * -t elif (x / y) <= 4e-12: tmp = t else: tmp = x * (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e-26) tmp = Float64(Float64(x / y) * Float64(-t)); elseif (Float64(x / y) <= 4e-12) 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 / y) <= -5e-26) tmp = (x / y) * -t; elseif ((x / y) <= 4e-12) tmp = t; else tmp = x * (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e-26], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 4e-12], t, N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-26}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-12}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.00000000000000019e-26Initial program 96.9%
Taylor expanded in x around 0 91.4%
Taylor expanded in x around -inf 90.5%
Taylor expanded in z around 0 51.2%
associate-*r/60.9%
associate-*r*60.9%
neg-mul-160.9%
*-commutative60.9%
Simplified60.9%
if -5.00000000000000019e-26 < (/.f64 x y) < 3.99999999999999992e-12Initial program 99.3%
Taylor expanded in x around 0 76.9%
if 3.99999999999999992e-12 < (/.f64 x y) Initial program 96.1%
Taylor expanded in x around 0 89.9%
Taylor expanded in x around -inf 89.9%
Taylor expanded in z around inf 57.2%
associate-*r/62.0%
Simplified62.0%
Final simplification68.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.45e+152) (not (<= z 1.75e-7))) (* x (/ z y)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.45e+152) || !(z <= 1.75e-7)) {
tmp = x * (z / y);
} else {
tmp = t * (1.0 - (x / 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 ((z <= (-1.45d+152)) .or. (.not. (z <= 1.75d-7))) then
tmp = x * (z / y)
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.45e+152) || !(z <= 1.75e-7)) {
tmp = x * (z / y);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.45e+152) or not (z <= 1.75e-7): tmp = x * (z / y) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.45e+152) || !(z <= 1.75e-7)) tmp = Float64(x * Float64(z / y)); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.45e+152) || ~((z <= 1.75e-7))) tmp = x * (z / y); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.45e+152], N[Not[LessEqual[z, 1.75e-7]], $MachinePrecision]], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+152} \lor \neg \left(z \leq 1.75 \cdot 10^{-7}\right):\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -1.4499999999999999e152 or 1.74999999999999992e-7 < z Initial program 99.2%
Taylor expanded in x around 0 91.3%
Taylor expanded in x around -inf 70.6%
Taylor expanded in z around inf 67.5%
associate-*r/70.2%
Simplified70.2%
if -1.4499999999999999e152 < z < 1.74999999999999992e-7Initial program 96.8%
Taylor expanded in z around 0 77.0%
mul-1-neg77.0%
*-rgt-identity77.0%
associate-/l*81.5%
distribute-rgt-neg-in81.5%
mul-1-neg81.5%
distribute-lft-in81.6%
mul-1-neg81.6%
unsub-neg81.6%
Simplified81.6%
Final simplification77.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.85e-56) (not (<= x 52000.0))) (* x (/ z y)) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.85e-56) || !(x <= 52000.0)) {
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 <= (-1.85d-56)) .or. (.not. (x <= 52000.0d0))) 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 <= -1.85e-56) || !(x <= 52000.0)) {
tmp = x * (z / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.85e-56) or not (x <= 52000.0): tmp = x * (z / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.85e-56) || !(x <= 52000.0)) 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 <= -1.85e-56) || ~((x <= 52000.0))) tmp = x * (z / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.85e-56], N[Not[LessEqual[x, 52000.0]], $MachinePrecision]], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{-56} \lor \neg \left(x \leq 52000\right):\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if x < -1.8500000000000001e-56 or 52000 < x Initial program 96.3%
Taylor expanded in x around 0 88.0%
Taylor expanded in x around -inf 80.7%
Taylor expanded in z around inf 53.4%
associate-*r/57.5%
Simplified57.5%
if -1.8500000000000001e-56 < x < 52000Initial program 99.3%
Taylor expanded in x around 0 63.3%
Final simplification60.2%
(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 97.7%
Final simplification97.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 97.7%
Taylor expanded in x around 0 36.1%
Final simplification36.1%
(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 2024039
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:herbie-target
(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))