
(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 (+ 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.9%
Final simplification97.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ (- z t) y))))
(if (<= (/ x y) -1e+60)
t_1
(if (<= (/ x y) -2000000000000.0)
(* t (- 1.0 (/ x y)))
(if (<= (/ x y) 1e-5) (+ t (* (/ x y) z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((z - t) / y);
double tmp;
if ((x / y) <= -1e+60) {
tmp = t_1;
} else if ((x / y) <= -2000000000000.0) {
tmp = t * (1.0 - (x / y));
} else if ((x / y) <= 1e-5) {
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 = x * ((z - t) / y)
if ((x / y) <= (-1d+60)) then
tmp = t_1
else if ((x / y) <= (-2000000000000.0d0)) then
tmp = t * (1.0d0 - (x / y))
else if ((x / y) <= 1d-5) 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 = x * ((z - t) / y);
double tmp;
if ((x / y) <= -1e+60) {
tmp = t_1;
} else if ((x / y) <= -2000000000000.0) {
tmp = t * (1.0 - (x / y));
} else if ((x / y) <= 1e-5) {
tmp = t + ((x / y) * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((z - t) / y) tmp = 0 if (x / y) <= -1e+60: tmp = t_1 elif (x / y) <= -2000000000000.0: tmp = t * (1.0 - (x / y)) elif (x / y) <= 1e-5: tmp = t + ((x / y) * z) 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) <= -1e+60) tmp = t_1; elseif (Float64(x / y) <= -2000000000000.0) tmp = Float64(t * Float64(1.0 - Float64(x / y))); elseif (Float64(x / y) <= 1e-5) 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 = x * ((z - t) / y); tmp = 0.0; if ((x / y) <= -1e+60) tmp = t_1; elseif ((x / y) <= -2000000000000.0) tmp = t * (1.0 - (x / y)); elseif ((x / y) <= 1e-5) tmp = t + ((x / y) * z); 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], -1e+60], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -2000000000000.0], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e-5], N[(t + N[(N[(x / y), $MachinePrecision] * z), $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 -1 \cdot 10^{+60}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq -2000000000000:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-5}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -9.9999999999999995e59 or 1.00000000000000008e-5 < (/.f64 x y) Initial program 96.5%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6495.6%
Simplified95.6%
Taylor expanded in x around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6494.9%
Simplified94.9%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6493.3%
Applied egg-rr93.3%
if -9.9999999999999995e59 < (/.f64 x y) < -2e12Initial program 99.8%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6481.6%
Simplified81.6%
Taylor expanded in t around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6485.2%
Simplified85.2%
if -2e12 < (/.f64 x y) < 1.00000000000000008e-5Initial program 98.8%
Taylor expanded in z around inf
Simplified98.2%
Final simplification95.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x (- z t)) y)))
(if (<= (/ x y) -2000000000000.0)
t_1
(if (<= (/ x y) 1e-5) (+ t (* (/ x y) z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x * (z - t)) / y;
double tmp;
if ((x / y) <= -2000000000000.0) {
tmp = t_1;
} else if ((x / y) <= 1e-5) {
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 = (x * (z - t)) / y
if ((x / y) <= (-2000000000000.0d0)) then
tmp = t_1
else if ((x / y) <= 1d-5) 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 = (x * (z - t)) / y;
double tmp;
if ((x / y) <= -2000000000000.0) {
tmp = t_1;
} else if ((x / y) <= 1e-5) {
tmp = t + ((x / y) * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * (z - t)) / y tmp = 0 if (x / y) <= -2000000000000.0: tmp = t_1 elif (x / y) <= 1e-5: tmp = t + ((x / y) * z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * Float64(z - t)) / y) tmp = 0.0 if (Float64(x / y) <= -2000000000000.0) tmp = t_1; elseif (Float64(x / y) <= 1e-5) 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 = (x * (z - t)) / y; tmp = 0.0; if ((x / y) <= -2000000000000.0) tmp = t_1; elseif ((x / y) <= 1e-5) tmp = t + ((x / y) * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -2000000000000.0], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 1e-5], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(z - t\right)}{y}\\
\mathbf{if}\;\frac{x}{y} \leq -2000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-5}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -2e12 or 1.00000000000000008e-5 < (/.f64 x y) Initial program 96.8%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6494.4%
Simplified94.4%
Taylor expanded in x around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.7%
Simplified93.7%
if -2e12 < (/.f64 x y) < 1.00000000000000008e-5Initial program 98.8%
Taylor expanded in z around inf
Simplified98.2%
Final simplification96.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ (- z t) y))))
(if (<= (/ x y) -1e-40)
t_1
(if (<= (/ x y) 4e-84) (* t (- 1.0 (/ 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) <= -1e-40) {
tmp = t_1;
} else if ((x / y) <= 4e-84) {
tmp = t * (1.0 - (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) <= (-1d-40)) then
tmp = t_1
else if ((x / y) <= 4d-84) then
tmp = t * (1.0d0 - (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) <= -1e-40) {
tmp = t_1;
} else if ((x / y) <= 4e-84) {
tmp = t * (1.0 - (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) <= -1e-40: tmp = t_1 elif (x / y) <= 4e-84: tmp = t * (1.0 - (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) <= -1e-40) tmp = t_1; elseif (Float64(x / y) <= 4e-84) tmp = Float64(t * Float64(1.0 - 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) <= -1e-40) tmp = t_1; elseif ((x / y) <= 4e-84) tmp = t * (1.0 - (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], -1e-40], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 4e-84], N[(t * N[(1.0 - 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 -1 \cdot 10^{-40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-84}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -9.9999999999999993e-41 or 4.0000000000000001e-84 < (/.f64 x y) Initial program 97.3%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6490.4%
Simplified90.4%
Taylor expanded in x around inf
div-subN/A
associate-/l*N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6486.3%
Simplified86.3%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6484.4%
Applied egg-rr84.4%
if -9.9999999999999993e-41 < (/.f64 x y) < 4.0000000000000001e-84Initial program 98.7%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6496.4%
Simplified96.4%
Taylor expanded in t around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6480.1%
Simplified80.1%
Final simplification82.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ z (/ y x)))) (if (<= (/ x y) -1e-40) t_1 (if (<= (/ x y) 4e-84) t t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z / (y / x);
double tmp;
if ((x / y) <= -1e-40) {
tmp = t_1;
} else if ((x / y) <= 4e-84) {
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 / (y / x)
if ((x / y) <= (-1d-40)) then
tmp = t_1
else if ((x / y) <= 4d-84) 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 / (y / x);
double tmp;
if ((x / y) <= -1e-40) {
tmp = t_1;
} else if ((x / y) <= 4e-84) {
tmp = t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z / (y / x) tmp = 0 if (x / y) <= -1e-40: tmp = t_1 elif (x / y) <= 4e-84: tmp = t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z / Float64(y / x)) tmp = 0.0 if (Float64(x / y) <= -1e-40) tmp = t_1; elseif (Float64(x / y) <= 4e-84) tmp = t; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z / (y / x); tmp = 0.0; if ((x / y) <= -1e-40) tmp = t_1; elseif ((x / y) <= 4e-84) tmp = t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -1e-40], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 4e-84], t, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{\frac{y}{x}}\\
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{-40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-84}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -9.9999999999999993e-41 or 4.0000000000000001e-84 < (/.f64 x y) Initial program 97.3%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6490.4%
Simplified90.4%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f6451.9%
Simplified51.9%
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
/-lowering-/.f64N/A
/-lowering-/.f6457.2%
Applied egg-rr57.2%
if -9.9999999999999993e-41 < (/.f64 x y) < 4.0000000000000001e-84Initial program 98.7%
+-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
Simplified80.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ x y) z))) (if (<= (/ x y) -1e-40) t_1 (if (<= (/ x y) 4e-84) t t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) * z;
double tmp;
if ((x / y) <= -1e-40) {
tmp = t_1;
} else if ((x / y) <= 4e-84) {
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 / y) * z
if ((x / y) <= (-1d-40)) then
tmp = t_1
else if ((x / y) <= 4d-84) 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 / y) * z;
double tmp;
if ((x / y) <= -1e-40) {
tmp = t_1;
} else if ((x / y) <= 4e-84) {
tmp = t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) * z tmp = 0 if (x / y) <= -1e-40: tmp = t_1 elif (x / y) <= 4e-84: tmp = t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) * z) tmp = 0.0 if (Float64(x / y) <= -1e-40) tmp = t_1; elseif (Float64(x / y) <= 4e-84) tmp = t; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) * z; tmp = 0.0; if ((x / y) <= -1e-40) tmp = t_1; elseif ((x / y) <= 4e-84) tmp = t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -1e-40], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 4e-84], t, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot z\\
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{-40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-84}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -9.9999999999999993e-41 or 4.0000000000000001e-84 < (/.f64 x y) Initial program 97.3%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6490.4%
Simplified90.4%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f6451.9%
Simplified51.9%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6457.1%
Applied egg-rr57.1%
if -9.9999999999999993e-41 < (/.f64 x y) < 4.0000000000000001e-84Initial program 98.7%
+-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
Simplified80.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* t (- 1.0 (/ x y))))) (if (<= t -1.8e-126) t_1 (if (<= t 25.5) (* (/ 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 <= -1.8e-126) {
tmp = t_1;
} else if (t <= 25.5) {
tmp = (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 <= (-1.8d-126)) then
tmp = t_1
else if (t <= 25.5d0) then
tmp = (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 <= -1.8e-126) {
tmp = t_1;
} else if (t <= 25.5) {
tmp = (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 <= -1.8e-126: tmp = t_1 elif t <= 25.5: tmp = (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 <= -1.8e-126) tmp = t_1; elseif (t <= 25.5) tmp = 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 <= -1.8e-126) tmp = t_1; elseif (t <= 25.5) tmp = (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, -1.8e-126], t$95$1, If[LessEqual[t, 25.5], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;t \leq -1.8 \cdot 10^{-126}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 25.5:\\
\;\;\;\;\frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.8e-126 or 25.5 < t Initial program 99.5%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.1%
Simplified93.1%
Taylor expanded in t around inf
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6486.8%
Simplified86.8%
if -1.8e-126 < t < 25.5Initial program 95.1%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6492.8%
Simplified92.8%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f6468.0%
Simplified68.0%
associate-*l/N/A
*-lowering-*.f64N/A
/-lowering-/.f6473.2%
Applied egg-rr73.2%
(FPCore (x y z t) :precision binary64 (if (<= y -4e+125) (+ t (* (/ x y) z)) (+ t (/ (* x (- z t)) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4e+125) {
tmp = t + ((x / y) * z);
} else {
tmp = t + ((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 (y <= (-4d+125)) then
tmp = t + ((x / y) * z)
else
tmp = t + ((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 (y <= -4e+125) {
tmp = t + ((x / y) * z);
} else {
tmp = t + ((x * (z - t)) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -4e+125: tmp = t + ((x / y) * z) else: tmp = t + ((x * (z - t)) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -4e+125) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(t + Float64(Float64(x * Float64(z - t)) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -4e+125) tmp = t + ((x / y) * z); else tmp = t + ((x * (z - t)) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -4e+125], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+125}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x \cdot \left(z - t\right)}{y}\\
\end{array}
\end{array}
if y < -3.9999999999999997e125Initial program 99.9%
Taylor expanded in z around inf
Simplified94.7%
if -3.9999999999999997e125 < y Initial program 97.5%
+-commutativeN/A
+-lowering-+.f64N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f6495.3%
Simplified95.3%
Final simplification95.2%
(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.9%
+-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 0
Simplified38.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 2024161
(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))