
(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 (* (/ 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.5%
Final simplification97.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -500.0) (not (<= (/ x y) 5e-7))) (* (/ x y) (- t)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -500.0) || !((x / y) <= 5e-7)) {
tmp = (x / y) * -t;
} 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) <= (-500.0d0)) .or. (.not. ((x / y) <= 5d-7))) then
tmp = (x / y) * -t
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) <= -500.0) || !((x / y) <= 5e-7)) {
tmp = (x / y) * -t;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -500.0) or not ((x / y) <= 5e-7): tmp = (x / y) * -t else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -500.0) || !(Float64(x / y) <= 5e-7)) tmp = Float64(Float64(x / y) * Float64(-t)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -500.0) || ~(((x / y) <= 5e-7))) tmp = (x / y) * -t; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -500.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e-7]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -500 \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -500 or 4.99999999999999977e-7 < (/.f64 x y) Initial program 96.8%
Taylor expanded in z around 0 52.0%
mul-1-neg52.0%
unsub-neg52.0%
*-rgt-identity52.0%
associate-*r/55.7%
distribute-lft-out--55.7%
Simplified55.7%
Taylor expanded in x around inf 54.0%
mul-1-neg54.0%
distribute-neg-frac54.0%
Simplified54.0%
if -500 < (/.f64 x y) < 4.99999999999999977e-7Initial program 98.1%
Taylor expanded in x around 0 66.4%
Final simplification60.7%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -500.0) (* (/ x y) (- t)) (if (<= (/ x y) 5e-7) t (/ t (/ (- y) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -500.0) {
tmp = (x / y) * -t;
} else if ((x / y) <= 5e-7) {
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) <= (-500.0d0)) then
tmp = (x / y) * -t
else if ((x / y) <= 5d-7) 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) <= -500.0) {
tmp = (x / y) * -t;
} else if ((x / y) <= 5e-7) {
tmp = t;
} else {
tmp = t / (-y / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -500.0: tmp = (x / y) * -t elif (x / y) <= 5e-7: tmp = t else: tmp = t / (-y / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -500.0) tmp = Float64(Float64(x / y) * Float64(-t)); elseif (Float64(x / y) <= 5e-7) tmp = t; else tmp = Float64(t / Float64(Float64(-y) / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -500.0) tmp = (x / y) * -t; elseif ((x / y) <= 5e-7) tmp = t; else tmp = t / (-y / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -500.0], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 5e-7], t, N[(t / N[((-y) / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -500:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-7}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{-y}{x}}\\
\end{array}
\end{array}
if (/.f64 x y) < -500Initial program 95.1%
Taylor expanded in z around 0 50.8%
mul-1-neg50.8%
unsub-neg50.8%
*-rgt-identity50.8%
associate-*r/56.7%
distribute-lft-out--56.7%
Simplified56.7%
Taylor expanded in x around inf 56.1%
mul-1-neg56.1%
distribute-neg-frac56.1%
Simplified56.1%
if -500 < (/.f64 x y) < 4.99999999999999977e-7Initial program 98.1%
Taylor expanded in x around 0 66.4%
if 4.99999999999999977e-7 < (/.f64 x y) Initial program 98.4%
Taylor expanded in z around 0 53.1%
mul-1-neg53.1%
unsub-neg53.1%
*-rgt-identity53.1%
associate-*r/54.8%
distribute-lft-out--54.8%
Simplified54.8%
Taylor expanded in x around inf 52.0%
mul-1-neg52.0%
distribute-neg-frac52.0%
Simplified52.0%
associate-*r/50.9%
frac-2neg50.9%
add-sqr-sqrt24.5%
sqrt-unprod26.5%
sqr-neg26.5%
sqrt-unprod2.2%
add-sqr-sqrt3.0%
distribute-rgt-neg-out3.0%
add-sqr-sqrt0.9%
sqrt-unprod28.5%
sqr-neg28.5%
sqrt-unprod26.4%
add-sqr-sqrt50.9%
Applied egg-rr50.9%
associate-/l*52.0%
Simplified52.0%
Final simplification60.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e+212) (not (<= (/ x y) 1e+304))) (* (/ x y) t) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+212) || !((x / y) <= 1e+304)) {
tmp = (x / y) * t;
} 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) <= (-5d+212)) .or. (.not. ((x / y) <= 1d+304))) then
tmp = (x / y) * t
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) <= -5e+212) || !((x / y) <= 1e+304)) {
tmp = (x / y) * t;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e+212) or not ((x / y) <= 1e+304): tmp = (x / y) * t else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e+212) || !(Float64(x / y) <= 1e+304)) tmp = Float64(Float64(x / y) * t); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -5e+212) || ~(((x / y) <= 1e+304))) tmp = (x / y) * t; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e+212], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e+304]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+212} \lor \neg \left(\frac{x}{y} \leq 10^{+304}\right):\\
\;\;\;\;\frac{x}{y} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -4.99999999999999992e212 or 9.9999999999999994e303 < (/.f64 x y) Initial program 91.0%
Taylor expanded in z around 0 50.0%
mul-1-neg50.0%
unsub-neg50.0%
*-rgt-identity50.0%
associate-*r/52.5%
distribute-lft-out--52.5%
Simplified52.5%
Taylor expanded in x around inf 52.5%
mul-1-neg52.5%
distribute-neg-frac52.5%
Simplified52.5%
expm1-log1p-u22.2%
expm1-udef22.2%
add-sqr-sqrt12.2%
sqrt-unprod17.2%
sqr-neg17.2%
sqrt-unprod5.0%
add-sqr-sqrt9.9%
clear-num9.9%
div-inv9.9%
Applied egg-rr9.9%
expm1-def9.9%
expm1-log1p25.0%
associate-/l*15.9%
associate-*r/27.4%
Simplified27.4%
if -4.99999999999999992e212 < (/.f64 x y) < 9.9999999999999994e303Initial program 98.7%
Taylor expanded in x around 0 43.3%
Final simplification40.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.42e-155) (not (<= x 1e-92))) (+ t (* x (/ (- z t) y))) (+ t (/ z (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.42e-155) || !(x <= 1e-92)) {
tmp = t + (x * ((z - t) / y));
} else {
tmp = t + (z / (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 <= (-1.42d-155)) .or. (.not. (x <= 1d-92))) then
tmp = t + (x * ((z - t) / y))
else
tmp = t + (z / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.42e-155) || !(x <= 1e-92)) {
tmp = t + (x * ((z - t) / y));
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.42e-155) or not (x <= 1e-92): tmp = t + (x * ((z - t) / y)) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.42e-155) || !(x <= 1e-92)) tmp = Float64(t + Float64(x * Float64(Float64(z - t) / y))); else tmp = Float64(t + Float64(z / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.42e-155) || ~((x <= 1e-92))) tmp = t + (x * ((z - t) / y)); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.42e-155], N[Not[LessEqual[x, 1e-92]], $MachinePrecision]], N[(t + N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.42 \cdot 10^{-155} \lor \neg \left(x \leq 10^{-92}\right):\\
\;\;\;\;t + x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if x < -1.4200000000000001e-155 or 9.99999999999999988e-93 < x Initial program 97.3%
Taylor expanded in x around 0 92.3%
associate-*r/98.1%
Simplified98.1%
if -1.4200000000000001e-155 < x < 9.99999999999999988e-93Initial program 98.0%
*-commutative98.0%
clear-num98.1%
un-div-inv98.1%
Applied egg-rr98.1%
Taylor expanded in z around inf 90.4%
associate-*r/76.7%
Simplified76.7%
associate-*r/90.4%
*-commutative90.4%
associate-/l*92.7%
Applied egg-rr92.7%
Final simplification96.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.2e+35) (not (<= t 4800.0))) (* t (- 1.0 (/ x y))) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e+35) || !(t <= 4800.0)) {
tmp = t * (1.0 - (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 <= (-5.2d+35)) .or. (.not. (t <= 4800.0d0))) then
tmp = t * (1.0d0 - (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 <= -5.2e+35) || !(t <= 4800.0)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.2e+35) or not (t <= 4800.0): tmp = t * (1.0 - (x / y)) else: tmp = t + (x * (z / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.2e+35) || !(t <= 4800.0)) tmp = Float64(t * Float64(1.0 - Float64(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 <= -5.2e+35) || ~((t <= 4800.0))) tmp = t * (1.0 - (x / y)); else tmp = t + (x * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.2e+35], N[Not[LessEqual[t, 4800.0]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{+35} \lor \neg \left(t \leq 4800\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if t < -5.20000000000000013e35 or 4800 < t Initial program 99.9%
Taylor expanded in z around 0 78.3%
mul-1-neg78.3%
unsub-neg78.3%
*-rgt-identity78.3%
associate-*r/86.3%
distribute-lft-out--86.2%
Simplified86.2%
if -5.20000000000000013e35 < t < 4800Initial program 95.3%
*-commutative95.3%
clear-num94.7%
un-div-inv95.2%
Applied egg-rr95.2%
Taylor expanded in z around inf 86.4%
associate-*r/83.0%
Simplified83.0%
Final simplification84.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.2e-190) (not (<= z 2.1e-39))) (+ t (* (/ x y) z)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.2e-190) || !(z <= 2.1e-39)) {
tmp = t + ((x / y) * z);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.2d-190)) .or. (.not. (z <= 2.1d-39))) then
tmp = t + ((x / y) * z)
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.2e-190) || !(z <= 2.1e-39)) {
tmp = t + ((x / y) * z);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.2e-190) or not (z <= 2.1e-39): tmp = t + ((x / y) * z) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.2e-190) || !(z <= 2.1e-39)) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.2e-190) || ~((z <= 2.1e-39))) tmp = t + ((x / y) * z); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.2e-190], N[Not[LessEqual[z, 2.1e-39]], $MachinePrecision]], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{-190} \lor \neg \left(z \leq 2.1 \cdot 10^{-39}\right):\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -1.2e-190 or 2.09999999999999993e-39 < z Initial program 98.4%
Taylor expanded in z around inf 82.8%
associate-*l/86.7%
*-commutative86.7%
Simplified86.7%
if -1.2e-190 < z < 2.09999999999999993e-39Initial program 95.4%
Taylor expanded in z around 0 85.8%
mul-1-neg85.8%
unsub-neg85.8%
*-rgt-identity85.8%
associate-*r/89.1%
distribute-lft-out--89.1%
Simplified89.1%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (if (<= z -4.4e-191) (+ t (* (/ x y) z)) (if (<= z 2.7e-34) (* t (- 1.0 (/ x y))) (+ t (/ z (/ y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.4e-191) {
tmp = t + ((x / y) * z);
} else if (z <= 2.7e-34) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (z / (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 <= (-4.4d-191)) then
tmp = t + ((x / y) * z)
else if (z <= 2.7d-34) then
tmp = t * (1.0d0 - (x / y))
else
tmp = t + (z / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.4e-191) {
tmp = t + ((x / y) * z);
} else if (z <= 2.7e-34) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.4e-191: tmp = t + ((x / y) * z) elif z <= 2.7e-34: tmp = t * (1.0 - (x / y)) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.4e-191) tmp = Float64(t + Float64(Float64(x / y) * z)); elseif (z <= 2.7e-34) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(t + Float64(z / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.4e-191) tmp = t + ((x / y) * z); elseif (z <= 2.7e-34) tmp = t * (1.0 - (x / y)); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.4e-191], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e-34], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{-191}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-34}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if z < -4.39999999999999996e-191Initial program 99.5%
Taylor expanded in z around inf 83.7%
associate-*l/87.9%
*-commutative87.9%
Simplified87.9%
if -4.39999999999999996e-191 < z < 2.70000000000000017e-34Initial program 95.4%
Taylor expanded in z around 0 85.8%
mul-1-neg85.8%
unsub-neg85.8%
*-rgt-identity85.8%
associate-*r/89.1%
distribute-lft-out--89.1%
Simplified89.1%
if 2.70000000000000017e-34 < z Initial program 96.9%
*-commutative96.9%
clear-num96.9%
un-div-inv96.9%
Applied egg-rr96.9%
Taylor expanded in z around inf 81.5%
associate-*r/78.7%
Simplified78.7%
associate-*r/81.5%
*-commutative81.5%
associate-/l*85.2%
Applied egg-rr85.2%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (if (<= z -1.2e-190) (+ t (* (/ x y) z)) (if (<= z 3e-39) (- t (/ t (/ y x))) (+ t (/ z (/ y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.2e-190) {
tmp = t + ((x / y) * z);
} else if (z <= 3e-39) {
tmp = t - (t / (y / x));
} else {
tmp = t + (z / (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 <= (-1.2d-190)) then
tmp = t + ((x / y) * z)
else if (z <= 3d-39) then
tmp = t - (t / (y / x))
else
tmp = t + (z / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.2e-190) {
tmp = t + ((x / y) * z);
} else if (z <= 3e-39) {
tmp = t - (t / (y / x));
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.2e-190: tmp = t + ((x / y) * z) elif z <= 3e-39: tmp = t - (t / (y / x)) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.2e-190) tmp = Float64(t + Float64(Float64(x / y) * z)); elseif (z <= 3e-39) tmp = Float64(t - Float64(t / Float64(y / x))); else tmp = Float64(t + Float64(z / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.2e-190) tmp = t + ((x / y) * z); elseif (z <= 3e-39) tmp = t - (t / (y / x)); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.2e-190], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3e-39], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{-190}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-39}:\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if z < -1.2e-190Initial program 99.5%
Taylor expanded in z around inf 83.7%
associate-*l/87.9%
*-commutative87.9%
Simplified87.9%
if -1.2e-190 < z < 3.00000000000000028e-39Initial program 95.4%
*-commutative95.4%
clear-num95.4%
un-div-inv96.1%
Applied egg-rr96.1%
Taylor expanded in z around 0 85.8%
mul-1-neg85.8%
associate-/l*89.1%
sub-neg89.1%
Simplified89.1%
if 3.00000000000000028e-39 < z Initial program 96.9%
*-commutative96.9%
clear-num96.9%
un-div-inv96.9%
Applied egg-rr96.9%
Taylor expanded in z around inf 81.5%
associate-*r/78.7%
Simplified78.7%
associate-*r/81.5%
*-commutative81.5%
associate-/l*85.2%
Applied egg-rr85.2%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (if (<= z -1.2e-190) (+ t (* (/ x y) z)) (if (<= z 3.5e-41) (- t (* (/ x y) t)) (+ t (/ z (/ y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.2e-190) {
tmp = t + ((x / y) * z);
} else if (z <= 3.5e-41) {
tmp = t - ((x / y) * t);
} else {
tmp = t + (z / (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 <= (-1.2d-190)) then
tmp = t + ((x / y) * z)
else if (z <= 3.5d-41) then
tmp = t - ((x / y) * t)
else
tmp = t + (z / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.2e-190) {
tmp = t + ((x / y) * z);
} else if (z <= 3.5e-41) {
tmp = t - ((x / y) * t);
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.2e-190: tmp = t + ((x / y) * z) elif z <= 3.5e-41: tmp = t - ((x / y) * t) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.2e-190) tmp = Float64(t + Float64(Float64(x / y) * z)); elseif (z <= 3.5e-41) tmp = Float64(t - Float64(Float64(x / y) * t)); else tmp = Float64(t + Float64(z / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.2e-190) tmp = t + ((x / y) * z); elseif (z <= 3.5e-41) tmp = t - ((x / y) * t); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.2e-190], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e-41], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{-190}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-41}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if z < -1.2e-190Initial program 99.5%
Taylor expanded in z around inf 83.7%
associate-*l/87.9%
*-commutative87.9%
Simplified87.9%
if -1.2e-190 < z < 3.5e-41Initial program 95.4%
Taylor expanded in z around 0 85.8%
mul-1-neg85.8%
distribute-neg-frac85.8%
distribute-rgt-neg-in85.8%
associate-*r/89.1%
Simplified89.1%
if 3.5e-41 < z Initial program 96.9%
*-commutative96.9%
clear-num96.9%
un-div-inv96.9%
Applied egg-rr96.9%
Taylor expanded in z around inf 81.5%
associate-*r/78.7%
Simplified78.7%
associate-*r/81.5%
*-commutative81.5%
associate-/l*85.2%
Applied egg-rr85.2%
Final simplification87.5%
(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 97.5%
Taylor expanded in z around 0 58.0%
mul-1-neg58.0%
unsub-neg58.0%
*-rgt-identity58.0%
associate-*r/62.1%
distribute-lft-out--62.0%
Simplified62.0%
Final simplification62.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 97.5%
Taylor expanded in x around 0 36.8%
Final simplification36.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 2024036
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:herbie-target
(if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))
(+ (* (/ x y) (- z t)) t))