
(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.4%
Final simplification97.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9e-110) (not (<= z 1.7e-18))) (+ t (* (/ x y) z)) (- t (/ (* x t) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-110) || !(z <= 1.7e-18)) {
tmp = t + ((x / y) * z);
} else {
tmp = t - ((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 ((z <= (-9d-110)) .or. (.not. (z <= 1.7d-18))) then
tmp = t + ((x / y) * z)
else
tmp = t - ((x * t) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9e-110) || !(z <= 1.7e-18)) {
tmp = t + ((x / y) * z);
} else {
tmp = t - ((x * t) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9e-110) or not (z <= 1.7e-18): tmp = t + ((x / y) * z) else: tmp = t - ((x * t) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9e-110) || !(z <= 1.7e-18)) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(t - Float64(Float64(x * t) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9e-110) || ~((z <= 1.7e-18))) tmp = t + ((x / y) * z); else tmp = t - ((x * t) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9e-110], N[Not[LessEqual[z, 1.7e-18]], $MachinePrecision]], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(t - N[(N[(x * t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-110} \lor \neg \left(z \leq 1.7 \cdot 10^{-18}\right):\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t - \frac{x \cdot t}{y}\\
\end{array}
\end{array}
if z < -9.0000000000000002e-110 or 1.70000000000000001e-18 < z Initial program 98.1%
Taylor expanded in z around inf 89.6%
if -9.0000000000000002e-110 < z < 1.70000000000000001e-18Initial program 96.4%
Taylor expanded in x around 0 97.2%
associate-*r/92.9%
*-commutative92.9%
associate-/r/96.4%
Simplified96.4%
Taylor expanded in z around 0 88.4%
neg-mul-188.4%
Simplified88.4%
+-commutative88.4%
distribute-frac-neg88.4%
unsub-neg88.4%
div-inv88.4%
clear-num88.4%
Applied egg-rr88.4%
Taylor expanded in t around 0 89.4%
Final simplification89.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.5e-41) (not (<= z 2.35e-14))) (+ t (* (/ x y) z)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.5e-41) || !(z <= 2.35e-14)) {
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 <= (-4.5d-41)) .or. (.not. (z <= 2.35d-14))) 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 <= -4.5e-41) || !(z <= 2.35e-14)) {
tmp = t + ((x / y) * z);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.5e-41) or not (z <= 2.35e-14): 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 <= -4.5e-41) || !(z <= 2.35e-14)) 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 <= -4.5e-41) || ~((z <= 2.35e-14))) 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, -4.5e-41], N[Not[LessEqual[z, 2.35e-14]], $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 -4.5 \cdot 10^{-41} \lor \neg \left(z \leq 2.35 \cdot 10^{-14}\right):\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -4.5e-41 or 2.3500000000000001e-14 < z Initial program 98.6%
Taylor expanded in z around inf 91.6%
if -4.5e-41 < z < 2.3500000000000001e-14Initial program 96.1%
Taylor expanded in z around 0 86.8%
mul-1-neg86.8%
*-rgt-identity86.8%
associate-/l*86.7%
distribute-rgt-neg-in86.7%
mul-1-neg86.7%
distribute-lft-in86.7%
mul-1-neg86.7%
unsub-neg86.7%
Simplified86.7%
Final simplification89.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8e-42) (not (<= z 1.15e-14))) (+ t (* x (/ z y))) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8e-42) || !(z <= 1.15e-14)) {
tmp = t + (x * (z / y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-8d-42)) .or. (.not. (z <= 1.15d-14))) then
tmp = t + (x * (z / y))
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8e-42) || !(z <= 1.15e-14)) {
tmp = t + (x * (z / y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8e-42) or not (z <= 1.15e-14): tmp = t + (x * (z / y)) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8e-42) || !(z <= 1.15e-14)) tmp = Float64(t + Float64(x * Float64(z / y))); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -8e-42) || ~((z <= 1.15e-14))) tmp = t + (x * (z / y)); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8e-42], N[Not[LessEqual[z, 1.15e-14]], $MachinePrecision]], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{-42} \lor \neg \left(z \leq 1.15 \cdot 10^{-14}\right):\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -8.0000000000000003e-42 or 1.14999999999999999e-14 < z Initial program 98.6%
Taylor expanded in z around inf 89.4%
associate-/l*87.5%
Simplified87.5%
if -8.0000000000000003e-42 < z < 1.14999999999999999e-14Initial program 96.1%
Taylor expanded in z around 0 86.8%
mul-1-neg86.8%
*-rgt-identity86.8%
associate-/l*86.7%
distribute-rgt-neg-in86.7%
mul-1-neg86.7%
distribute-lft-in86.7%
mul-1-neg86.7%
unsub-neg86.7%
Simplified86.7%
Final simplification87.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1.5e-39) (+ t (/ z (/ y x))) (if (<= z 1.4e-18) (- t (* (/ x y) t)) (+ t (* (/ x y) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.5e-39) {
tmp = t + (z / (y / x));
} else if (z <= 1.4e-18) {
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 <= (-1.5d-39)) then
tmp = t + (z / (y / x))
else if (z <= 1.4d-18) 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 <= -1.5e-39) {
tmp = t + (z / (y / x));
} else if (z <= 1.4e-18) {
tmp = t - ((x / y) * t);
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.5e-39: tmp = t + (z / (y / x)) elif z <= 1.4e-18: tmp = t - ((x / y) * t) else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.5e-39) tmp = Float64(t + Float64(z / Float64(y / x))); elseif (z <= 1.4e-18) 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 <= -1.5e-39) tmp = t + (z / (y / x)); elseif (z <= 1.4e-18) tmp = t - ((x / y) * t); else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.5e-39], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e-18], 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 -1.5 \cdot 10^{-39}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-18}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if z < -1.50000000000000014e-39Initial program 98.6%
Taylor expanded in x around 0 97.3%
associate-*r/91.1%
*-commutative91.1%
associate-/r/98.6%
Simplified98.6%
Taylor expanded in z around inf 92.1%
associate-*r/88.5%
*-commutative88.5%
associate-/r/93.5%
Simplified93.5%
if -1.50000000000000014e-39 < z < 1.40000000000000006e-18Initial program 96.1%
Taylor expanded in x around 0 96.8%
associate-*r/93.8%
*-commutative93.8%
associate-/r/96.1%
Simplified96.1%
Taylor expanded in z around 0 86.7%
neg-mul-186.7%
Simplified86.7%
+-commutative86.7%
distribute-frac-neg86.7%
unsub-neg86.7%
div-inv86.7%
clear-num86.7%
Applied egg-rr86.7%
if 1.40000000000000006e-18 < z Initial program 98.6%
Taylor expanded in z around inf 89.5%
Final simplification89.3%
(FPCore (x y z t) :precision binary64 (if (<= z -5.2e-40) (+ t (/ z (/ y x))) (if (<= z 5.3e-17) (* t (- 1.0 (/ x y))) (+ t (* (/ x y) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.2e-40) {
tmp = t + (z / (y / x));
} else if (z <= 5.3e-17) {
tmp = t * (1.0 - (x / y));
} 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 <= (-5.2d-40)) then
tmp = t + (z / (y / x))
else if (z <= 5.3d-17) then
tmp = t * (1.0d0 - (x / y))
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 <= -5.2e-40) {
tmp = t + (z / (y / x));
} else if (z <= 5.3e-17) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.2e-40: tmp = t + (z / (y / x)) elif z <= 5.3e-17: tmp = t * (1.0 - (x / y)) else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.2e-40) tmp = Float64(t + Float64(z / Float64(y / x))); elseif (z <= 5.3e-17) tmp = Float64(t * Float64(1.0 - Float64(x / y))); 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 <= -5.2e-40) tmp = t + (z / (y / x)); elseif (z <= 5.3e-17) tmp = t * (1.0 - (x / y)); else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.2e-40], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.3e-17], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-40}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{elif}\;z \leq 5.3 \cdot 10^{-17}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if z < -5.2000000000000003e-40Initial program 98.6%
Taylor expanded in x around 0 97.3%
associate-*r/91.1%
*-commutative91.1%
associate-/r/98.6%
Simplified98.6%
Taylor expanded in z around inf 92.1%
associate-*r/88.5%
*-commutative88.5%
associate-/r/93.5%
Simplified93.5%
if -5.2000000000000003e-40 < z < 5.2999999999999998e-17Initial program 96.1%
Taylor expanded in z around 0 86.8%
mul-1-neg86.8%
*-rgt-identity86.8%
associate-/l*86.7%
distribute-rgt-neg-in86.7%
mul-1-neg86.7%
distribute-lft-in86.7%
mul-1-neg86.7%
unsub-neg86.7%
Simplified86.7%
if 5.2999999999999998e-17 < z Initial program 98.6%
Taylor expanded in z around inf 89.5%
Final simplification89.3%
(FPCore (x y z t) :precision binary64 (if (<= y -1.35e-75) t (if (<= y 2.4e-71) (* (/ x y) (- t)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.35e-75) {
tmp = t;
} else if (y <= 2.4e-71) {
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 (y <= (-1.35d-75)) then
tmp = t
else if (y <= 2.4d-71) 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 (y <= -1.35e-75) {
tmp = t;
} else if (y <= 2.4e-71) {
tmp = (x / y) * -t;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.35e-75: tmp = t elif y <= 2.4e-71: tmp = (x / y) * -t else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.35e-75) tmp = t; elseif (y <= 2.4e-71) 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 (y <= -1.35e-75) tmp = t; elseif (y <= 2.4e-71) tmp = (x / y) * -t; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.35e-75], t, If[LessEqual[y, 2.4e-71], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{-75}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-71}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.3499999999999999e-75 or 2.4e-71 < y Initial program 98.9%
Taylor expanded in x around 0 60.8%
if -1.3499999999999999e-75 < y < 2.4e-71Initial program 94.7%
Taylor expanded in z around 0 53.0%
mul-1-neg53.0%
*-rgt-identity53.0%
associate-/l*50.9%
distribute-rgt-neg-in50.9%
mul-1-neg50.9%
distribute-lft-in50.9%
mul-1-neg50.9%
unsub-neg50.9%
Simplified50.9%
Taylor expanded in x around inf 44.4%
mul-1-neg44.4%
distribute-frac-neg244.4%
Simplified44.4%
Final simplification54.8%
(FPCore (x y z t) :precision binary64 (if (<= t -1.3e+36) (* t (- 1.0 (/ x y))) (+ t (* x (/ (- z t) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.3e+36) {
tmp = t * (1.0 - (x / y));
} 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 <= (-1.3d+36)) then
tmp = t * (1.0d0 - (x / y))
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 <= -1.3e+36) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (x * ((z - t) / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.3e+36: tmp = t * (1.0 - (x / y)) else: tmp = t + (x * ((z - t) / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.3e+36) tmp = Float64(t * Float64(1.0 - Float64(x / y))); 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 <= -1.3e+36) tmp = t * (1.0 - (x / y)); else tmp = t + (x * ((z - t) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.3e+36], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $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 -1.3 \cdot 10^{+36}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z - t}{y}\\
\end{array}
\end{array}
if t < -1.3000000000000001e36Initial program 99.9%
Taylor expanded in z around 0 84.2%
mul-1-neg84.2%
*-rgt-identity84.2%
associate-/l*91.9%
distribute-rgt-neg-in91.9%
mul-1-neg91.9%
distribute-lft-in91.9%
mul-1-neg91.9%
unsub-neg91.9%
Simplified91.9%
if -1.3000000000000001e36 < t Initial program 96.8%
Taylor expanded in x around 0 96.7%
associate-*r/95.4%
Simplified95.4%
Final simplification94.8%
(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.4%
Taylor expanded in z around 0 64.3%
mul-1-neg64.3%
*-rgt-identity64.3%
associate-/l*65.4%
distribute-rgt-neg-in65.4%
mul-1-neg65.4%
distribute-lft-in65.4%
mul-1-neg65.4%
unsub-neg65.4%
Simplified65.4%
(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.4%
Taylor expanded in x around 0 42.0%
(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 2024145
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:alt
(! :herbie-platform default (if (< z 689864138640673/250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* (/ x y) (- z t)) t) (if (< z 581748612718609/25000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t))))
(+ (* (/ x y) (- z t)) t))