
(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 (+ t (/ (- z t) (/ y x))))
double code(double x, double y, double z, double t) {
return t + ((z - t) / (y / x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t + ((z - t) / (y / x))
end function
public static double code(double x, double y, double z, double t) {
return t + ((z - t) / (y / x));
}
def code(x, y, z, t): return t + ((z - t) / (y / x))
function code(x, y, z, t) return Float64(t + Float64(Float64(z - t) / Float64(y / x))) end
function tmp = code(x, y, z, t) tmp = t + ((z - t) / (y / x)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(z - t), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \frac{z - t}{\frac{y}{x}}
\end{array}
Initial program 97.7%
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f6497.9%
Applied egg-rr97.9%
Final simplification97.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -100.0) (/ (* (- z t) x) y) (if (<= (/ x y) 5e-13) (+ t (* z (/ x y))) (/ (- z t) (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -100.0) {
tmp = ((z - t) * x) / y;
} else if ((x / y) <= 5e-13) {
tmp = t + (z * (x / y));
} else {
tmp = (z - t) / (y / x);
}
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) <= (-100.0d0)) then
tmp = ((z - t) * x) / y
else if ((x / y) <= 5d-13) then
tmp = t + (z * (x / y))
else
tmp = (z - t) / (y / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -100.0) {
tmp = ((z - t) * x) / y;
} else if ((x / y) <= 5e-13) {
tmp = t + (z * (x / y));
} else {
tmp = (z - t) / (y / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -100.0: tmp = ((z - t) * x) / y elif (x / y) <= 5e-13: tmp = t + (z * (x / y)) else: tmp = (z - t) / (y / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -100.0) tmp = Float64(Float64(Float64(z - t) * x) / y); elseif (Float64(x / y) <= 5e-13) tmp = Float64(t + Float64(z * Float64(x / y))); else tmp = Float64(Float64(z - t) / Float64(y / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -100.0) tmp = ((z - t) * x) / y; elseif ((x / y) <= 5e-13) tmp = t + (z * (x / y)); else tmp = (z - t) / (y / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -100.0], N[(N[(N[(z - t), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 5e-13], N[(t + N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - t), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -100:\\
\;\;\;\;\frac{\left(z - t\right) \cdot x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-13}:\\
\;\;\;\;t + z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{z - t}{\frac{y}{x}}\\
\end{array}
\end{array}
if (/.f64 x y) < -100Initial program 94.5%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6495.8%
Simplified95.8%
Taylor expanded in x around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6494.7%
Simplified94.7%
if -100 < (/.f64 x y) < 4.9999999999999999e-13Initial program 98.4%
Taylor expanded in z around inf
Simplified97.0%
if 4.9999999999999999e-13 < (/.f64 x y) Initial program 99.8%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.0%
Simplified93.0%
Taylor expanded in x around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.0%
Simplified93.0%
clear-numN/A
associate-/r*N/A
clear-numN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
/-lowering-/.f6499.7%
Applied egg-rr99.7%
Final simplification97.1%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -100.0) (/ (* (- z t) x) y) (if (<= (/ x y) 2e-10) (+ t (* z (/ x y))) (/ x (/ y (- z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -100.0) {
tmp = ((z - t) * x) / y;
} else if ((x / y) <= 2e-10) {
tmp = t + (z * (x / y));
} else {
tmp = 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 / y) <= (-100.0d0)) then
tmp = ((z - t) * x) / y
else if ((x / y) <= 2d-10) then
tmp = t + (z * (x / y))
else
tmp = 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 / y) <= -100.0) {
tmp = ((z - t) * x) / y;
} else if ((x / y) <= 2e-10) {
tmp = t + (z * (x / y));
} else {
tmp = x / (y / (z - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -100.0: tmp = ((z - t) * x) / y elif (x / y) <= 2e-10: tmp = t + (z * (x / y)) else: tmp = x / (y / (z - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -100.0) tmp = Float64(Float64(Float64(z - t) * x) / y); elseif (Float64(x / y) <= 2e-10) tmp = Float64(t + Float64(z * Float64(x / y))); else tmp = Float64(x / Float64(y / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -100.0) tmp = ((z - t) * x) / y; elseif ((x / y) <= 2e-10) tmp = t + (z * (x / y)); else tmp = x / (y / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -100.0], N[(N[(N[(z - t), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e-10], N[(t + N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -100:\\
\;\;\;\;\frac{\left(z - t\right) \cdot x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-10}:\\
\;\;\;\;t + z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{y}{z - t}}\\
\end{array}
\end{array}
if (/.f64 x y) < -100Initial program 94.5%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6495.8%
Simplified95.8%
Taylor expanded in x around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6494.7%
Simplified94.7%
if -100 < (/.f64 x y) < 2.00000000000000007e-10Initial program 98.4%
Taylor expanded in z around inf
Simplified97.0%
if 2.00000000000000007e-10 < (/.f64 x y) Initial program 99.8%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6492.9%
Simplified92.9%
Taylor expanded in x around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6492.9%
Simplified92.9%
associate-*l/N/A
associate-/r/N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f6493.3%
Applied egg-rr93.3%
Final simplification95.4%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e+23) (* x (/ (- z t) y)) (if (<= (/ x y) 2e-10) (+ t (* z (/ x y))) (/ x (/ y (- z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+23) {
tmp = x * ((z - t) / y);
} else if ((x / y) <= 2e-10) {
tmp = t + (z * (x / y));
} else {
tmp = 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 / y) <= (-5d+23)) then
tmp = x * ((z - t) / y)
else if ((x / y) <= 2d-10) then
tmp = t + (z * (x / y))
else
tmp = 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 / y) <= -5e+23) {
tmp = x * ((z - t) / y);
} else if ((x / y) <= 2e-10) {
tmp = t + (z * (x / y));
} else {
tmp = x / (y / (z - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+23: tmp = x * ((z - t) / y) elif (x / y) <= 2e-10: tmp = t + (z * (x / y)) else: tmp = x / (y / (z - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+23) tmp = Float64(x * Float64(Float64(z - t) / y)); elseif (Float64(x / y) <= 2e-10) tmp = Float64(t + Float64(z * Float64(x / y))); else tmp = Float64(x / Float64(y / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e+23) tmp = x * ((z - t) / y); elseif ((x / y) <= 2e-10) tmp = t + (z * (x / y)); else tmp = x / (y / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+23], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e-10], N[(t + N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+23}:\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-10}:\\
\;\;\;\;t + z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{y}{z - t}}\\
\end{array}
\end{array}
if (/.f64 x y) < -4.9999999999999999e23Initial program 94.0%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.4%
Simplified98.4%
Taylor expanded in x around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.4%
Simplified98.4%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6495.6%
Applied egg-rr95.6%
if -4.9999999999999999e23 < (/.f64 x y) < 2.00000000000000007e-10Initial program 98.4%
Taylor expanded in z around inf
Simplified95.1%
if 2.00000000000000007e-10 < (/.f64 x y) Initial program 99.8%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6492.9%
Simplified92.9%
Taylor expanded in x around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6492.9%
Simplified92.9%
associate-*l/N/A
associate-/r/N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f6493.3%
Applied egg-rr93.3%
Final simplification94.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ (- z t) y))))
(if (<= (/ x y) -5e+23)
t_1
(if (<= (/ x y) 2e-10) (+ t (* z (/ x y))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((z - t) / y);
double tmp;
if ((x / y) <= -5e+23) {
tmp = t_1;
} else if ((x / y) <= 2e-10) {
tmp = t + (z * (x / 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 = x * ((z - t) / y)
if ((x / y) <= (-5d+23)) then
tmp = t_1
else if ((x / y) <= 2d-10) then
tmp = t + (z * (x / 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 = x * ((z - t) / y);
double tmp;
if ((x / y) <= -5e+23) {
tmp = t_1;
} else if ((x / y) <= 2e-10) {
tmp = t + (z * (x / y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((z - t) / y) tmp = 0 if (x / y) <= -5e+23: tmp = t_1 elif (x / y) <= 2e-10: tmp = t + (z * (x / y)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(z - t) / y)) tmp = 0.0 if (Float64(x / y) <= -5e+23) tmp = t_1; elseif (Float64(x / y) <= 2e-10) tmp = Float64(t + Float64(z * Float64(x / y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((z - t) / y); tmp = 0.0; if ((x / y) <= -5e+23) tmp = t_1; elseif ((x / y) <= 2e-10) tmp = t + (z * (x / y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -5e+23], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 2e-10], N[(t + N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{z - t}{y}\\
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-10}:\\
\;\;\;\;t + z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -4.9999999999999999e23 or 2.00000000000000007e-10 < (/.f64 x y) Initial program 97.0%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6495.5%
Simplified95.5%
Taylor expanded in x around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6495.5%
Simplified95.5%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6494.1%
Applied egg-rr94.1%
if -4.9999999999999999e23 < (/.f64 x y) < 2.00000000000000007e-10Initial program 98.4%
Taylor expanded in z around inf
Simplified95.1%
Final simplification94.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ (- z t) y)))) (if (<= (/ x y) -5e-48) t_1 (if (<= (/ x y) 2e-30) t t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((z - t) / y);
double tmp;
if ((x / y) <= -5e-48) {
tmp = t_1;
} else if ((x / y) <= 2e-30) {
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 - t) / y)
if ((x / y) <= (-5d-48)) then
tmp = t_1
else if ((x / y) <= 2d-30) 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 - t) / y);
double tmp;
if ((x / y) <= -5e-48) {
tmp = t_1;
} else if ((x / y) <= 2e-30) {
tmp = t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((z - t) / y) tmp = 0 if (x / y) <= -5e-48: tmp = t_1 elif (x / y) <= 2e-30: tmp = t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(z - t) / y)) tmp = 0.0 if (Float64(x / y) <= -5e-48) tmp = t_1; elseif (Float64(x / y) <= 2e-30) tmp = t; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((z - t) / y); tmp = 0.0; if ((x / y) <= -5e-48) tmp = t_1; elseif ((x / y) <= 2e-30) tmp = t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -5e-48], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 2e-30], t, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{z - t}{y}\\
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-30}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -4.9999999999999999e-48 or 2e-30 < (/.f64 x y) Initial program 97.3%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.5%
Simplified93.5%
Taylor expanded in x around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6491.8%
Simplified91.8%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6489.8%
Applied egg-rr89.8%
if -4.9999999999999999e-48 < (/.f64 x y) < 2e-30Initial program 98.2%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6496.4%
Simplified96.4%
Taylor expanded in x around 0
Simplified79.0%
Final simplification85.1%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e-48) (/ z (/ y x)) (if (<= (/ x y) 5e-79) t (* z (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e-48) {
tmp = z / (y / x);
} else if ((x / y) <= 5e-79) {
tmp = t;
} else {
tmp = z * (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-48)) then
tmp = z / (y / x)
else if ((x / y) <= 5d-79) then
tmp = t
else
tmp = z * (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-48) {
tmp = z / (y / x);
} else if ((x / y) <= 5e-79) {
tmp = t;
} else {
tmp = z * (x / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e-48: tmp = z / (y / x) elif (x / y) <= 5e-79: tmp = t else: tmp = z * (x / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e-48) tmp = Float64(z / Float64(y / x)); elseif (Float64(x / y) <= 5e-79) tmp = t; else tmp = Float64(z * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e-48) tmp = z / (y / x); elseif ((x / y) <= 5e-79) tmp = t; else tmp = z * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e-48], N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 5e-79], t, N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-48}:\\
\;\;\;\;\frac{z}{\frac{y}{x}}\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-79}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -4.9999999999999999e-48Initial program 95.0%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6495.0%
Simplified95.0%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f6450.8%
Simplified50.8%
clear-numN/A
associate-/r*N/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f6453.0%
Applied egg-rr53.0%
if -4.9999999999999999e-48 < (/.f64 x y) < 4.99999999999999999e-79Initial program 98.1%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6496.0%
Simplified96.0%
Taylor expanded in x around 0
Simplified82.5%
if 4.99999999999999999e-79 < (/.f64 x y) Initial program 99.8%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6492.9%
Simplified92.9%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f6449.9%
Simplified49.9%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6455.8%
Applied egg-rr55.8%
Final simplification65.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (/ x y)))) (if (<= (/ x y) -5e-48) t_1 (if (<= (/ x y) 5e-79) t t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x / y);
double tmp;
if ((x / y) <= -5e-48) {
tmp = t_1;
} else if ((x / y) <= 5e-79) {
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 = z * (x / y)
if ((x / y) <= (-5d-48)) then
tmp = t_1
else if ((x / y) <= 5d-79) 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 = z * (x / y);
double tmp;
if ((x / y) <= -5e-48) {
tmp = t_1;
} else if ((x / y) <= 5e-79) {
tmp = t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x / y) tmp = 0 if (x / y) <= -5e-48: tmp = t_1 elif (x / y) <= 5e-79: tmp = t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x / y)) tmp = 0.0 if (Float64(x / y) <= -5e-48) tmp = t_1; elseif (Float64(x / y) <= 5e-79) tmp = t; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x / y); tmp = 0.0; if ((x / y) <= -5e-48) tmp = t_1; elseif ((x / y) <= 5e-79) tmp = t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -5e-48], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 5e-79], t, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{x}{y}\\
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-79}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -4.9999999999999999e-48 or 4.99999999999999999e-79 < (/.f64 x y) Initial program 97.5%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.9%
Simplified93.9%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f6450.3%
Simplified50.3%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6453.9%
Applied egg-rr53.9%
if -4.9999999999999999e-48 < (/.f64 x y) < 4.99999999999999999e-79Initial program 98.1%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6496.0%
Simplified96.0%
Taylor expanded in x around 0
Simplified82.5%
Final simplification65.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* t (- 1.0 (/ x y))))) (if (<= t -5.6e-166) t_1 (if (<= t 2.6e-109) (/ (* z x) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = t * (1.0 - (x / y));
double tmp;
if (t <= -5.6e-166) {
tmp = t_1;
} else if (t <= 2.6e-109) {
tmp = (z * x) / 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 * (1.0d0 - (x / y))
if (t <= (-5.6d-166)) then
tmp = t_1
else if (t <= 2.6d-109) then
tmp = (z * x) / 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 * (1.0 - (x / y));
double tmp;
if (t <= -5.6e-166) {
tmp = t_1;
} else if (t <= 2.6e-109) {
tmp = (z * x) / y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (1.0 - (x / y)) tmp = 0 if t <= -5.6e-166: tmp = t_1 elif t <= 2.6e-109: tmp = (z * x) / y 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 <= -5.6e-166) tmp = t_1; elseif (t <= 2.6e-109) tmp = Float64(Float64(z * x) / y); 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 <= -5.6e-166) tmp = t_1; elseif (t <= 2.6e-109) tmp = (z * x) / y; 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, -5.6e-166], t$95$1, If[LessEqual[t, 2.6e-109], N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;t \leq -5.6 \cdot 10^{-166}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{-109}:\\
\;\;\;\;\frac{z \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.5999999999999999e-166 or 2.5999999999999998e-109 < t Initial program 99.9%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.3%
Simplified93.3%
Taylor expanded in t around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6481.5%
Simplified81.5%
if -5.5999999999999999e-166 < t < 2.5999999999999998e-109Initial program 92.0%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.3%
Simplified98.3%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f6478.7%
Simplified78.7%
Final simplification80.7%
(FPCore (x y z t) :precision binary64 (if (<= t 1.2e+119) (+ t (/ (* (- z t) x) y)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.2e+119) {
tmp = t + (((z - t) * x) / 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 (t <= 1.2d+119) then
tmp = t + (((z - t) * x) / 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 (t <= 1.2e+119) {
tmp = t + (((z - t) * x) / y);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.2e+119: tmp = t + (((z - t) * x) / y) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.2e+119) tmp = Float64(t + Float64(Float64(Float64(z - t) * x) / 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 (t <= 1.2e+119) tmp = t + (((z - t) * x) / y); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.2e+119], N[(t + N[(N[(N[(z - t), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.2 \cdot 10^{+119}:\\
\;\;\;\;t + \frac{\left(z - t\right) \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if t < 1.2e119Initial program 97.3%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6496.4%
Simplified96.4%
if 1.2e119 < t Initial program 100.0%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6484.1%
Simplified84.1%
Taylor expanded in t around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64100.0%
Simplified100.0%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 (+ t (* (- z t) (/ x y))))
double code(double x, double y, double z, double t) {
return t + ((z - t) * (x / y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t + ((z - t) * (x / y))
end function
public static double code(double x, double y, double z, double t) {
return t + ((z - t) * (x / y));
}
def code(x, y, z, t): return t + ((z - t) * (x / y))
function code(x, y, z, t) return Float64(t + Float64(Float64(z - t) * Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = t + ((z - t) * (x / y)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(z - t), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \left(z - t\right) \cdot \frac{x}{y}
\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%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6494.7%
Simplified94.7%
Taylor expanded in x around 0
Simplified36.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 2024155
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:alt
(! :herbie-platform default (if (< z 689864138640673/250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* (/ x y) (- z t)) t) (if (< z 581748612718609/25000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t))))
(+ (* (/ x y) (- z t)) t))