
(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 (if (<= (/ x y) -5e+98) (+ t (* x (/ (- z t) y))) (fma (/ x y) (- z t) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+98) {
tmp = t + (x * ((z - t) / y));
} else {
tmp = fma((x / y), (z - t), t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+98) tmp = Float64(t + Float64(x * Float64(Float64(z - t) / y))); else tmp = fma(Float64(x / y), Float64(z - t), t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+98], N[(t + N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+98}:\\
\;\;\;\;t + x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -4.9999999999999998e98Initial program 88.6%
Taylor expanded in x around 0 97.6%
associate-*r/99.8%
Simplified99.8%
if -4.9999999999999998e98 < (/.f64 x y) Initial program 98.6%
fma-def98.6%
Simplified98.6%
Final simplification98.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2000.0) (not (<= (/ x y) 1.5))) (* (/ x y) (- t)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2000.0) || !((x / y) <= 1.5)) {
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) <= (-2000.0d0)) .or. (.not. ((x / y) <= 1.5d0))) 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) <= -2000.0) || !((x / y) <= 1.5)) {
tmp = (x / y) * -t;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2000.0) or not ((x / y) <= 1.5): tmp = (x / y) * -t else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2000.0) || !(Float64(x / y) <= 1.5)) 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) <= -2000.0) || ~(((x / y) <= 1.5))) tmp = (x / y) * -t; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1.5]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2000 \lor \neg \left(\frac{x}{y} \leq 1.5\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -2e3 or 1.5 < (/.f64 x y) Initial program 95.1%
Taylor expanded in t around inf 52.2%
Taylor expanded in x around inf 51.1%
associate-*r/51.1%
neg-mul-151.1%
Simplified51.1%
if -2e3 < (/.f64 x y) < 1.5Initial program 98.6%
Taylor expanded in x around 0 79.1%
Final simplification66.3%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -2000.0) (* (/ t y) (- x)) (if (<= (/ x y) 1.5) t (* (/ x y) (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2000.0) {
tmp = (t / y) * -x;
} else if ((x / y) <= 1.5) {
tmp = t;
} else {
tmp = (x / y) * -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) <= (-2000.0d0)) then
tmp = (t / y) * -x
else if ((x / y) <= 1.5d0) then
tmp = t
else
tmp = (x / y) * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2000.0) {
tmp = (t / y) * -x;
} else if ((x / y) <= 1.5) {
tmp = t;
} else {
tmp = (x / y) * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2000.0: tmp = (t / y) * -x elif (x / y) <= 1.5: tmp = t else: tmp = (x / y) * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2000.0) tmp = Float64(Float64(t / y) * Float64(-x)); elseif (Float64(x / y) <= 1.5) tmp = t; else tmp = Float64(Float64(x / y) * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -2000.0) tmp = (t / y) * -x; elseif ((x / y) <= 1.5) tmp = t; else tmp = (x / y) * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2000.0], N[(N[(t / y), $MachinePrecision] * (-x)), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.5], t, N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2000:\\
\;\;\;\;\frac{t}{y} \cdot \left(-x\right)\\
\mathbf{elif}\;\frac{x}{y} \leq 1.5:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -2e3Initial program 92.7%
Taylor expanded in t around inf 46.3%
Taylor expanded in x around inf 45.6%
associate-*r/45.6%
neg-mul-145.6%
Simplified45.6%
clear-num45.5%
un-div-inv45.5%
add-sqr-sqrt15.8%
sqrt-unprod15.6%
sqr-neg15.6%
sqrt-unprod2.6%
add-sqr-sqrt8.0%
Applied egg-rr8.0%
frac-2neg8.0%
associate-/r/3.9%
add-sqr-sqrt2.7%
sqrt-unprod13.4%
sqr-neg13.4%
sqrt-unprod15.6%
add-sqr-sqrt46.5%
Applied egg-rr46.5%
if -2e3 < (/.f64 x y) < 1.5Initial program 98.6%
Taylor expanded in x around 0 79.1%
if 1.5 < (/.f64 x y) Initial program 98.1%
Taylor expanded in t around inf 59.5%
Taylor expanded in x around inf 58.0%
associate-*r/58.0%
neg-mul-158.0%
Simplified58.0%
Final simplification66.5%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e+98) (+ t (* x (/ (- z t) y))) (+ t (* (/ x y) (- z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+98) {
tmp = t + (x * ((z - t) / y));
} else {
tmp = t + ((x / y) * (z - 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+98)) then
tmp = t + (x * ((z - t) / y))
else
tmp = t + ((x / y) * (z - 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+98) {
tmp = t + (x * ((z - t) / y));
} else {
tmp = t + ((x / y) * (z - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+98: tmp = t + (x * ((z - t) / y)) else: tmp = t + ((x / y) * (z - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+98) tmp = Float64(t + Float64(x * Float64(Float64(z - t) / y))); else tmp = Float64(t + Float64(Float64(x / y) * Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e+98) tmp = t + (x * ((z - t) / y)); else tmp = t + ((x / y) * (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+98], N[(t + N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+98}:\\
\;\;\;\;t + x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -4.9999999999999998e98Initial program 88.6%
Taylor expanded in x around 0 97.6%
associate-*r/99.8%
Simplified99.8%
if -4.9999999999999998e98 < (/.f64 x y) Initial program 98.6%
Final simplification98.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.5e-30) (not (<= z 6.5e-170))) (+ t (* (/ x y) z)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.5e-30) || !(z <= 6.5e-170)) {
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 <= (-6.5d-30)) .or. (.not. (z <= 6.5d-170))) 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 <= -6.5e-30) || !(z <= 6.5e-170)) {
tmp = t + ((x / y) * z);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.5e-30) or not (z <= 6.5e-170): 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 <= -6.5e-30) || !(z <= 6.5e-170)) 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 <= -6.5e-30) || ~((z <= 6.5e-170))) 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, -6.5e-30], N[Not[LessEqual[z, 6.5e-170]], $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 -6.5 \cdot 10^{-30} \lor \neg \left(z \leq 6.5 \cdot 10^{-170}\right):\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -6.5000000000000005e-30 or 6.50000000000000035e-170 < z Initial program 97.0%
Taylor expanded in z around inf 78.9%
associate-*l/85.1%
*-commutative85.1%
Simplified85.1%
if -6.5000000000000005e-30 < z < 6.50000000000000035e-170Initial program 97.1%
Taylor expanded in z around 0 90.9%
mul-1-neg90.9%
unsub-neg90.9%
associate-/l*90.1%
associate-/r/84.9%
Simplified84.9%
Taylor expanded in t around 0 90.2%
Final simplification87.1%
(FPCore (x y z t) :precision binary64 (if (<= z -4.9e-32) (+ t (* (/ x y) z)) (if (<= z 1.9e-170) (* t (- 1.0 (/ x y))) (+ t (/ z (/ y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.9e-32) {
tmp = t + ((x / y) * z);
} else if (z <= 1.9e-170) {
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.9d-32)) then
tmp = t + ((x / y) * z)
else if (z <= 1.9d-170) 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.9e-32) {
tmp = t + ((x / y) * z);
} else if (z <= 1.9e-170) {
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.9e-32: tmp = t + ((x / y) * z) elif z <= 1.9e-170: 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.9e-32) tmp = Float64(t + Float64(Float64(x / y) * z)); elseif (z <= 1.9e-170) 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.9e-32) tmp = t + ((x / y) * z); elseif (z <= 1.9e-170) 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.9e-32], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e-170], 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.9 \cdot 10^{-32}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-170}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if z < -4.8999999999999998e-32Initial program 98.5%
Taylor expanded in z around inf 71.9%
associate-*l/86.9%
*-commutative86.9%
Simplified86.9%
if -4.8999999999999998e-32 < z < 1.8999999999999999e-170Initial program 97.1%
Taylor expanded in z around 0 90.9%
mul-1-neg90.9%
unsub-neg90.9%
associate-/l*90.1%
associate-/r/84.9%
Simplified84.9%
Taylor expanded in t around 0 90.2%
if 1.8999999999999999e-170 < z Initial program 95.9%
Taylor expanded in z around inf 83.9%
*-commutative83.9%
associate-/l*84.2%
Simplified84.2%
Final simplification87.2%
(FPCore (x y z t) :precision binary64 (if (<= t -8.2e+147) (- t (* (/ x y) t)) (+ t (* x (/ (- z t) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.2e+147) {
tmp = t - ((x / y) * t);
} else {
tmp = t + (x * ((z - 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 (t <= (-8.2d+147)) then
tmp = t - ((x / y) * t)
else
tmp = t + (x * ((z - t) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.2e+147) {
tmp = t - ((x / y) * t);
} else {
tmp = t + (x * ((z - t) / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -8.2e+147: tmp = t - ((x / y) * t) else: tmp = t + (x * ((z - t) / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -8.2e+147) tmp = Float64(t - Float64(Float64(x / y) * t)); else tmp = Float64(t + Float64(x * Float64(Float64(z - t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -8.2e+147) tmp = t - ((x / y) * t); else tmp = t + (x * ((z - t) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -8.2e+147], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(t + N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{+147}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z - t}{y}\\
\end{array}
\end{array}
if t < -8.19999999999999932e147Initial program 100.0%
Taylor expanded in z around 0 89.0%
mul-1-neg89.0%
unsub-neg89.0%
associate-*r/97.2%
Simplified97.2%
if -8.19999999999999932e147 < t Initial program 96.5%
Taylor expanded in x around 0 92.6%
associate-*r/95.2%
Simplified95.2%
Final simplification95.5%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e+272) (* (/ x y) t) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+272) {
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+272)) 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+272) {
tmp = (x / y) * t;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+272: tmp = (x / y) * t else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+272) 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+272) tmp = (x / y) * t; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+272], N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+272}:\\
\;\;\;\;\frac{x}{y} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -4.99999999999999973e272Initial program 72.8%
Taylor expanded in t around inf 20.6%
Taylor expanded in x around inf 20.6%
associate-*r/20.6%
neg-mul-120.6%
Simplified20.6%
clear-num20.6%
un-div-inv20.5%
add-sqr-sqrt0.7%
sqrt-unprod12.8%
sqr-neg12.8%
sqrt-unprod6.5%
add-sqr-sqrt24.5%
Applied egg-rr24.5%
clear-num24.5%
associate-/r/30.0%
clear-num30.0%
Applied egg-rr30.0%
if -4.99999999999999973e272 < (/.f64 x y) Initial program 98.7%
Taylor expanded in x around 0 47.2%
Final simplification46.1%
(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.0%
Taylor expanded in z around 0 65.2%
mul-1-neg65.2%
unsub-neg65.2%
associate-/l*67.1%
associate-/r/62.1%
Simplified62.1%
Taylor expanded in t around 0 67.5%
Final simplification67.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.0%
Taylor expanded in x around 0 44.3%
Final simplification44.3%
(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 2023293
(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))