
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) * t) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) * t) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (/ (- y z) (- a z)) (/ 1.0 t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) / (a - z)) / (1.0 / t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) / (a - z)) / (1.0d0 / t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) / (a - z)) / (1.0 / t));
}
def code(x, y, z, t, a): return x + (((y - z) / (a - z)) / (1.0 / t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) / Float64(a - z)) / Float64(1.0 / t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) / (a - z)) / (1.0 / t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] / N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\frac{y - z}{a - z}}{\frac{1}{t}}
\end{array}
Initial program 88.4%
associate-*l/98.7%
Simplified98.7%
associate-/r/97.1%
div-inv97.1%
associate-/r*98.8%
Applied egg-rr98.8%
Final simplification98.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.45e+38)
(+ x t)
(if (<= z 2.2e-30)
(+ x (/ t (/ a y)))
(if (<= z 1.2e+93) (- x (/ y (/ z t))) (+ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.45e+38) {
tmp = x + t;
} else if (z <= 2.2e-30) {
tmp = x + (t / (a / y));
} else if (z <= 1.2e+93) {
tmp = x - (y / (z / t));
} else {
tmp = x + t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-1.45d+38)) then
tmp = x + t
else if (z <= 2.2d-30) then
tmp = x + (t / (a / y))
else if (z <= 1.2d+93) then
tmp = x - (y / (z / t))
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.45e+38) {
tmp = x + t;
} else if (z <= 2.2e-30) {
tmp = x + (t / (a / y));
} else if (z <= 1.2e+93) {
tmp = x - (y / (z / t));
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.45e+38: tmp = x + t elif z <= 2.2e-30: tmp = x + (t / (a / y)) elif z <= 1.2e+93: tmp = x - (y / (z / t)) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.45e+38) tmp = Float64(x + t); elseif (z <= 2.2e-30) tmp = Float64(x + Float64(t / Float64(a / y))); elseif (z <= 1.2e+93) tmp = Float64(x - Float64(y / Float64(z / t))); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.45e+38) tmp = x + t; elseif (z <= 2.2e-30) tmp = x + (t / (a / y)); elseif (z <= 1.2e+93) tmp = x - (y / (z / t)); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.45e+38], N[(x + t), $MachinePrecision], If[LessEqual[z, 2.2e-30], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e+93], N[(x - N[(y / N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+38}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-30}:\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+93}:\\
\;\;\;\;x - \frac{y}{\frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -1.45000000000000003e38 or 1.20000000000000005e93 < z Initial program 74.6%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in z around inf 88.4%
if -1.45000000000000003e38 < z < 2.19999999999999983e-30Initial program 98.2%
associate-*l/97.6%
Simplified97.6%
Taylor expanded in a around inf 84.9%
associate-/l*85.7%
Simplified85.7%
Taylor expanded in y around inf 81.6%
if 2.19999999999999983e-30 < z < 1.20000000000000005e93Initial program 89.9%
associate-*l/99.8%
Simplified99.8%
associate-/r/98.6%
div-inv98.4%
associate-/r*99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 86.0%
Taylor expanded in a around 0 75.6%
mul-1-neg75.6%
associate-/l*75.6%
distribute-neg-frac75.6%
Simplified75.6%
Final simplification83.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.3e+38) (not (<= z 5e+102))) (- x (/ t (/ z (- y z)))) (+ x (* y (/ t (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.3e+38) || !(z <= 5e+102)) {
tmp = x - (t / (z / (y - z)));
} else {
tmp = x + (y * (t / (a - z)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-2.3d+38)) .or. (.not. (z <= 5d+102))) then
tmp = x - (t / (z / (y - z)))
else
tmp = x + (y * (t / (a - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.3e+38) || !(z <= 5e+102)) {
tmp = x - (t / (z / (y - z)));
} else {
tmp = x + (y * (t / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.3e+38) or not (z <= 5e+102): tmp = x - (t / (z / (y - z))) else: tmp = x + (y * (t / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.3e+38) || !(z <= 5e+102)) tmp = Float64(x - Float64(t / Float64(z / Float64(y - z)))); else tmp = Float64(x + Float64(y * Float64(t / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.3e+38) || ~((z <= 5e+102))) tmp = x - (t / (z / (y - z))); else tmp = x + (y * (t / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.3e+38], N[Not[LessEqual[z, 5e+102]], $MachinePrecision]], N[(x - N[(t / N[(z / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+38} \lor \neg \left(z \leq 5 \cdot 10^{+102}\right):\\
\;\;\;\;x - \frac{t}{\frac{z}{y - z}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\end{array}
\end{array}
if z < -2.3000000000000001e38 or 5e102 < z Initial program 74.6%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in a around 0 71.4%
+-commutative71.4%
mul-1-neg71.4%
unsub-neg71.4%
associate-/l*95.8%
Simplified95.8%
if -2.3000000000000001e38 < z < 5e102Initial program 96.3%
associate-*l/98.1%
Simplified98.1%
associate-/r/97.9%
div-inv97.8%
associate-/r*98.1%
Applied egg-rr98.1%
Taylor expanded in y around inf 88.2%
Taylor expanded in y around 0 88.1%
associate-*r/88.5%
Simplified88.5%
Final simplification91.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.8e+39) (+ x t) (if (<= z 3.5e+93) (+ x (* y (/ t (- a z)))) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.8e+39) {
tmp = x + t;
} else if (z <= 3.5e+93) {
tmp = x + (y * (t / (a - z)));
} else {
tmp = x + t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-5.8d+39)) then
tmp = x + t
else if (z <= 3.5d+93) then
tmp = x + (y * (t / (a - z)))
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.8e+39) {
tmp = x + t;
} else if (z <= 3.5e+93) {
tmp = x + (y * (t / (a - z)));
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.8e+39: tmp = x + t elif z <= 3.5e+93: tmp = x + (y * (t / (a - z))) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.8e+39) tmp = Float64(x + t); elseif (z <= 3.5e+93) tmp = Float64(x + Float64(y * Float64(t / Float64(a - z)))); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5.8e+39) tmp = x + t; elseif (z <= 3.5e+93) tmp = x + (y * (t / (a - z))); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.8e+39], N[(x + t), $MachinePrecision], If[LessEqual[z, 3.5e+93], N[(x + N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+39}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+93}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -5.80000000000000059e39 or 3.49999999999999998e93 < z Initial program 74.6%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in z around inf 88.4%
if -5.80000000000000059e39 < z < 3.49999999999999998e93Initial program 96.8%
associate-*l/98.0%
Simplified98.0%
associate-/r/97.8%
div-inv97.8%
associate-/r*98.0%
Applied egg-rr98.0%
Taylor expanded in y around inf 88.5%
Taylor expanded in y around 0 88.4%
associate-*r/88.8%
Simplified88.8%
Final simplification88.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.1e+37) (+ x t) (if (<= z 6.8e+53) (+ x (* t (/ y a))) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.1e+37) {
tmp = x + t;
} else if (z <= 6.8e+53) {
tmp = x + (t * (y / a));
} else {
tmp = x + t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-4.1d+37)) then
tmp = x + t
else if (z <= 6.8d+53) then
tmp = x + (t * (y / a))
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.1e+37) {
tmp = x + t;
} else if (z <= 6.8e+53) {
tmp = x + (t * (y / a));
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.1e+37: tmp = x + t elif z <= 6.8e+53: tmp = x + (t * (y / a)) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.1e+37) tmp = Float64(x + t); elseif (z <= 6.8e+53) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.1e+37) tmp = x + t; elseif (z <= 6.8e+53) tmp = x + (t * (y / a)); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.1e+37], N[(x + t), $MachinePrecision], If[LessEqual[z, 6.8e+53], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+37}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+53}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -4.0999999999999998e37 or 6.79999999999999995e53 < z Initial program 75.3%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 84.7%
if -4.0999999999999998e37 < z < 6.79999999999999995e53Initial program 97.8%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in z around 0 77.9%
Final simplification80.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.7e+39) (+ x t) (if (<= z 4.6e+49) (+ x (* y (/ t a))) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.7e+39) {
tmp = x + t;
} else if (z <= 4.6e+49) {
tmp = x + (y * (t / a));
} else {
tmp = x + t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-4.7d+39)) then
tmp = x + t
else if (z <= 4.6d+49) then
tmp = x + (y * (t / a))
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.7e+39) {
tmp = x + t;
} else if (z <= 4.6e+49) {
tmp = x + (y * (t / a));
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.7e+39: tmp = x + t elif z <= 4.6e+49: tmp = x + (y * (t / a)) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.7e+39) tmp = Float64(x + t); elseif (z <= 4.6e+49) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.7e+39) tmp = x + t; elseif (z <= 4.6e+49) tmp = x + (y * (t / a)); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.7e+39], N[(x + t), $MachinePrecision], If[LessEqual[z, 4.6e+49], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{+39}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+49}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -4.6999999999999999e39 or 4.60000000000000004e49 < z Initial program 75.3%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 84.7%
if -4.6999999999999999e39 < z < 4.60000000000000004e49Initial program 97.8%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in z around 0 76.8%
associate-/l*78.2%
Simplified78.2%
div-inv78.1%
clear-num78.1%
Applied egg-rr78.1%
Final simplification80.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.6e+39) (+ x t) (if (<= z 1.12e+50) (+ x (/ t (/ a y))) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.6e+39) {
tmp = x + t;
} else if (z <= 1.12e+50) {
tmp = x + (t / (a / y));
} else {
tmp = x + t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-3.6d+39)) then
tmp = x + t
else if (z <= 1.12d+50) then
tmp = x + (t / (a / y))
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.6e+39) {
tmp = x + t;
} else if (z <= 1.12e+50) {
tmp = x + (t / (a / y));
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.6e+39: tmp = x + t elif z <= 1.12e+50: tmp = x + (t / (a / y)) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.6e+39) tmp = Float64(x + t); elseif (z <= 1.12e+50) tmp = Float64(x + Float64(t / Float64(a / y))); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.6e+39) tmp = x + t; elseif (z <= 1.12e+50) tmp = x + (t / (a / y)); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.6e+39], N[(x + t), $MachinePrecision], If[LessEqual[z, 1.12e+50], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+39}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+50}:\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -3.59999999999999984e39 or 1.1199999999999999e50 < z Initial program 75.3%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 84.7%
if -3.59999999999999984e39 < z < 1.1199999999999999e50Initial program 97.8%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in a around inf 79.6%
associate-/l*81.0%
Simplified81.0%
Taylor expanded in y around inf 78.2%
Final simplification80.9%
(FPCore (x y z t a) :precision binary64 (+ x (* (/ (- y z) (- a z)) t)))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) / (a - z)) * t);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) / (a - z)) * t)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) / (a - z)) * t);
}
def code(x, y, z, t, a): return x + (((y - z) / (a - z)) * t)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) / Float64(a - z)) * t)) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) / (a - z)) * t); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - z}{a - z} \cdot t
\end{array}
Initial program 88.4%
associate-*l/98.7%
Simplified98.7%
Final simplification98.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.4e-60) (+ x t) (if (<= z 1.55e+81) x (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.4e-60) {
tmp = x + t;
} else if (z <= 1.55e+81) {
tmp = x;
} else {
tmp = x + t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-1.4d-60)) then
tmp = x + t
else if (z <= 1.55d+81) then
tmp = x
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.4e-60) {
tmp = x + t;
} else if (z <= 1.55e+81) {
tmp = x;
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.4e-60: tmp = x + t elif z <= 1.55e+81: tmp = x else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.4e-60) tmp = Float64(x + t); elseif (z <= 1.55e+81) tmp = x; else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.4e-60) tmp = x + t; elseif (z <= 1.55e+81) tmp = x; else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.4e-60], N[(x + t), $MachinePrecision], If[LessEqual[z, 1.55e+81], x, N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-60}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+81}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -1.4000000000000001e-60 or 1.55e81 < z Initial program 79.8%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 79.1%
if -1.4000000000000001e-60 < z < 1.55e81Initial program 96.2%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in x around inf 48.8%
Final simplification63.3%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 88.4%
associate-*l/98.7%
Simplified98.7%
Taylor expanded in x around inf 51.8%
Final simplification51.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y z) (- a z)) t))))
(if (< t -1.0682974490174067e-39)
t_1
(if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (((y - z) / (a - z)) * t)
if (t < (-1.0682974490174067d-39)) then
tmp = t_1
else if (t < 3.9110949887586375d-141) then
tmp = x + (((y - z) * t) / (a - z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - z) / (a - z)) * t) tmp = 0 if t < -1.0682974490174067e-39: tmp = t_1 elif t < 3.9110949887586375e-141: tmp = x + (((y - z) * t) / (a - z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) / Float64(a - z)) * t)) tmp = 0.0 if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - z) / (a - z)) * t); tmp = 0.0; if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = x + (((y - z) * t) / (a - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -1.0682974490174067e-39], t$95$1, If[Less[t, 3.9110949887586375e-141], N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - z}{a - z} \cdot t\\
\mathbf{if}\;t < -1.0682974490174067 \cdot 10^{-39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t < 3.9110949887586375 \cdot 10^{-141}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023224
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))
(+ x (/ (* (- y z) t) (- a z))))