
(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 10 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.3%
Final simplification97.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1e+35) (not (<= (/ x y) 1e-9))) (* x (- (/ z y) (/ t y))) (+ t (/ z (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e+35) || !((x / y) <= 1e-9)) {
tmp = x * ((z / y) - (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 / y) <= (-1d+35)) .or. (.not. ((x / y) <= 1d-9))) then
tmp = x * ((z / y) - (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 / y) <= -1e+35) || !((x / y) <= 1e-9)) {
tmp = x * ((z / y) - (t / y));
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1e+35) or not ((x / y) <= 1e-9): tmp = x * ((z / y) - (t / y)) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1e+35) || !(Float64(x / y) <= 1e-9)) tmp = Float64(x * Float64(Float64(z / y) - Float64(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 / y) <= -1e+35) || ~(((x / y) <= 1e-9))) tmp = x * ((z / y) - (t / y)); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1e+35], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e-9]], $MachinePrecision]], N[(x * N[(N[(z / y), $MachinePrecision] - N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+35} \lor \neg \left(\frac{x}{y} \leq 10^{-9}\right):\\
\;\;\;\;x \cdot \left(\frac{z}{y} - \frac{t}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if (/.f64 x y) < -9.9999999999999997e34 or 1.00000000000000006e-9 < (/.f64 x y) Initial program 97.5%
associate-*l/95.1%
*-commutative95.1%
associate-*l/94.4%
*-commutative94.4%
fma-def94.4%
Simplified94.4%
Taylor expanded in x around inf 91.8%
if -9.9999999999999997e34 < (/.f64 x y) < 1.00000000000000006e-9Initial program 97.2%
Taylor expanded in z around inf 94.6%
associate-/l*96.0%
Simplified96.0%
Final simplification94.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e+29) (not (<= (/ x y) 10.0))) (* t (/ (- x) y)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+29) || !((x / y) <= 10.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) <= (-2d+29)) .or. (.not. ((x / y) <= 10.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) <= -2e+29) || !((x / y) <= 10.0)) {
tmp = t * (-x / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e+29) or not ((x / y) <= 10.0): tmp = t * (-x / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2e+29) || !(Float64(x / y) <= 10.0)) tmp = Float64(t * Float64(Float64(-x) / y)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2e+29) || ~(((x / y) <= 10.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], -2e+29], N[Not[LessEqual[N[(x / y), $MachinePrecision], 10.0]], $MachinePrecision]], N[(t * N[((-x) / y), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+29} \lor \neg \left(\frac{x}{y} \leq 10\right):\\
\;\;\;\;t \cdot \frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -1.99999999999999983e29 or 10 < (/.f64 x y) Initial program 97.5%
associate-*l/95.8%
*-commutative95.8%
associate-*l/94.3%
*-commutative94.3%
fma-def94.3%
Simplified94.3%
Taylor expanded in z around 0 49.9%
mul-1-neg49.9%
unsub-neg49.9%
associate-/l*54.5%
associate-/r/50.0%
Simplified50.0%
Taylor expanded in t around 0 49.9%
associate-*r/54.0%
Simplified54.0%
Taylor expanded in x around inf 49.9%
associate-*l/50.0%
associate-*r*50.0%
neg-mul-150.0%
*-commutative50.0%
*-rgt-identity50.0%
*-commutative50.0%
metadata-eval50.0%
times-frac50.0%
neg-mul-150.0%
neg-mul-150.0%
distribute-frac-neg50.0%
remove-double-neg50.0%
Simplified50.0%
Taylor expanded in x around 0 49.9%
mul-1-neg49.9%
associate-*r/54.0%
distribute-rgt-neg-in54.0%
distribute-neg-frac54.0%
Simplified54.0%
if -1.99999999999999983e29 < (/.f64 x y) < 10Initial program 97.2%
associate-*l/90.9%
*-commutative90.9%
associate-*l/93.2%
*-commutative93.2%
fma-def93.2%
Simplified93.2%
Taylor expanded in x around 0 69.1%
Final simplification62.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -4e+234) (not (<= (/ x y) 5e+30))) (* (/ x y) t) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -4e+234) || !((x / y) <= 5e+30)) {
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) <= (-4d+234)) .or. (.not. ((x / y) <= 5d+30))) 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) <= -4e+234) || !((x / y) <= 5e+30)) {
tmp = (x / y) * t;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -4e+234) or not ((x / y) <= 5e+30): tmp = (x / y) * t else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -4e+234) || !(Float64(x / y) <= 5e+30)) 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) <= -4e+234) || ~(((x / y) <= 5e+30))) tmp = (x / y) * t; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -4e+234], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e+30]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{+234} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{+30}\right):\\
\;\;\;\;\frac{x}{y} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -4.00000000000000007e234 or 4.9999999999999998e30 < (/.f64 x y) Initial program 96.3%
associate-*l/95.1%
*-commutative95.1%
associate-*l/96.5%
*-commutative96.5%
fma-def96.5%
Simplified96.5%
Taylor expanded in z around 0 47.3%
mul-1-neg47.3%
unsub-neg47.3%
associate-/l*52.8%
associate-/r/47.5%
Simplified47.5%
Taylor expanded in t around 0 47.3%
associate-*r/52.1%
Simplified52.1%
Taylor expanded in x around inf 47.3%
associate-*l/47.5%
associate-*r*47.5%
neg-mul-147.5%
*-commutative47.5%
*-rgt-identity47.5%
*-commutative47.5%
metadata-eval47.5%
times-frac47.5%
neg-mul-147.5%
neg-mul-147.5%
distribute-frac-neg47.5%
remove-double-neg47.5%
Simplified47.5%
expm1-log1p-u20.1%
expm1-udef20.1%
log1p-udef20.1%
add-exp-log47.5%
add-sqr-sqrt14.2%
sqrt-unprod22.6%
sqr-neg22.6%
sqrt-unprod8.4%
add-sqr-sqrt14.3%
Applied egg-rr14.3%
+-commutative14.3%
associate--l+14.4%
metadata-eval14.4%
+-rgt-identity14.4%
*-commutative14.4%
associate-*l/16.5%
associate-*r/16.6%
Simplified16.6%
if -4.00000000000000007e234 < (/.f64 x y) < 4.9999999999999998e30Initial program 97.8%
associate-*l/92.2%
*-commutative92.2%
associate-*l/92.4%
*-commutative92.4%
fma-def92.4%
Simplified92.4%
Taylor expanded in x around 0 55.6%
Final simplification43.4%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -4e+234) (* (/ x y) t) (if (<= (/ x y) 1e-9) t (/ (* x t) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -4e+234) {
tmp = (x / y) * t;
} else if ((x / y) <= 1e-9) {
tmp = t;
} else {
tmp = (x * 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 ((x / y) <= (-4d+234)) then
tmp = (x / y) * t
else if ((x / y) <= 1d-9) then
tmp = t
else
tmp = (x * t) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -4e+234) {
tmp = (x / y) * t;
} else if ((x / y) <= 1e-9) {
tmp = t;
} else {
tmp = (x * t) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -4e+234: tmp = (x / y) * t elif (x / y) <= 1e-9: tmp = t else: tmp = (x * t) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -4e+234) tmp = Float64(Float64(x / y) * t); elseif (Float64(x / y) <= 1e-9) tmp = t; else tmp = Float64(Float64(x * t) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -4e+234) tmp = (x / y) * t; elseif ((x / y) <= 1e-9) tmp = t; else tmp = (x * t) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -4e+234], N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e-9], t, N[(N[(x * t), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{+234}:\\
\;\;\;\;\frac{x}{y} \cdot t\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-9}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot t}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -4.00000000000000007e234Initial program 89.5%
associate-*l/99.8%
*-commutative99.8%
associate-*l/99.9%
*-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around 0 56.1%
mul-1-neg56.1%
unsub-neg56.1%
associate-/l*58.4%
associate-/r/56.2%
Simplified56.2%
Taylor expanded in t around 0 56.1%
associate-*r/56.3%
Simplified56.3%
Taylor expanded in x around inf 56.1%
associate-*l/56.2%
associate-*r*56.2%
neg-mul-156.2%
*-commutative56.2%
*-rgt-identity56.2%
*-commutative56.2%
metadata-eval56.2%
times-frac56.2%
neg-mul-156.2%
neg-mul-156.2%
distribute-frac-neg56.2%
remove-double-neg56.2%
Simplified56.2%
expm1-log1p-u35.9%
expm1-udef35.9%
log1p-udef35.9%
add-exp-log56.2%
add-sqr-sqrt19.1%
sqrt-unprod34.1%
sqr-neg34.1%
sqrt-unprod8.5%
add-sqr-sqrt16.5%
Applied egg-rr16.5%
+-commutative16.5%
associate--l+16.5%
metadata-eval16.5%
+-rgt-identity16.5%
*-commutative16.5%
associate-*l/16.5%
associate-*r/23.1%
Simplified23.1%
if -4.00000000000000007e234 < (/.f64 x y) < 1.00000000000000006e-9Initial program 97.7%
associate-*l/92.5%
*-commutative92.5%
associate-*l/92.2%
*-commutative92.2%
fma-def92.2%
Simplified92.2%
Taylor expanded in x around 0 57.5%
if 1.00000000000000006e-9 < (/.f64 x y) Initial program 99.8%
associate-*l/91.8%
*-commutative91.8%
associate-*l/95.2%
*-commutative95.2%
fma-def95.2%
Simplified95.2%
Taylor expanded in z around 0 41.9%
mul-1-neg41.9%
unsub-neg41.9%
associate-/l*48.5%
associate-/r/42.2%
Simplified42.2%
Taylor expanded in t around 0 41.9%
associate-*r/48.5%
Simplified48.5%
Taylor expanded in x around inf 41.9%
associate-*l/42.2%
associate-*r*42.2%
neg-mul-142.2%
*-commutative42.2%
*-rgt-identity42.2%
*-commutative42.2%
metadata-eval42.2%
times-frac42.2%
neg-mul-142.2%
neg-mul-142.2%
distribute-frac-neg42.2%
remove-double-neg42.2%
Simplified42.2%
associate-*r/41.9%
add-sqr-sqrt9.1%
sqrt-unprod13.7%
sqr-neg13.7%
sqrt-unprod7.8%
add-sqr-sqrt15.2%
Applied egg-rr15.2%
Final simplification44.1%
(FPCore (x y z t) :precision binary64 (if (<= z -15200.0) (+ t (/ z (/ y x))) (if (<= z 1.1) (- t (* (/ x y) t)) (+ t (* (/ x y) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -15200.0) {
tmp = t + (z / (y / x));
} else if (z <= 1.1) {
tmp = t - ((x / y) * t);
} 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 (z <= (-15200.0d0)) then
tmp = t + (z / (y / x))
else if (z <= 1.1d0) then
tmp = t - ((x / y) * t)
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 (z <= -15200.0) {
tmp = t + (z / (y / x));
} else if (z <= 1.1) {
tmp = t - ((x / y) * t);
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -15200.0: tmp = t + (z / (y / x)) elif z <= 1.1: tmp = t - ((x / y) * t) else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -15200.0) tmp = Float64(t + Float64(z / Float64(y / x))); elseif (z <= 1.1) tmp = Float64(t - Float64(Float64(x / y) * t)); else tmp = Float64(t + Float64(Float64(x / y) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -15200.0) tmp = t + (z / (y / x)); elseif (z <= 1.1) tmp = t - ((x / y) * t); else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -15200.0], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.1], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -15200:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{elif}\;z \leq 1.1:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if z < -15200Initial program 96.1%
Taylor expanded in z around inf 86.6%
associate-/l*88.1%
Simplified88.1%
if -15200 < z < 1.1000000000000001Initial program 97.5%
associate-*l/95.1%
*-commutative95.1%
associate-*l/95.4%
*-commutative95.4%
fma-def95.4%
Simplified95.4%
Taylor expanded in z around 0 82.3%
mul-1-neg82.3%
unsub-neg82.3%
associate-/l*86.8%
associate-/r/83.9%
Simplified83.9%
Taylor expanded in t around 0 82.3%
associate-*r/86.3%
Simplified86.3%
if 1.1000000000000001 < z Initial program 98.4%
Taylor expanded in z around inf 89.9%
associate-/l*94.6%
Simplified94.6%
clear-num94.5%
associate-/r/94.6%
clear-num94.7%
Applied egg-rr94.7%
Final simplification88.8%
(FPCore (x y z t) :precision binary64 (if (<= z -8000.0) (+ t (/ z (/ y x))) (if (<= z 61000.0) (- t (/ t (/ y x))) (+ t (* (/ x y) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8000.0) {
tmp = t + (z / (y / x));
} else if (z <= 61000.0) {
tmp = t - (t / (y / x));
} 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 (z <= (-8000.0d0)) then
tmp = t + (z / (y / x))
else if (z <= 61000.0d0) then
tmp = t - (t / (y / x))
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 (z <= -8000.0) {
tmp = t + (z / (y / x));
} else if (z <= 61000.0) {
tmp = t - (t / (y / x));
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -8000.0: tmp = t + (z / (y / x)) elif z <= 61000.0: tmp = t - (t / (y / x)) else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -8000.0) tmp = Float64(t + Float64(z / Float64(y / x))); elseif (z <= 61000.0) tmp = Float64(t - Float64(t / Float64(y / x))); else tmp = Float64(t + Float64(Float64(x / y) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -8000.0) tmp = t + (z / (y / x)); elseif (z <= 61000.0) tmp = t - (t / (y / x)); else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -8000.0], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 61000.0], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8000:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{elif}\;z \leq 61000:\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if z < -8e3Initial program 96.1%
Taylor expanded in z around inf 86.6%
associate-/l*88.1%
Simplified88.1%
if -8e3 < z < 61000Initial program 97.5%
associate-*l/95.1%
*-commutative95.1%
associate-*l/95.4%
*-commutative95.4%
fma-def95.4%
Simplified95.4%
Taylor expanded in z around 0 82.3%
mul-1-neg82.3%
unsub-neg82.3%
associate-/l*86.8%
associate-/r/83.9%
Simplified83.9%
associate-/r/86.8%
Applied egg-rr86.8%
if 61000 < z Initial program 98.4%
Taylor expanded in z around inf 89.9%
associate-/l*94.6%
Simplified94.6%
clear-num94.5%
associate-/r/94.6%
clear-num94.7%
Applied egg-rr94.7%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (+ t (* (/ x y) z)))
double code(double x, double y, double z, double t) {
return t + ((x / y) * z);
}
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)
end function
public static double code(double x, double y, double z, double t) {
return t + ((x / y) * z);
}
def code(x, y, z, t): return t + ((x / y) * z)
function code(x, y, z, t) return Float64(t + Float64(Float64(x / y) * z)) end
function tmp = code(x, y, z, t) tmp = t + ((x / y) * z); end
code[x_, y_, z_, t_] := N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \frac{x}{y} \cdot z
\end{array}
Initial program 97.3%
Taylor expanded in z around inf 78.5%
associate-/l*80.5%
Simplified80.5%
clear-num80.4%
associate-/r/80.4%
clear-num80.5%
Applied egg-rr80.5%
Final simplification80.5%
(FPCore (x y z t) :precision binary64 (+ t (/ z (/ y x))))
double code(double x, double y, double z, double t) {
return t + (z / (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 / (y / x))
end function
public static double code(double x, double y, double z, double t) {
return t + (z / (y / x));
}
def code(x, y, z, t): return t + (z / (y / x))
function code(x, y, z, t) return Float64(t + Float64(z / Float64(y / x))) end
function tmp = code(x, y, z, t) tmp = t + (z / (y / x)); end
code[x_, y_, z_, t_] := N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \frac{z}{\frac{y}{x}}
\end{array}
Initial program 97.3%
Taylor expanded in z around inf 78.5%
associate-/l*80.5%
Simplified80.5%
Final simplification80.5%
(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.3%
associate-*l/93.2%
*-commutative93.2%
associate-*l/93.7%
*-commutative93.7%
fma-def93.7%
Simplified93.7%
Taylor expanded in x around 0 38.9%
Final simplification38.9%
(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 2023230
(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))