
(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)) 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 87.0%
associate-*l/98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4.4e+26)
(+ x t)
(if (<= z -1.5e-99)
(- x (/ t (/ z y)))
(if (<= z 1e+23) (+ x (/ t (/ a y))) (+ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.4e+26) {
tmp = x + t;
} else if (z <= -1.5e-99) {
tmp = x - (t / (z / y));
} else if (z <= 1e+23) {
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 <= (-4.4d+26)) then
tmp = x + t
else if (z <= (-1.5d-99)) then
tmp = x - (t / (z / y))
else if (z <= 1d+23) 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 <= -4.4e+26) {
tmp = x + t;
} else if (z <= -1.5e-99) {
tmp = x - (t / (z / y));
} else if (z <= 1e+23) {
tmp = x + (t / (a / y));
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.4e+26: tmp = x + t elif z <= -1.5e-99: tmp = x - (t / (z / y)) elif z <= 1e+23: tmp = x + (t / (a / y)) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.4e+26) tmp = Float64(x + t); elseif (z <= -1.5e-99) tmp = Float64(x - Float64(t / Float64(z / y))); elseif (z <= 1e+23) 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 <= -4.4e+26) tmp = x + t; elseif (z <= -1.5e-99) tmp = x - (t / (z / y)); elseif (z <= 1e+23) tmp = x + (t / (a / y)); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.4e+26], N[(x + t), $MachinePrecision], If[LessEqual[z, -1.5e-99], N[(x - N[(t / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e+23], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+26}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{-99}:\\
\;\;\;\;x - \frac{t}{\frac{z}{y}}\\
\mathbf{elif}\;z \leq 10^{+23}:\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -4.40000000000000014e26 or 9.9999999999999992e22 < z Initial program 76.7%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in z around inf 80.9%
if -4.40000000000000014e26 < z < -1.50000000000000003e-99Initial program 99.7%
+-commutative99.7%
associate-*r/99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in a around 0 81.5%
+-commutative81.5%
mul-1-neg81.5%
unsub-neg81.5%
associate-/l*81.6%
Simplified81.6%
Taylor expanded in z around 0 78.1%
if -1.50000000000000003e-99 < z < 9.9999999999999992e22Initial program 95.6%
+-commutative95.6%
associate-*r/97.2%
fma-def97.2%
Simplified97.2%
Taylor expanded in a around inf 86.4%
associate-/l*89.6%
Simplified89.6%
Taylor expanded in y around inf 86.9%
Final simplification83.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.7e+122) (not (<= z 2.9e+42))) (+ x t) (+ x (* t (/ y (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.7e+122) || !(z <= 2.9e+42)) {
tmp = x + t;
} else {
tmp = x + (t * (y / (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.7d+122)) .or. (.not. (z <= 2.9d+42))) then
tmp = x + t
else
tmp = x + (t * (y / (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.7e+122) || !(z <= 2.9e+42)) {
tmp = x + t;
} else {
tmp = x + (t * (y / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.7e+122) or not (z <= 2.9e+42): tmp = x + t else: tmp = x + (t * (y / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.7e+122) || !(z <= 2.9e+42)) tmp = Float64(x + t); else tmp = Float64(x + Float64(t * Float64(y / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.7e+122) || ~((z <= 2.9e+42))) tmp = x + t; else tmp = x + (t * (y / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.7e+122], N[Not[LessEqual[z, 2.9e+42]], $MachinePrecision]], N[(x + t), $MachinePrecision], N[(x + N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+122} \lor \neg \left(z \leq 2.9 \cdot 10^{+42}\right):\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if z < -2.6999999999999998e122 or 2.89999999999999981e42 < z Initial program 72.9%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in z around inf 86.5%
if -2.6999999999999998e122 < z < 2.89999999999999981e42Initial program 95.3%
associate-*l/98.3%
Simplified98.3%
Taylor expanded in y around inf 89.2%
Final simplification88.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.4e+16) (not (<= z 2e+24))) (- x (/ t (/ z (- y z)))) (+ x (* t (/ y (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.4e+16) || !(z <= 2e+24)) {
tmp = x - (t / (z / (y - z)));
} else {
tmp = x + (t * (y / (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 <= (-1.4d+16)) .or. (.not. (z <= 2d+24))) then
tmp = x - (t / (z / (y - z)))
else
tmp = x + (t * (y / (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 <= -1.4e+16) || !(z <= 2e+24)) {
tmp = x - (t / (z / (y - z)));
} else {
tmp = x + (t * (y / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.4e+16) or not (z <= 2e+24): tmp = x - (t / (z / (y - z))) else: tmp = x + (t * (y / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.4e+16) || !(z <= 2e+24)) tmp = Float64(x - Float64(t / Float64(z / Float64(y - z)))); else tmp = Float64(x + Float64(t * Float64(y / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.4e+16) || ~((z <= 2e+24))) tmp = x - (t / (z / (y - z))); else tmp = x + (t * (y / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.4e+16], N[Not[LessEqual[z, 2e+24]], $MachinePrecision]], N[(x - N[(t / N[(z / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+16} \lor \neg \left(z \leq 2 \cdot 10^{+24}\right):\\
\;\;\;\;x - \frac{t}{\frac{z}{y - z}}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if z < -1.4e16 or 2e24 < z Initial program 77.4%
+-commutative77.4%
associate-*r/95.4%
fma-def95.4%
Simplified95.4%
Taylor expanded in a around 0 69.5%
+-commutative69.5%
mul-1-neg69.5%
unsub-neg69.5%
associate-/l*87.5%
Simplified87.5%
if -1.4e16 < z < 2e24Initial program 96.3%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in y around inf 93.2%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.4e+26) (not (<= z 2.8e+41))) (- x (/ t (/ (- a z) z))) (+ x (* t (/ y (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.4e+26) || !(z <= 2.8e+41)) {
tmp = x - (t / ((a - z) / z));
} else {
tmp = x + (t * (y / (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 <= (-4.4d+26)) .or. (.not. (z <= 2.8d+41))) then
tmp = x - (t / ((a - z) / z))
else
tmp = x + (t * (y / (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 <= -4.4e+26) || !(z <= 2.8e+41)) {
tmp = x - (t / ((a - z) / z));
} else {
tmp = x + (t * (y / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.4e+26) or not (z <= 2.8e+41): tmp = x - (t / ((a - z) / z)) else: tmp = x + (t * (y / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.4e+26) || !(z <= 2.8e+41)) tmp = Float64(x - Float64(t / Float64(Float64(a - z) / z))); else tmp = Float64(x + Float64(t * Float64(y / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.4e+26) || ~((z <= 2.8e+41))) tmp = x - (t / ((a - z) / z)); else tmp = x + (t * (y / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.4e+26], N[Not[LessEqual[z, 2.8e+41]], $MachinePrecision]], N[(x - N[(t / N[(N[(a - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+26} \lor \neg \left(z \leq 2.8 \cdot 10^{+41}\right):\\
\;\;\;\;x - \frac{t}{\frac{a - z}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if z < -4.40000000000000014e26 or 2.7999999999999999e41 < z Initial program 76.3%
+-commutative76.3%
associate-*r/95.2%
fma-def95.2%
Simplified95.2%
fma-udef95.2%
Applied egg-rr95.2%
Taylor expanded in y around 0 72.3%
mul-1-neg72.3%
associate-/l*92.3%
distribute-neg-frac92.3%
Simplified92.3%
if -4.40000000000000014e26 < z < 2.7999999999999999e41Initial program 96.4%
associate-*l/98.0%
Simplified98.0%
Taylor expanded in y around inf 92.8%
Final simplification92.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.36e+172) (not (<= t 7.8e+123))) (* t (- 1.0 (/ y z))) (+ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.36e+172) || !(t <= 7.8e+123)) {
tmp = t * (1.0 - (y / 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 ((t <= (-1.36d+172)) .or. (.not. (t <= 7.8d+123))) then
tmp = t * (1.0d0 - (y / 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 ((t <= -1.36e+172) || !(t <= 7.8e+123)) {
tmp = t * (1.0 - (y / z));
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.36e+172) or not (t <= 7.8e+123): tmp = t * (1.0 - (y / z)) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.36e+172) || !(t <= 7.8e+123)) tmp = Float64(t * Float64(1.0 - Float64(y / z))); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.36e+172) || ~((t <= 7.8e+123))) tmp = t * (1.0 - (y / z)); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.36e+172], N[Not[LessEqual[t, 7.8e+123]], $MachinePrecision]], N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.36 \cdot 10^{+172} \lor \neg \left(t \leq 7.8 \cdot 10^{+123}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if t < -1.3600000000000001e172 or 7.79999999999999986e123 < t Initial program 65.6%
+-commutative65.6%
associate-*r/96.0%
fma-def96.0%
Simplified96.0%
Taylor expanded in a around 0 40.4%
+-commutative40.4%
mul-1-neg40.4%
unsub-neg40.4%
associate-/l*60.7%
Simplified60.7%
Taylor expanded in t around inf 56.8%
if -1.3600000000000001e172 < t < 7.79999999999999986e123Initial program 95.7%
associate-*l/99.4%
Simplified99.4%
Taylor expanded in z around inf 69.5%
Final simplification65.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9e-38) (not (<= z 2.75e+23))) (+ x t) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9e-38) || !(z <= 2.75e+23)) {
tmp = x + t;
} else {
tmp = x + (t * (y / a));
}
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 <= (-9d-38)) .or. (.not. (z <= 2.75d+23))) then
tmp = x + t
else
tmp = x + (t * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9e-38) || !(z <= 2.75e+23)) {
tmp = x + t;
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9e-38) or not (z <= 2.75e+23): tmp = x + t else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9e-38) || !(z <= 2.75e+23)) tmp = Float64(x + t); else tmp = Float64(x + Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -9e-38) || ~((z <= 2.75e+23))) tmp = x + t; else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9e-38], N[Not[LessEqual[z, 2.75e+23]], $MachinePrecision]], N[(x + t), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{-38} \lor \neg \left(z \leq 2.75 \cdot 10^{+23}\right):\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -9.00000000000000018e-38 or 2.75000000000000002e23 < z Initial program 79.1%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in z around inf 80.0%
if -9.00000000000000018e-38 < z < 2.75000000000000002e23Initial program 96.0%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in z around 0 82.1%
Final simplification81.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.2e-38) (not (<= z 7.5e+24))) (+ x t) (+ x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.2e-38) || !(z <= 7.5e+24)) {
tmp = x + t;
} else {
tmp = x + (t / (a / y));
}
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.2d-38)) .or. (.not. (z <= 7.5d+24))) then
tmp = x + t
else
tmp = x + (t / (a / y))
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.2e-38) || !(z <= 7.5e+24)) {
tmp = x + t;
} else {
tmp = x + (t / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.2e-38) or not (z <= 7.5e+24): tmp = x + t else: tmp = x + (t / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.2e-38) || !(z <= 7.5e+24)) tmp = Float64(x + t); else tmp = Float64(x + Float64(t / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.2e-38) || ~((z <= 7.5e+24))) tmp = x + t; else tmp = x + (t / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.2e-38], N[Not[LessEqual[z, 7.5e+24]], $MachinePrecision]], N[(x + t), $MachinePrecision], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-38} \lor \neg \left(z \leq 7.5 \cdot 10^{+24}\right):\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -4.20000000000000026e-38 or 7.50000000000000014e24 < z Initial program 79.1%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in z around inf 80.0%
if -4.20000000000000026e-38 < z < 7.50000000000000014e24Initial program 96.0%
+-commutative96.0%
associate-*r/97.5%
fma-def97.5%
Simplified97.5%
Taylor expanded in a around inf 83.0%
associate-/l*85.1%
Simplified85.1%
Taylor expanded in y around inf 82.6%
Final simplification81.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -9e+17) (+ x t) (if (<= z 3e-42) x (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9e+17) {
tmp = x + t;
} else if (z <= 3e-42) {
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 <= (-9d+17)) then
tmp = x + t
else if (z <= 3d-42) 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 <= -9e+17) {
tmp = x + t;
} else if (z <= 3e-42) {
tmp = x;
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -9e+17: tmp = x + t elif z <= 3e-42: tmp = x else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9e+17) tmp = Float64(x + t); elseif (z <= 3e-42) 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 <= -9e+17) tmp = x + t; elseif (z <= 3e-42) tmp = x; else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9e+17], N[(x + t), $MachinePrecision], If[LessEqual[z, 3e-42], x, N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+17}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-42}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -9e17 or 3.00000000000000027e-42 < z Initial program 79.2%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in z around inf 77.3%
if -9e17 < z < 3.00000000000000027e-42Initial program 96.0%
+-commutative96.0%
associate-*r/97.5%
fma-def97.5%
Simplified97.5%
Taylor expanded in t around 0 46.6%
Final simplification63.0%
(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 87.0%
+-commutative87.0%
associate-*r/96.5%
fma-def96.5%
Simplified96.5%
Taylor expanded in t around 0 47.2%
Final simplification47.2%
(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 2023185
(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))))