
(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 13 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.3%
*-commutative98.3%
clear-num98.3%
un-div-inv98.6%
Applied egg-rr98.6%
Final simplification98.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2000000000.0) (not (<= (/ x y) 1.0))) (* t (/ x (- y))) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2000000000.0) || !((x / y) <= 1.0)) {
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) <= (-2000000000.0d0)) .or. (.not. ((x / y) <= 1.0d0))) 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) <= -2000000000.0) || !((x / y) <= 1.0)) {
tmp = t * (x / -y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2000000000.0) or not ((x / y) <= 1.0): tmp = t * (x / -y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2000000000.0) || !(Float64(x / y) <= 1.0)) tmp = Float64(t * Float64(x / Float64(-y))); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2000000000.0) || ~(((x / y) <= 1.0))) tmp = t * (x / -y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2000000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1.0]], $MachinePrecision]], N[(t * N[(x / (-y)), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2000000000 \lor \neg \left(\frac{x}{y} \leq 1\right):\\
\;\;\;\;t \cdot \frac{x}{-y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -2e9 or 1 < (/.f64 x y) Initial program 96.7%
Taylor expanded in z around 0 47.2%
mul-1-neg47.2%
unsub-neg47.2%
*-rgt-identity47.2%
associate-/l*51.6%
distribute-lft-out--51.6%
Simplified51.6%
Taylor expanded in x around inf 50.7%
mul-1-neg50.7%
distribute-frac-neg250.7%
Simplified50.7%
if -2e9 < (/.f64 x y) < 1Initial program 99.8%
Taylor expanded in x around 0 74.7%
Final simplification63.1%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -2000000000.0) (* t (/ x (- y))) (if (<= (/ x y) 1.0) t (/ t (/ y (- x))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2000000000.0) {
tmp = t * (x / -y);
} else if ((x / y) <= 1.0) {
tmp = t;
} else {
tmp = 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) <= (-2000000000.0d0)) then
tmp = t * (x / -y)
else if ((x / y) <= 1.0d0) then
tmp = t
else
tmp = 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) <= -2000000000.0) {
tmp = t * (x / -y);
} else if ((x / y) <= 1.0) {
tmp = t;
} else {
tmp = t / (y / -x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2000000000.0: tmp = t * (x / -y) elif (x / y) <= 1.0: tmp = t else: tmp = t / (y / -x) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2000000000.0) tmp = Float64(t * Float64(x / Float64(-y))); elseif (Float64(x / y) <= 1.0) tmp = t; else tmp = Float64(t / Float64(y / Float64(-x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -2000000000.0) tmp = t * (x / -y); elseif ((x / y) <= 1.0) tmp = t; else tmp = t / (y / -x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2000000000.0], N[(t * N[(x / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.0], t, N[(t / N[(y / (-x)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2000000000:\\
\;\;\;\;t \cdot \frac{x}{-y}\\
\mathbf{elif}\;\frac{x}{y} \leq 1:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{y}{-x}}\\
\end{array}
\end{array}
if (/.f64 x y) < -2e9Initial program 96.6%
Taylor expanded in z around 0 47.0%
mul-1-neg47.0%
unsub-neg47.0%
*-rgt-identity47.0%
associate-/l*49.9%
distribute-lft-out--49.9%
Simplified49.9%
Taylor expanded in x around inf 49.4%
mul-1-neg49.4%
distribute-frac-neg249.4%
Simplified49.4%
if -2e9 < (/.f64 x y) < 1Initial program 99.8%
Taylor expanded in x around 0 74.7%
if 1 < (/.f64 x y) Initial program 96.8%
Taylor expanded in z around 0 47.3%
mul-1-neg47.3%
unsub-neg47.3%
*-rgt-identity47.3%
associate-/l*53.2%
distribute-lft-out--53.2%
Simplified53.2%
Taylor expanded in x around inf 47.3%
mul-1-neg47.3%
distribute-frac-neg247.3%
*-commutative47.3%
associate-/l*41.8%
Simplified41.8%
*-commutative41.8%
add-sqr-sqrt26.3%
sqrt-unprod33.1%
sqr-neg33.1%
sqrt-unprod6.9%
add-sqr-sqrt14.2%
associate-/r/14.2%
frac-2neg14.2%
distribute-neg-frac14.2%
add-sqr-sqrt8.8%
sqrt-unprod22.2%
sqr-neg22.2%
sqrt-unprod18.2%
add-sqr-sqrt53.1%
Applied egg-rr53.1%
Final simplification63.4%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e+29) (* y (/ t y)) (if (<= (/ x y) 2e-8) t (* t (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+29) {
tmp = y * (t / y);
} else if ((x / y) <= 2e-8) {
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+29)) then
tmp = y * (t / y)
else if ((x / y) <= 2d-8) 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+29) {
tmp = y * (t / y);
} else if ((x / y) <= 2e-8) {
tmp = t;
} else {
tmp = t * (x / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+29: tmp = y * (t / y) elif (x / y) <= 2e-8: tmp = t else: tmp = t * (x / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+29) tmp = Float64(y * Float64(t / y)); elseif (Float64(x / y) <= 2e-8) 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+29) tmp = y * (t / y); elseif ((x / y) <= 2e-8) tmp = t; else tmp = t * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+29], N[(y * N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e-8], t, N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+29}:\\
\;\;\;\;y \cdot \frac{t}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.0000000000000001e29Initial program 96.5%
Taylor expanded in z around 0 46.9%
mul-1-neg46.9%
*-commutative46.9%
associate-/l*46.8%
distribute-rgt-neg-in46.8%
distribute-neg-frac246.8%
Simplified46.8%
Taylor expanded in y around 0 46.9%
neg-mul-146.9%
+-commutative46.9%
distribute-rgt-neg-in46.9%
distribute-lft-out46.9%
unsub-neg46.9%
Simplified46.9%
Taylor expanded in y around inf 5.1%
*-commutative5.1%
Simplified5.1%
associate-/l*13.1%
*-commutative13.1%
Applied egg-rr13.1%
if -5.0000000000000001e29 < (/.f64 x y) < 2e-8Initial program 99.8%
Taylor expanded in x around 0 74.7%
if 2e-8 < (/.f64 x y) Initial program 96.9%
Taylor expanded in z around 0 45.9%
mul-1-neg45.9%
*-commutative45.9%
associate-/l*43.2%
distribute-rgt-neg-in43.2%
distribute-neg-frac243.2%
Simplified43.2%
Taylor expanded in y around 0 41.1%
neg-mul-141.1%
+-commutative41.1%
distribute-rgt-neg-in41.1%
distribute-lft-out46.0%
unsub-neg46.0%
Simplified46.0%
Taylor expanded in y around 0 46.0%
associate-*r*46.0%
neg-mul-146.0%
*-commutative46.0%
Simplified46.0%
frac-2neg46.0%
distribute-rgt-neg-out46.0%
remove-double-neg46.0%
associate-*l/50.5%
add-sqr-sqrt32.6%
sqrt-unprod33.5%
sqr-neg33.5%
sqrt-unprod5.5%
add-sqr-sqrt14.1%
Applied egg-rr14.1%
Final simplification45.1%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e+29) (* y (/ t y)) (if (<= (/ x y) 2e-8) t (/ t (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+29) {
tmp = y * (t / y);
} else if ((x / y) <= 2e-8) {
tmp = t;
} else {
tmp = 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) <= (-5d+29)) then
tmp = y * (t / y)
else if ((x / y) <= 2d-8) then
tmp = t
else
tmp = 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) <= -5e+29) {
tmp = y * (t / y);
} else if ((x / y) <= 2e-8) {
tmp = t;
} else {
tmp = t / (y / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+29: tmp = y * (t / y) elif (x / y) <= 2e-8: tmp = t else: tmp = t / (y / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+29) tmp = Float64(y * Float64(t / y)); elseif (Float64(x / y) <= 2e-8) tmp = t; else tmp = Float64(t / Float64(y / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e+29) tmp = y * (t / y); elseif ((x / y) <= 2e-8) tmp = t; else tmp = t / (y / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+29], N[(y * N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e-8], t, N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+29}:\\
\;\;\;\;y \cdot \frac{t}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{y}{x}}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.0000000000000001e29Initial program 96.5%
Taylor expanded in z around 0 46.9%
mul-1-neg46.9%
*-commutative46.9%
associate-/l*46.8%
distribute-rgt-neg-in46.8%
distribute-neg-frac246.8%
Simplified46.8%
Taylor expanded in y around 0 46.9%
neg-mul-146.9%
+-commutative46.9%
distribute-rgt-neg-in46.9%
distribute-lft-out46.9%
unsub-neg46.9%
Simplified46.9%
Taylor expanded in y around inf 5.1%
*-commutative5.1%
Simplified5.1%
associate-/l*13.1%
*-commutative13.1%
Applied egg-rr13.1%
if -5.0000000000000001e29 < (/.f64 x y) < 2e-8Initial program 99.8%
Taylor expanded in x around 0 74.7%
if 2e-8 < (/.f64 x y) Initial program 96.9%
Taylor expanded in z around 0 45.9%
mul-1-neg45.9%
unsub-neg45.9%
*-rgt-identity45.9%
associate-/l*53.1%
distribute-lft-out--53.1%
Simplified53.1%
Taylor expanded in x around inf 50.5%
mul-1-neg50.5%
distribute-frac-neg250.5%
Simplified50.5%
clear-num50.5%
un-div-inv51.5%
add-sqr-sqrt33.6%
sqrt-unprod34.6%
sqr-neg34.6%
sqrt-unprod5.5%
add-sqr-sqrt14.1%
Applied egg-rr14.1%
Final simplification45.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.6e-53) (not (<= z 5.8e-109))) (+ t (* x (/ z y))) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.6e-53) || !(z <= 5.8e-109)) {
tmp = t + (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 <= (-2.6d-53)) .or. (.not. (z <= 5.8d-109))) then
tmp = t + (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 <= -2.6e-53) || !(z <= 5.8e-109)) {
tmp = t + (x * (z / y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.6e-53) or not (z <= 5.8e-109): tmp = t + (x * (z / y)) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.6e-53) || !(z <= 5.8e-109)) tmp = Float64(t + 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 <= -2.6e-53) || ~((z <= 5.8e-109))) tmp = t + (x * (z / y)); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.6e-53], N[Not[LessEqual[z, 5.8e-109]], $MachinePrecision]], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{-53} \lor \neg \left(z \leq 5.8 \cdot 10^{-109}\right):\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -2.59999999999999996e-53 or 5.8e-109 < z Initial program 99.7%
Taylor expanded in z around inf 78.1%
associate-/l*79.4%
Simplified79.4%
if -2.59999999999999996e-53 < z < 5.8e-109Initial program 96.3%
Taylor expanded in z around 0 85.2%
mul-1-neg85.2%
unsub-neg85.2%
*-rgt-identity85.2%
associate-/l*92.1%
distribute-lft-out--92.1%
Simplified92.1%
Final simplification84.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.8e-53) (not (<= z 2e-109))) (+ t (* z (/ x y))) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.8e-53) || !(z <= 2e-109)) {
tmp = t + (z * (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 ((z <= (-2.8d-53)) .or. (.not. (z <= 2d-109))) then
tmp = t + (z * (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 ((z <= -2.8e-53) || !(z <= 2e-109)) {
tmp = t + (z * (x / y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.8e-53) or not (z <= 2e-109): tmp = t + (z * (x / y)) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.8e-53) || !(z <= 2e-109)) tmp = Float64(t + Float64(z * Float64(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 ((z <= -2.8e-53) || ~((z <= 2e-109))) tmp = t + (z * (x / y)); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.8e-53], N[Not[LessEqual[z, 2e-109]], $MachinePrecision]], N[(t + N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-53} \lor \neg \left(z \leq 2 \cdot 10^{-109}\right):\\
\;\;\;\;t + z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -2.79999999999999985e-53 or 2e-109 < z Initial program 99.7%
Taylor expanded in z around inf 78.1%
associate-/l*79.4%
Simplified79.4%
*-commutative79.4%
associate-/r/85.9%
Applied egg-rr85.9%
div-inv85.8%
clear-num85.8%
*-commutative85.8%
Applied egg-rr85.8%
if -2.79999999999999985e-53 < z < 2e-109Initial program 96.3%
Taylor expanded in z around 0 85.2%
mul-1-neg85.2%
unsub-neg85.2%
*-rgt-identity85.2%
associate-/l*92.1%
distribute-lft-out--92.1%
Simplified92.1%
Final simplification88.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.4e-54) (not (<= z 6.6e-110))) (+ t (/ z (/ y x))) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.4e-54) || !(z <= 6.6e-110)) {
tmp = t + (z / (y / x));
} 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 <= (-7.4d-54)) .or. (.not. (z <= 6.6d-110))) then
tmp = t + (z / (y / x))
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 <= -7.4e-54) || !(z <= 6.6e-110)) {
tmp = t + (z / (y / x));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.4e-54) or not (z <= 6.6e-110): tmp = t + (z / (y / x)) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.4e-54) || !(z <= 6.6e-110)) tmp = Float64(t + Float64(z / Float64(y / x))); 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 <= -7.4e-54) || ~((z <= 6.6e-110))) tmp = t + (z / (y / x)); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.4e-54], N[Not[LessEqual[z, 6.6e-110]], $MachinePrecision]], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{-54} \lor \neg \left(z \leq 6.6 \cdot 10^{-110}\right):\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -7.4000000000000006e-54 or 6.5999999999999998e-110 < z Initial program 99.7%
Taylor expanded in z around inf 78.1%
associate-/l*79.4%
Simplified79.4%
*-commutative79.4%
associate-/r/85.9%
Applied egg-rr85.9%
if -7.4000000000000006e-54 < z < 6.5999999999999998e-110Initial program 96.3%
Taylor expanded in z around 0 85.2%
mul-1-neg85.2%
unsub-neg85.2%
*-rgt-identity85.2%
associate-/l*92.1%
distribute-lft-out--92.1%
Simplified92.1%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.5e-54) (not (<= z 8.8e-110))) (+ t (/ z (/ y x))) (- t (/ t (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e-54) || !(z <= 8.8e-110)) {
tmp = t + (z / (y / x));
} else {
tmp = t - (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 ((z <= (-7.5d-54)) .or. (.not. (z <= 8.8d-110))) then
tmp = t + (z / (y / x))
else
tmp = t - (t / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e-54) || !(z <= 8.8e-110)) {
tmp = t + (z / (y / x));
} else {
tmp = t - (t / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.5e-54) or not (z <= 8.8e-110): tmp = t + (z / (y / x)) else: tmp = t - (t / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.5e-54) || !(z <= 8.8e-110)) tmp = Float64(t + Float64(z / Float64(y / x))); else tmp = Float64(t - Float64(t / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.5e-54) || ~((z <= 8.8e-110))) tmp = t + (z / (y / x)); else tmp = t - (t / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.5e-54], N[Not[LessEqual[z, 8.8e-110]], $MachinePrecision]], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-54} \lor \neg \left(z \leq 8.8 \cdot 10^{-110}\right):\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\end{array}
\end{array}
if z < -7.5000000000000005e-54 or 8.7999999999999997e-110 < z Initial program 99.7%
Taylor expanded in z around inf 78.1%
associate-/l*79.4%
Simplified79.4%
*-commutative79.4%
associate-/r/85.9%
Applied egg-rr85.9%
if -7.5000000000000005e-54 < z < 8.7999999999999997e-110Initial program 96.3%
Taylor expanded in z around 0 85.2%
mul-1-neg85.2%
*-commutative85.2%
associate-/l*87.7%
distribute-rgt-neg-in87.7%
distribute-neg-frac287.7%
Simplified87.7%
*-commutative34.2%
add-sqr-sqrt21.6%
sqrt-unprod20.1%
sqr-neg20.1%
sqrt-unprod1.5%
add-sqr-sqrt3.1%
associate-/r/3.9%
frac-2neg3.9%
distribute-neg-frac3.9%
add-sqr-sqrt2.4%
sqrt-unprod11.0%
sqr-neg11.0%
sqrt-unprod13.3%
add-sqr-sqrt36.5%
Applied egg-rr92.7%
Final simplification88.8%
(FPCore (x y z t) :precision binary64 (if (<= y -3e-116) t (if (<= y 7e-220) (* y (/ t y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3e-116) {
tmp = t;
} else if (y <= 7e-220) {
tmp = y * (t / 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 (y <= (-3d-116)) then
tmp = t
else if (y <= 7d-220) then
tmp = y * (t / 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 (y <= -3e-116) {
tmp = t;
} else if (y <= 7e-220) {
tmp = y * (t / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3e-116: tmp = t elif y <= 7e-220: tmp = y * (t / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3e-116) tmp = t; elseif (y <= 7e-220) tmp = Float64(y * Float64(t / y)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3e-116) tmp = t; elseif (y <= 7e-220) tmp = y * (t / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3e-116], t, If[LessEqual[y, 7e-220], N[(y * N[(t / y), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{-116}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-220}:\\
\;\;\;\;y \cdot \frac{t}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -3.00000000000000026e-116 or 6.99999999999999975e-220 < y Initial program 98.3%
Taylor expanded in x around 0 51.9%
if -3.00000000000000026e-116 < y < 6.99999999999999975e-220Initial program 98.3%
Taylor expanded in z around 0 50.1%
mul-1-neg50.1%
*-commutative50.1%
associate-/l*39.7%
distribute-rgt-neg-in39.7%
distribute-neg-frac239.7%
Simplified39.7%
Taylor expanded in y around 0 50.0%
neg-mul-150.0%
+-commutative50.0%
distribute-rgt-neg-in50.0%
distribute-lft-out50.0%
unsub-neg50.0%
Simplified50.0%
Taylor expanded in y around inf 3.0%
*-commutative3.0%
Simplified3.0%
associate-/l*19.4%
*-commutative19.4%
Applied egg-rr19.4%
Final simplification43.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 98.3%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (* t (- 1.0 (/ x y))))
double code(double x, double y, double z, double t) {
return t * (1.0 - (x / y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t * (1.0d0 - (x / y))
end function
public static double code(double x, double y, double z, double t) {
return t * (1.0 - (x / y));
}
def code(x, y, z, t): return t * (1.0 - (x / y))
function code(x, y, z, t) return Float64(t * Float64(1.0 - Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = t * (1.0 - (x / y)); end
code[x_, y_, z_, t_] := N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(1 - \frac{x}{y}\right)
\end{array}
Initial program 98.3%
Taylor expanded in z around 0 59.1%
mul-1-neg59.1%
unsub-neg59.1%
*-rgt-identity59.1%
associate-/l*64.6%
distribute-lft-out--64.6%
Simplified64.6%
Final simplification64.6%
(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.3%
Taylor expanded in x around 0 39.8%
Final simplification39.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (* (/ x y) (- z t)) t)))
(if (< z 2.759456554562692e-282)
t_1
(if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((x / y) * (z - t)) + t;
double tmp;
if (z < 2.759456554562692e-282) {
tmp = t_1;
} else if (z < 2.326994450874436e-110) {
tmp = (x * ((z - t) / y)) + t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = ((x / y) * (z - t)) + t
if (z < 2.759456554562692d-282) then
tmp = t_1
else if (z < 2.326994450874436d-110) then
tmp = (x * ((z - t) / y)) + t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((x / y) * (z - t)) + t;
double tmp;
if (z < 2.759456554562692e-282) {
tmp = t_1;
} else if (z < 2.326994450874436e-110) {
tmp = (x * ((z - t) / y)) + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((x / y) * (z - t)) + t tmp = 0 if z < 2.759456554562692e-282: tmp = t_1 elif z < 2.326994450874436e-110: tmp = (x * ((z - t) / y)) + t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x / y) * Float64(z - t)) + t) tmp = 0.0 if (z < 2.759456554562692e-282) tmp = t_1; elseif (z < 2.326994450874436e-110) tmp = Float64(Float64(x * Float64(Float64(z - t) / y)) + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((x / y) * (z - t)) + t; tmp = 0.0; if (z < 2.759456554562692e-282) tmp = t_1; elseif (z < 2.326994450874436e-110) tmp = (x * ((z - t) / y)) + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[Less[z, 2.759456554562692e-282], t$95$1, If[Less[z, 2.326994450874436e-110], N[(N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(z - t\right) + t\\
\mathbf{if}\;z < 2.759456554562692 \cdot 10^{-282}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 2.326994450874436 \cdot 10^{-110}:\\
\;\;\;\;x \cdot \frac{z - t}{y} + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024067
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:alt
(if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))
(+ (* (/ x y) (- z t)) t))