
(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 11 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 (fma (/ x y) (- z t) t))
double code(double x, double y, double z, double t) {
return fma((x / y), (z - t), t);
}
function code(x, y, z, t) return fma(Float64(x / y), Float64(z - t), t) end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)
\end{array}
Initial program 98.8%
fma-def98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -2e+151)
(* (/ x y) (- t))
(if (or (<= (/ x y) 0.0002) (not (<= (/ x y) 2e+67)))
(+ t (* (/ x y) z))
(/ t (/ (- y) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2e+151) {
tmp = (x / y) * -t;
} else if (((x / y) <= 0.0002) || !((x / y) <= 2e+67)) {
tmp = t + ((x / y) * z);
} 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) <= (-2d+151)) then
tmp = (x / y) * -t
else if (((x / y) <= 0.0002d0) .or. (.not. ((x / y) <= 2d+67))) then
tmp = t + ((x / y) * z)
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) <= -2e+151) {
tmp = (x / y) * -t;
} else if (((x / y) <= 0.0002) || !((x / y) <= 2e+67)) {
tmp = t + ((x / y) * z);
} else {
tmp = t / (-y / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2e+151: tmp = (x / y) * -t elif ((x / y) <= 0.0002) or not ((x / y) <= 2e+67): tmp = t + ((x / y) * z) else: tmp = t / (-y / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2e+151) tmp = Float64(Float64(x / y) * Float64(-t)); elseif ((Float64(x / y) <= 0.0002) || !(Float64(x / y) <= 2e+67)) tmp = Float64(t + Float64(Float64(x / y) * z)); 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) <= -2e+151) tmp = (x / y) * -t; elseif (((x / y) <= 0.0002) || ~(((x / y) <= 2e+67))) tmp = t + ((x / y) * z); else tmp = t / (-y / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2e+151], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], If[Or[LessEqual[N[(x / y), $MachinePrecision], 0.0002], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e+67]], $MachinePrecision]], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(t / N[((-y) / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+151}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{elif}\;\frac{x}{y} \leq 0.0002 \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+67}\right):\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{-y}{x}}\\
\end{array}
\end{array}
if (/.f64 x y) < -2.00000000000000003e151Initial program 97.5%
associate-*l/97.5%
*-commutative97.5%
associate-*l/97.5%
*-commutative97.5%
fma-def97.5%
Simplified97.5%
Taylor expanded in z around 0 58.6%
mul-1-neg58.6%
unsub-neg58.6%
associate-/l*61.1%
associate-/r/58.6%
Simplified58.6%
associate-*l/58.6%
associate-/l*61.1%
Applied egg-rr61.1%
Taylor expanded in y around 0 58.6%
mul-1-neg58.6%
associate-*r/61.1%
distribute-rgt-neg-in61.1%
distribute-neg-frac61.1%
neg-mul-161.1%
metadata-eval61.1%
associate-/r/61.1%
associate-/r*61.0%
associate-*l/61.0%
neg-mul-161.0%
associate-*r/61.1%
*-rgt-identity61.1%
associate-/r/58.6%
*-commutative58.6%
Simplified58.6%
Taylor expanded in x around 0 58.6%
associate-*r/61.1%
associate-*r*61.1%
neg-mul-161.1%
Simplified61.1%
if -2.00000000000000003e151 < (/.f64 x y) < 2.0000000000000001e-4 or 1.99999999999999997e67 < (/.f64 x y) Initial program 99.0%
Taylor expanded in z around inf 83.8%
associate-/l*88.1%
Simplified88.1%
clear-num88.1%
associate-/r/88.1%
clear-num88.1%
Applied egg-rr88.1%
if 2.0000000000000001e-4 < (/.f64 x y) < 1.99999999999999997e67Initial program 99.6%
associate-*l/88.2%
*-commutative88.2%
associate-*l/88.0%
*-commutative88.0%
fma-def88.0%
Simplified88.0%
Taylor expanded in z around 0 63.8%
mul-1-neg63.8%
unsub-neg63.8%
associate-/l*69.6%
associate-/r/63.9%
Simplified63.9%
associate-*l/63.8%
associate-/l*69.6%
Applied egg-rr69.6%
Taylor expanded in y around 0 61.5%
mul-1-neg61.5%
associate-*r/63.9%
distribute-rgt-neg-in63.9%
distribute-neg-frac63.9%
neg-mul-163.9%
metadata-eval63.9%
associate-/r/63.9%
associate-/r*63.9%
associate-*l/63.8%
neg-mul-163.8%
associate-*r/64.0%
*-rgt-identity64.0%
associate-/r/58.4%
*-commutative58.4%
Simplified58.4%
associate-*r/61.5%
remove-double-neg61.5%
distribute-rgt-neg-out61.5%
neg-mul-161.5%
associate-/r*61.5%
distribute-rgt-neg-out61.5%
remove-double-neg61.5%
Applied egg-rr61.5%
associate-/l/61.5%
*-commutative61.5%
associate-/l*64.0%
*-commutative64.0%
neg-mul-164.0%
Simplified64.0%
Final simplification82.6%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -2e+151)
(* (/ x y) (- t))
(if (<= (/ x y) 0.0002)
(+ t (/ z (/ y x)))
(if (<= (/ x y) 2e+67) (/ t (/ (- y) x)) (+ t (* (/ x y) z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2e+151) {
tmp = (x / y) * -t;
} else if ((x / y) <= 0.0002) {
tmp = t + (z / (y / x));
} else if ((x / y) <= 2e+67) {
tmp = 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 ((x / y) <= (-2d+151)) then
tmp = (x / y) * -t
else if ((x / y) <= 0.0002d0) then
tmp = t + (z / (y / x))
else if ((x / y) <= 2d+67) then
tmp = 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 ((x / y) <= -2e+151) {
tmp = (x / y) * -t;
} else if ((x / y) <= 0.0002) {
tmp = t + (z / (y / x));
} else if ((x / y) <= 2e+67) {
tmp = t / (-y / x);
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2e+151: tmp = (x / y) * -t elif (x / y) <= 0.0002: tmp = t + (z / (y / x)) elif (x / y) <= 2e+67: tmp = t / (-y / x) else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2e+151) tmp = Float64(Float64(x / y) * Float64(-t)); elseif (Float64(x / y) <= 0.0002) tmp = Float64(t + Float64(z / Float64(y / x))); elseif (Float64(x / y) <= 2e+67) tmp = Float64(t / Float64(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 ((x / y) <= -2e+151) tmp = (x / y) * -t; elseif ((x / y) <= 0.0002) tmp = t + (z / (y / x)); elseif ((x / y) <= 2e+67) tmp = t / (-y / x); else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2e+151], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 0.0002], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e+67], N[(t / N[((-y) / x), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+151}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{elif}\;\frac{x}{y} \leq 0.0002:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+67}:\\
\;\;\;\;\frac{t}{\frac{-y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if (/.f64 x y) < -2.00000000000000003e151Initial program 97.5%
associate-*l/97.5%
*-commutative97.5%
associate-*l/97.5%
*-commutative97.5%
fma-def97.5%
Simplified97.5%
Taylor expanded in z around 0 58.6%
mul-1-neg58.6%
unsub-neg58.6%
associate-/l*61.1%
associate-/r/58.6%
Simplified58.6%
associate-*l/58.6%
associate-/l*61.1%
Applied egg-rr61.1%
Taylor expanded in y around 0 58.6%
mul-1-neg58.6%
associate-*r/61.1%
distribute-rgt-neg-in61.1%
distribute-neg-frac61.1%
neg-mul-161.1%
metadata-eval61.1%
associate-/r/61.1%
associate-/r*61.0%
associate-*l/61.0%
neg-mul-161.0%
associate-*r/61.1%
*-rgt-identity61.1%
associate-/r/58.6%
*-commutative58.6%
Simplified58.6%
Taylor expanded in x around 0 58.6%
associate-*r/61.1%
associate-*r*61.1%
neg-mul-161.1%
Simplified61.1%
if -2.00000000000000003e151 < (/.f64 x y) < 2.0000000000000001e-4Initial program 99.3%
Taylor expanded in z around inf 90.1%
associate-/l*94.7%
Simplified94.7%
if 2.0000000000000001e-4 < (/.f64 x y) < 1.99999999999999997e67Initial program 99.6%
associate-*l/88.2%
*-commutative88.2%
associate-*l/88.0%
*-commutative88.0%
fma-def88.0%
Simplified88.0%
Taylor expanded in z around 0 63.8%
mul-1-neg63.8%
unsub-neg63.8%
associate-/l*69.6%
associate-/r/63.9%
Simplified63.9%
associate-*l/63.8%
associate-/l*69.6%
Applied egg-rr69.6%
Taylor expanded in y around 0 61.5%
mul-1-neg61.5%
associate-*r/63.9%
distribute-rgt-neg-in63.9%
distribute-neg-frac63.9%
neg-mul-163.9%
metadata-eval63.9%
associate-/r/63.9%
associate-/r*63.9%
associate-*l/63.8%
neg-mul-163.8%
associate-*r/64.0%
*-rgt-identity64.0%
associate-/r/58.4%
*-commutative58.4%
Simplified58.4%
associate-*r/61.5%
remove-double-neg61.5%
distribute-rgt-neg-out61.5%
neg-mul-161.5%
associate-/r*61.5%
distribute-rgt-neg-out61.5%
remove-double-neg61.5%
Applied egg-rr61.5%
associate-/l/61.5%
*-commutative61.5%
associate-/l*64.0%
*-commutative64.0%
neg-mul-164.0%
Simplified64.0%
if 1.99999999999999997e67 < (/.f64 x y) Initial program 98.0%
Taylor expanded in z around inf 63.3%
associate-/l*67.2%
Simplified67.2%
clear-num67.2%
associate-/r/67.2%
clear-num67.2%
Applied egg-rr67.2%
Final simplification82.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e+14) (not (<= (/ x y) 0.0002))) (* x (/ t (- y))) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+14) || !((x / y) <= 0.0002)) {
tmp = x * (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 (((x / y) <= (-2d+14)) .or. (.not. ((x / y) <= 0.0002d0))) then
tmp = x * (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 (((x / y) <= -2e+14) || !((x / y) <= 0.0002)) {
tmp = x * (t / -y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e+14) or not ((x / y) <= 0.0002): tmp = x * (t / -y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2e+14) || !(Float64(x / y) <= 0.0002)) tmp = Float64(x * Float64(t / Float64(-y))); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2e+14) || ~(((x / y) <= 0.0002))) tmp = x * (t / -y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2e+14], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.0002]], $MachinePrecision]], N[(x * N[(t / (-y)), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+14} \lor \neg \left(\frac{x}{y} \leq 0.0002\right):\\
\;\;\;\;x \cdot \frac{t}{-y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -2e14 or 2.0000000000000001e-4 < (/.f64 x y) Initial program 98.4%
associate-*l/94.7%
*-commutative94.7%
associate-*l/94.6%
*-commutative94.6%
fma-def94.6%
Simplified94.6%
Taylor expanded in z around 0 47.7%
mul-1-neg47.7%
unsub-neg47.7%
associate-/l*52.1%
associate-/r/48.4%
Simplified48.4%
associate-*l/47.7%
associate-/l*52.1%
Applied egg-rr52.1%
Taylor expanded in y around 0 47.4%
mul-1-neg47.4%
associate-*r/51.4%
distribute-rgt-neg-in51.4%
distribute-neg-frac51.4%
neg-mul-151.4%
metadata-eval51.4%
associate-/r/51.4%
associate-/r*51.3%
associate-*l/51.3%
neg-mul-151.3%
associate-*r/51.4%
*-rgt-identity51.4%
associate-/r/47.7%
*-commutative47.7%
Simplified47.7%
if -2e14 < (/.f64 x y) < 2.0000000000000001e-4Initial program 99.2%
associate-*l/91.5%
*-commutative91.5%
associate-*l/90.4%
*-commutative90.4%
fma-def90.4%
Simplified90.4%
Taylor expanded in x around 0 73.5%
Final simplification60.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e+14) (not (<= (/ x y) 0.0002))) (* (/ x y) (- t)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+14) || !((x / y) <= 0.0002)) {
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) <= (-2d+14)) .or. (.not. ((x / y) <= 0.0002d0))) 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) <= -2e+14) || !((x / y) <= 0.0002)) {
tmp = (x / y) * -t;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e+14) or not ((x / y) <= 0.0002): tmp = (x / y) * -t else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2e+14) || !(Float64(x / y) <= 0.0002)) 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) <= -2e+14) || ~(((x / y) <= 0.0002))) tmp = (x / y) * -t; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2e+14], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.0002]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+14} \lor \neg \left(\frac{x}{y} \leq 0.0002\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -2e14 or 2.0000000000000001e-4 < (/.f64 x y) Initial program 98.4%
associate-*l/94.7%
*-commutative94.7%
associate-*l/94.6%
*-commutative94.6%
fma-def94.6%
Simplified94.6%
Taylor expanded in z around 0 47.7%
mul-1-neg47.7%
unsub-neg47.7%
associate-/l*52.1%
associate-/r/48.4%
Simplified48.4%
associate-*l/47.7%
associate-/l*52.1%
Applied egg-rr52.1%
Taylor expanded in y around 0 47.4%
mul-1-neg47.4%
associate-*r/51.4%
distribute-rgt-neg-in51.4%
distribute-neg-frac51.4%
neg-mul-151.4%
metadata-eval51.4%
associate-/r/51.4%
associate-/r*51.3%
associate-*l/51.3%
neg-mul-151.3%
associate-*r/51.4%
*-rgt-identity51.4%
associate-/r/47.7%
*-commutative47.7%
Simplified47.7%
Taylor expanded in x around 0 47.4%
associate-*r/51.4%
associate-*r*51.4%
neg-mul-151.4%
Simplified51.4%
if -2e14 < (/.f64 x y) < 2.0000000000000001e-4Initial program 99.2%
associate-*l/91.5%
*-commutative91.5%
associate-*l/90.4%
*-commutative90.4%
fma-def90.4%
Simplified90.4%
Taylor expanded in x around 0 73.5%
Final simplification62.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e+14) (not (<= (/ x y) 0.0002))) (/ t (/ (- y) x)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+14) || !((x / y) <= 0.0002)) {
tmp = t / (-y / x);
} 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+14)) .or. (.not. ((x / y) <= 0.0002d0))) then
tmp = t / (-y / x)
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+14) || !((x / y) <= 0.0002)) {
tmp = t / (-y / x);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e+14) or not ((x / y) <= 0.0002): tmp = t / (-y / x) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2e+14) || !(Float64(x / y) <= 0.0002)) tmp = Float64(t / Float64(Float64(-y) / x)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2e+14) || ~(((x / y) <= 0.0002))) tmp = t / (-y / x); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2e+14], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.0002]], $MachinePrecision]], N[(t / N[((-y) / x), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+14} \lor \neg \left(\frac{x}{y} \leq 0.0002\right):\\
\;\;\;\;\frac{t}{\frac{-y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -2e14 or 2.0000000000000001e-4 < (/.f64 x y) Initial program 98.4%
associate-*l/94.7%
*-commutative94.7%
associate-*l/94.6%
*-commutative94.6%
fma-def94.6%
Simplified94.6%
Taylor expanded in z around 0 47.7%
mul-1-neg47.7%
unsub-neg47.7%
associate-/l*52.1%
associate-/r/48.4%
Simplified48.4%
associate-*l/47.7%
associate-/l*52.1%
Applied egg-rr52.1%
Taylor expanded in y around 0 47.4%
mul-1-neg47.4%
associate-*r/51.4%
distribute-rgt-neg-in51.4%
distribute-neg-frac51.4%
neg-mul-151.4%
metadata-eval51.4%
associate-/r/51.4%
associate-/r*51.3%
associate-*l/51.3%
neg-mul-151.3%
associate-*r/51.4%
*-rgt-identity51.4%
associate-/r/47.7%
*-commutative47.7%
Simplified47.7%
associate-*r/47.4%
remove-double-neg47.4%
distribute-rgt-neg-out47.4%
neg-mul-147.4%
associate-/r*47.4%
distribute-rgt-neg-out47.4%
remove-double-neg47.4%
Applied egg-rr47.4%
associate-/l/47.4%
*-commutative47.4%
associate-/l*51.4%
*-commutative51.4%
neg-mul-151.4%
Simplified51.4%
if -2e14 < (/.f64 x y) < 2.0000000000000001e-4Initial program 99.2%
associate-*l/91.5%
*-commutative91.5%
associate-*l/90.4%
*-commutative90.4%
fma-def90.4%
Simplified90.4%
Taylor expanded in x around 0 73.5%
Final simplification62.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3e-26) (not (<= t 1.4e+93))) (- t (* x (/ t y))) (+ t (/ z (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3e-26) || !(t <= 1.4e+93)) {
tmp = t - (x * (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 ((t <= (-3d-26)) .or. (.not. (t <= 1.4d+93))) then
tmp = t - (x * (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 ((t <= -3e-26) || !(t <= 1.4e+93)) {
tmp = t - (x * (t / y));
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3e-26) or not (t <= 1.4e+93): tmp = t - (x * (t / y)) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3e-26) || !(t <= 1.4e+93)) tmp = Float64(t - Float64(x * 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 ((t <= -3e-26) || ~((t <= 1.4e+93))) tmp = t - (x * (t / y)); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3e-26], N[Not[LessEqual[t, 1.4e+93]], $MachinePrecision]], N[(t - N[(x * N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{-26} \lor \neg \left(t \leq 1.4 \cdot 10^{+93}\right):\\
\;\;\;\;t - x \cdot \frac{t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if t < -3.00000000000000012e-26 or 1.39999999999999994e93 < t Initial program 99.9%
associate-*l/89.4%
*-commutative89.4%
associate-*l/92.9%
*-commutative92.9%
fma-def92.9%
Simplified92.9%
Taylor expanded in z around 0 82.2%
mul-1-neg82.2%
unsub-neg82.2%
associate-/l*91.1%
associate-/r/89.4%
Simplified89.4%
if -3.00000000000000012e-26 < t < 1.39999999999999994e93Initial program 98.0%
Taylor expanded in z around inf 85.6%
associate-/l*88.8%
Simplified88.8%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (if (<= t -1.2e-24) (- t (* x (/ t y))) (if (<= t 440000.0) (+ t (/ z (/ y x))) (- t (/ t (/ y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.2e-24) {
tmp = t - (x * (t / y));
} else if (t <= 440000.0) {
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 (t <= (-1.2d-24)) then
tmp = t - (x * (t / y))
else if (t <= 440000.0d0) 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 (t <= -1.2e-24) {
tmp = t - (x * (t / y));
} else if (t <= 440000.0) {
tmp = t + (z / (y / x));
} else {
tmp = t - (t / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.2e-24: tmp = t - (x * (t / y)) elif t <= 440000.0: tmp = t + (z / (y / x)) else: tmp = t - (t / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.2e-24) tmp = Float64(t - Float64(x * Float64(t / y))); elseif (t <= 440000.0) 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 (t <= -1.2e-24) tmp = t - (x * (t / y)); elseif (t <= 440000.0) tmp = t + (z / (y / x)); else tmp = t - (t / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.2e-24], N[(t - N[(x * N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 440000.0], 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}\;t \leq -1.2 \cdot 10^{-24}:\\
\;\;\;\;t - x \cdot \frac{t}{y}\\
\mathbf{elif}\;t \leq 440000:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\end{array}
\end{array}
if t < -1.1999999999999999e-24Initial program 100.0%
associate-*l/88.2%
*-commutative88.2%
associate-*l/97.0%
*-commutative97.0%
fma-def97.0%
Simplified97.0%
Taylor expanded in z around 0 81.4%
mul-1-neg81.4%
unsub-neg81.4%
associate-/l*91.7%
associate-/r/93.1%
Simplified93.1%
if -1.1999999999999999e-24 < t < 4.4e5Initial program 97.8%
Taylor expanded in z around inf 87.8%
associate-/l*90.6%
Simplified90.6%
if 4.4e5 < t Initial program 99.9%
associate-*l/93.2%
*-commutative93.2%
associate-*l/88.4%
*-commutative88.4%
fma-def88.4%
Simplified88.4%
Taylor expanded in z around 0 81.7%
mul-1-neg81.7%
unsub-neg81.7%
associate-/l*86.8%
associate-/r/80.3%
Simplified80.3%
associate-*l/81.7%
associate-/l*86.8%
Applied egg-rr86.8%
Final simplification90.4%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -1e+239) (* (/ x y) t) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1e+239) {
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) <= (-1d+239)) 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) <= -1e+239) {
tmp = (x / y) * t;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1e+239: tmp = (x / y) * t else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -1e+239) 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) <= -1e+239) tmp = (x / y) * t; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -1e+239], N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+239}:\\
\;\;\;\;\frac{x}{y} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -9.99999999999999991e238Initial program 96.1%
associate-*l/99.9%
*-commutative99.9%
associate-*l/99.9%
*-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around 0 50.3%
mul-1-neg50.3%
unsub-neg50.3%
associate-/l*50.3%
associate-/r/50.2%
Simplified50.2%
associate-*l/50.3%
associate-/l*50.3%
Applied egg-rr50.3%
Taylor expanded in y around 0 50.3%
associate-*r/50.3%
*-commutative50.3%
neg-mul-150.3%
distribute-rgt-neg-in50.3%
Simplified50.3%
associate-/l*50.3%
associate-/r/50.3%
add-sqr-sqrt25.3%
sqrt-unprod42.3%
sqr-neg42.3%
sqrt-unprod25.2%
add-sqr-sqrt30.0%
Applied egg-rr30.0%
if -9.99999999999999991e238 < (/.f64 x y) Initial program 99.1%
associate-*l/92.3%
*-commutative92.3%
associate-*l/91.7%
*-commutative91.7%
fma-def91.7%
Simplified91.7%
Taylor expanded in x around 0 42.3%
Final simplification41.2%
(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 98.8%
Final simplification98.8%
(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.8%
associate-*l/93.1%
*-commutative93.1%
associate-*l/92.5%
*-commutative92.5%
fma-def92.5%
Simplified92.5%
Taylor expanded in x around 0 38.6%
Final simplification38.6%
(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 2023185
(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))