
(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 98.0%
Taylor expanded in x around 0 94.0%
associate-*r/94.3%
*-commutative94.3%
associate-/r/98.2%
Simplified98.2%
Final simplification98.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ x (- y)))))
(if (<= (/ x y) -5000000000000.0)
t_1
(if (<= (/ x y) 4e-68)
t
(if (or (<= (/ x y) 5000000.0) (not (<= (/ x y) 5e+194)))
(/ (* z x) y)
t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / -y);
double tmp;
if ((x / y) <= -5000000000000.0) {
tmp = t_1;
} else if ((x / y) <= 4e-68) {
tmp = t;
} else if (((x / y) <= 5000000.0) || !((x / y) <= 5e+194)) {
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 * (x / -y)
if ((x / y) <= (-5000000000000.0d0)) then
tmp = t_1
else if ((x / y) <= 4d-68) then
tmp = t
else if (((x / y) <= 5000000.0d0) .or. (.not. ((x / y) <= 5d+194))) 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 * (x / -y);
double tmp;
if ((x / y) <= -5000000000000.0) {
tmp = t_1;
} else if ((x / y) <= 4e-68) {
tmp = t;
} else if (((x / y) <= 5000000.0) || !((x / y) <= 5e+194)) {
tmp = (z * x) / y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (x / -y) tmp = 0 if (x / y) <= -5000000000000.0: tmp = t_1 elif (x / y) <= 4e-68: tmp = t elif ((x / y) <= 5000000.0) or not ((x / y) <= 5e+194): tmp = (z * x) / y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(x / Float64(-y))) tmp = 0.0 if (Float64(x / y) <= -5000000000000.0) tmp = t_1; elseif (Float64(x / y) <= 4e-68) tmp = t; elseif ((Float64(x / y) <= 5000000.0) || !(Float64(x / y) <= 5e+194)) 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 * (x / -y); tmp = 0.0; if ((x / y) <= -5000000000000.0) tmp = t_1; elseif ((x / y) <= 4e-68) tmp = t; elseif (((x / y) <= 5000000.0) || ~(((x / y) <= 5e+194))) 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[(x / (-y)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -5000000000000.0], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 4e-68], t, If[Or[LessEqual[N[(x / y), $MachinePrecision], 5000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e+194]], $MachinePrecision]], N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{-y}\\
\mathbf{if}\;\frac{x}{y} \leq -5000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-68}:\\
\;\;\;\;t\\
\mathbf{elif}\;\frac{x}{y} \leq 5000000 \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{+194}\right):\\
\;\;\;\;\frac{z \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 x y) < -5e12 or 5e6 < (/.f64 x y) < 4.99999999999999989e194Initial program 99.8%
Taylor expanded in z around 0 58.1%
*-rgt-identity58.1%
mul-1-neg58.1%
associate-/l*65.5%
distribute-rgt-neg-in65.5%
mul-1-neg65.5%
distribute-lft-in65.5%
mul-1-neg65.5%
unsub-neg65.5%
Simplified65.5%
Taylor expanded in x around inf 65.1%
mul-1-neg65.1%
distribute-frac-neg65.1%
Simplified65.1%
if -5e12 < (/.f64 x y) < 4.00000000000000027e-68Initial program 97.5%
Taylor expanded in x around 0 76.1%
if 4.00000000000000027e-68 < (/.f64 x y) < 5e6 or 4.99999999999999989e194 < (/.f64 x y) Initial program 96.1%
Taylor expanded in z around inf 66.8%
associate-/l*70.3%
Simplified70.3%
Taylor expanded in y around 0 64.8%
Taylor expanded in t around 0 60.6%
Final simplification69.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1e-42) (not (<= (/ x y) 4e-68))) (/ (* z x) y) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e-42) || !((x / y) <= 4e-68)) {
tmp = (z * 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 / y) <= (-1d-42)) .or. (.not. ((x / y) <= 4d-68))) then
tmp = (z * 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 / y) <= -1e-42) || !((x / y) <= 4e-68)) {
tmp = (z * x) / y;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1e-42) or not ((x / y) <= 4e-68): tmp = (z * x) / y else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1e-42) || !(Float64(x / y) <= 4e-68)) tmp = Float64(Float64(z * x) / y); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -1e-42) || ~(((x / y) <= 4e-68))) tmp = (z * x) / y; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1e-42], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4e-68]], $MachinePrecision]], N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{-42} \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{-68}\right):\\
\;\;\;\;\frac{z \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -1.00000000000000004e-42 or 4.00000000000000027e-68 < (/.f64 x y) Initial program 98.5%
Taylor expanded in z around inf 55.1%
associate-/l*53.1%
Simplified53.1%
Taylor expanded in y around 0 56.3%
Taylor expanded in t around 0 50.7%
if -1.00000000000000004e-42 < (/.f64 x y) < 4.00000000000000027e-68Initial program 97.3%
Taylor expanded in x around 0 79.9%
Final simplification63.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -3.6e+290) (not (<= (/ x y) 2.6e+194))) (* t (/ x y)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -3.6e+290) || !((x / y) <= 2.6e+194)) {
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 / y) <= (-3.6d+290)) .or. (.not. ((x / y) <= 2.6d+194))) 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 / y) <= -3.6e+290) || !((x / y) <= 2.6e+194)) {
tmp = t * (x / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -3.6e+290) or not ((x / y) <= 2.6e+194): tmp = t * (x / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -3.6e+290) || !(Float64(x / y) <= 2.6e+194)) tmp = Float64(t * Float64(x / y)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -3.6e+290) || ~(((x / y) <= 2.6e+194))) tmp = t * (x / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -3.6e+290], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2.6e+194]], $MachinePrecision]], N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -3.6 \cdot 10^{+290} \lor \neg \left(\frac{x}{y} \leq 2.6 \cdot 10^{+194}\right):\\
\;\;\;\;t \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -3.59999999999999988e290 or 2.5999999999999999e194 < (/.f64 x y) Initial program 96.0%
Taylor expanded in z around 0 50.2%
*-rgt-identity50.2%
mul-1-neg50.2%
associate-/l*56.2%
distribute-rgt-neg-in56.2%
mul-1-neg56.2%
distribute-lft-in56.2%
mul-1-neg56.2%
unsub-neg56.2%
Simplified56.2%
Taylor expanded in x around inf 56.2%
mul-1-neg56.2%
distribute-frac-neg56.2%
Simplified56.2%
div-inv56.2%
add-sqr-sqrt24.0%
sqrt-unprod32.8%
sqr-neg32.8%
sqrt-unprod8.8%
add-sqr-sqrt23.8%
Applied egg-rr23.8%
associate-*r/23.8%
*-rgt-identity23.8%
Simplified23.8%
if -3.59999999999999988e290 < (/.f64 x y) < 2.5999999999999999e194Initial program 98.4%
Taylor expanded in x around 0 46.6%
Final simplification42.4%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e+41) (* y (/ t y)) (if (<= (/ x y) 5e+194) t (* t (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+41) {
tmp = y * (t / y);
} else if ((x / y) <= 5e+194) {
tmp = t;
} else {
tmp = t * (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)) then
tmp = y * (t / y)
else if ((x / y) <= 5d+194) then
tmp = t
else
tmp = t * (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) {
tmp = y * (t / y);
} else if ((x / y) <= 5e+194) {
tmp = t;
} else {
tmp = t * (x / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+41: tmp = y * (t / y) elif (x / y) <= 5e+194: tmp = t else: tmp = t * (x / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+41) tmp = Float64(y * Float64(t / y)); elseif (Float64(x / y) <= 5e+194) tmp = t; else tmp = Float64(t * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e+41) tmp = y * (t / y); elseif ((x / y) <= 5e+194) tmp = t; else tmp = t * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+41], N[(y * N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 5e+194], t, N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+41}:\\
\;\;\;\;y \cdot \frac{t}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+194}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.00000000000000022e41Initial program 99.9%
Taylor expanded in z around inf 54.2%
associate-/l*52.6%
Simplified52.6%
Taylor expanded in y around 0 59.4%
Taylor expanded in t around inf 9.4%
*-commutative9.4%
associate-/l*23.7%
Applied egg-rr23.7%
if -5.00000000000000022e41 < (/.f64 x y) < 4.99999999999999989e194Initial program 98.2%
Taylor expanded in x around 0 55.3%
if 4.99999999999999989e194 < (/.f64 x y) Initial program 93.7%
Taylor expanded in z around 0 45.0%
*-rgt-identity45.0%
mul-1-neg45.0%
associate-/l*48.0%
distribute-rgt-neg-in48.0%
mul-1-neg48.0%
distribute-lft-in48.0%
mul-1-neg48.0%
unsub-neg48.0%
Simplified48.0%
Taylor expanded in x around inf 48.0%
mul-1-neg48.0%
distribute-frac-neg48.0%
Simplified48.0%
div-inv48.0%
add-sqr-sqrt20.9%
sqrt-unprod28.0%
sqr-neg28.0%
sqrt-unprod7.2%
add-sqr-sqrt20.7%
Applied egg-rr20.7%
associate-*r/20.7%
*-rgt-identity20.7%
Simplified20.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -23000.0) (not (<= t 5.2e+42))) (* t (/ (- y x) y)) (+ t (/ x (/ y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -23000.0) || !(t <= 5.2e+42)) {
tmp = t * ((y - x) / y);
} else {
tmp = t + (x / (y / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-23000.0d0)) .or. (.not. (t <= 5.2d+42))) then
tmp = t * ((y - x) / y)
else
tmp = t + (x / (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -23000.0) || !(t <= 5.2e+42)) {
tmp = t * ((y - x) / y);
} else {
tmp = t + (x / (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -23000.0) or not (t <= 5.2e+42): tmp = t * ((y - x) / y) else: tmp = t + (x / (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -23000.0) || !(t <= 5.2e+42)) tmp = Float64(t * Float64(Float64(y - x) / y)); else tmp = Float64(t + Float64(x / Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -23000.0) || ~((t <= 5.2e+42))) tmp = t * ((y - x) / y); else tmp = t + (x / (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -23000.0], N[Not[LessEqual[t, 5.2e+42]], $MachinePrecision]], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -23000 \lor \neg \left(t \leq 5.2 \cdot 10^{+42}\right):\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z}}\\
\end{array}
\end{array}
if t < -23000 or 5.1999999999999998e42 < t Initial program 99.9%
Taylor expanded in z around 0 83.1%
*-rgt-identity83.1%
mul-1-neg83.1%
associate-/l*90.7%
distribute-rgt-neg-in90.7%
mul-1-neg90.7%
distribute-lft-in90.7%
mul-1-neg90.7%
unsub-neg90.7%
Simplified90.7%
Taylor expanded in y around 0 90.7%
if -23000 < t < 5.1999999999999998e42Initial program 96.3%
Taylor expanded in z around inf 90.6%
associate-/l*91.4%
Simplified91.4%
clear-num91.3%
un-div-inv91.4%
Applied egg-rr91.4%
Final simplification91.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -53000.0) (not (<= t 2.5e+44))) (* t (/ (- y x) y)) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -53000.0) || !(t <= 2.5e+44)) {
tmp = t * ((y - 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 <= (-53000.0d0)) .or. (.not. (t <= 2.5d+44))) then
tmp = t * ((y - 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 <= -53000.0) || !(t <= 2.5e+44)) {
tmp = t * ((y - x) / y);
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -53000.0) or not (t <= 2.5e+44): tmp = t * ((y - x) / y) else: tmp = t + (x * (z / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -53000.0) || !(t <= 2.5e+44)) tmp = Float64(t * Float64(Float64(y - 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 <= -53000.0) || ~((t <= 2.5e+44))) tmp = t * ((y - x) / y); else tmp = t + (x * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -53000.0], N[Not[LessEqual[t, 2.5e+44]], $MachinePrecision]], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -53000 \lor \neg \left(t \leq 2.5 \cdot 10^{+44}\right):\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if t < -53000 or 2.4999999999999998e44 < t Initial program 99.9%
Taylor expanded in z around 0 83.1%
*-rgt-identity83.1%
mul-1-neg83.1%
associate-/l*90.7%
distribute-rgt-neg-in90.7%
mul-1-neg90.7%
distribute-lft-in90.7%
mul-1-neg90.7%
unsub-neg90.7%
Simplified90.7%
Taylor expanded in y around 0 90.7%
if -53000 < t < 2.4999999999999998e44Initial program 96.3%
Taylor expanded in z around inf 90.6%
associate-/l*91.4%
Simplified91.4%
Final simplification91.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.44e-83) (not (<= t 3e-81))) (* t (/ (- y x) y)) (/ (* z x) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.44e-83) || !(t <= 3e-81)) {
tmp = t * ((y - x) / y);
} 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 ((t <= (-1.44d-83)) .or. (.not. (t <= 3d-81))) then
tmp = t * ((y - x) / y)
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 ((t <= -1.44e-83) || !(t <= 3e-81)) {
tmp = t * ((y - x) / y);
} else {
tmp = (z * x) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.44e-83) or not (t <= 3e-81): tmp = t * ((y - x) / y) else: tmp = (z * x) / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.44e-83) || !(t <= 3e-81)) tmp = Float64(t * Float64(Float64(y - x) / y)); else tmp = Float64(Float64(z * x) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.44e-83) || ~((t <= 3e-81))) tmp = t * ((y - x) / y); else tmp = (z * x) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.44e-83], N[Not[LessEqual[t, 3e-81]], $MachinePrecision]], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.44 \cdot 10^{-83} \lor \neg \left(t \leq 3 \cdot 10^{-81}\right):\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot x}{y}\\
\end{array}
\end{array}
if t < -1.44000000000000001e-83 or 2.9999999999999999e-81 < t Initial program 99.9%
Taylor expanded in z around 0 81.8%
*-rgt-identity81.8%
mul-1-neg81.8%
associate-/l*87.7%
distribute-rgt-neg-in87.7%
mul-1-neg87.7%
distribute-lft-in87.7%
mul-1-neg87.7%
unsub-neg87.7%
Simplified87.7%
Taylor expanded in y around 0 87.7%
if -1.44000000000000001e-83 < t < 2.9999999999999999e-81Initial program 95.1%
Taylor expanded in z around inf 90.4%
associate-/l*89.5%
Simplified89.5%
Taylor expanded in y around 0 90.4%
Taylor expanded in t around 0 67.7%
Final simplification79.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.55e-76) (not (<= t 6.5e-78))) (* t (- 1.0 (/ x y))) (/ (* z x) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.55e-76) || !(t <= 6.5e-78)) {
tmp = t * (1.0 - (x / y));
} 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 ((t <= (-2.55d-76)) .or. (.not. (t <= 6.5d-78))) then
tmp = t * (1.0d0 - (x / y))
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 ((t <= -2.55e-76) || !(t <= 6.5e-78)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = (z * x) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.55e-76) or not (t <= 6.5e-78): tmp = t * (1.0 - (x / y)) else: tmp = (z * x) / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.55e-76) || !(t <= 6.5e-78)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(Float64(z * x) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.55e-76) || ~((t <= 6.5e-78))) tmp = t * (1.0 - (x / y)); else tmp = (z * x) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.55e-76], N[Not[LessEqual[t, 6.5e-78]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.55 \cdot 10^{-76} \lor \neg \left(t \leq 6.5 \cdot 10^{-78}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot x}{y}\\
\end{array}
\end{array}
if t < -2.54999999999999993e-76 or 6.5000000000000003e-78 < t Initial program 99.9%
Taylor expanded in z around 0 81.8%
*-rgt-identity81.8%
mul-1-neg81.8%
associate-/l*87.7%
distribute-rgt-neg-in87.7%
mul-1-neg87.7%
distribute-lft-in87.7%
mul-1-neg87.7%
unsub-neg87.7%
Simplified87.7%
if -2.54999999999999993e-76 < t < 6.5000000000000003e-78Initial program 95.1%
Taylor expanded in z around inf 90.4%
associate-/l*89.5%
Simplified89.5%
Taylor expanded in y around 0 90.4%
Taylor expanded in t around 0 67.7%
Final simplification79.8%
(FPCore (x y z t) :precision binary64 (if (<= t -1950.0) (- t (* t (/ x y))) (if (<= t 1.9e+45) (+ t (/ x (/ y z))) (* t (/ (- y x) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1950.0) {
tmp = t - (t * (x / y));
} else if (t <= 1.9e+45) {
tmp = t + (x / (y / z));
} else {
tmp = t * ((y - 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 <= (-1950.0d0)) then
tmp = t - (t * (x / y))
else if (t <= 1.9d+45) then
tmp = t + (x / (y / z))
else
tmp = t * ((y - x) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1950.0) {
tmp = t - (t * (x / y));
} else if (t <= 1.9e+45) {
tmp = t + (x / (y / z));
} else {
tmp = t * ((y - x) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1950.0: tmp = t - (t * (x / y)) elif t <= 1.9e+45: tmp = t + (x / (y / z)) else: tmp = t * ((y - x) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1950.0) tmp = Float64(t - Float64(t * Float64(x / y))); elseif (t <= 1.9e+45) tmp = Float64(t + Float64(x / Float64(y / z))); else tmp = Float64(t * Float64(Float64(y - x) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1950.0) tmp = t - (t * (x / y)); elseif (t <= 1.9e+45) tmp = t + (x / (y / z)); else tmp = t * ((y - x) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1950.0], N[(t - N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.9e+45], N[(t + N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(y - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1950:\\
\;\;\;\;t - t \cdot \frac{x}{y}\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{+45}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\end{array}
\end{array}
if t < -1950Initial program 99.9%
Taylor expanded in x around 0 94.4%
associate-*r/91.4%
*-commutative91.4%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 88.5%
mul-1-neg88.5%
associate-*r/94.1%
sub-neg94.1%
Simplified94.1%
if -1950 < t < 1.9000000000000001e45Initial program 96.3%
Taylor expanded in z around inf 90.6%
associate-/l*91.4%
Simplified91.4%
clear-num91.3%
un-div-inv91.4%
Applied egg-rr91.4%
if 1.9000000000000001e45 < t Initial program 99.8%
Taylor expanded in z around 0 76.6%
*-rgt-identity76.6%
mul-1-neg76.6%
associate-/l*86.7%
distribute-rgt-neg-in86.7%
mul-1-neg86.7%
distribute-lft-in86.8%
mul-1-neg86.8%
unsub-neg86.8%
Simplified86.8%
Taylor expanded in y around 0 86.8%
Final simplification91.1%
(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 98.0%
Final simplification98.0%
(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 98.0%
Taylor expanded in x around 0 38.4%
(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 2024186
(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))