
(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 12 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 (fma (/ (- y z) (- a z)) t x))
double code(double x, double y, double z, double t, double a) {
return fma(((y - z) / (a - z)), t, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(y - z) / Float64(a - z)), t, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y - z}{a - z}, t, x\right)
\end{array}
Initial program 86.0%
+-commutative86.0%
associate-*l/98.8%
fma-def98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1e+157)
(+ t x)
(if (<= z -1e-82)
(- x (/ t (/ z y)))
(if (<= z 4.2e-73)
(+ x (/ (* y t) a))
(if (<= z 5.2e+26)
(- x (/ (* z t) a))
(if (<= z 2.6e+43) (* t (- 1.0 (/ y z))) (+ t x)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e+157) {
tmp = t + x;
} else if (z <= -1e-82) {
tmp = x - (t / (z / y));
} else if (z <= 4.2e-73) {
tmp = x + ((y * t) / a);
} else if (z <= 5.2e+26) {
tmp = x - ((z * t) / a);
} else if (z <= 2.6e+43) {
tmp = t * (1.0 - (y / z));
} else {
tmp = t + x;
}
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 <= (-1d+157)) then
tmp = t + x
else if (z <= (-1d-82)) then
tmp = x - (t / (z / y))
else if (z <= 4.2d-73) then
tmp = x + ((y * t) / a)
else if (z <= 5.2d+26) then
tmp = x - ((z * t) / a)
else if (z <= 2.6d+43) then
tmp = t * (1.0d0 - (y / z))
else
tmp = t + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e+157) {
tmp = t + x;
} else if (z <= -1e-82) {
tmp = x - (t / (z / y));
} else if (z <= 4.2e-73) {
tmp = x + ((y * t) / a);
} else if (z <= 5.2e+26) {
tmp = x - ((z * t) / a);
} else if (z <= 2.6e+43) {
tmp = t * (1.0 - (y / z));
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1e+157: tmp = t + x elif z <= -1e-82: tmp = x - (t / (z / y)) elif z <= 4.2e-73: tmp = x + ((y * t) / a) elif z <= 5.2e+26: tmp = x - ((z * t) / a) elif z <= 2.6e+43: tmp = t * (1.0 - (y / z)) else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1e+157) tmp = Float64(t + x); elseif (z <= -1e-82) tmp = Float64(x - Float64(t / Float64(z / y))); elseif (z <= 4.2e-73) tmp = Float64(x + Float64(Float64(y * t) / a)); elseif (z <= 5.2e+26) tmp = Float64(x - Float64(Float64(z * t) / a)); elseif (z <= 2.6e+43) tmp = Float64(t * Float64(1.0 - Float64(y / z))); else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1e+157) tmp = t + x; elseif (z <= -1e-82) tmp = x - (t / (z / y)); elseif (z <= 4.2e-73) tmp = x + ((y * t) / a); elseif (z <= 5.2e+26) tmp = x - ((z * t) / a); elseif (z <= 2.6e+43) tmp = t * (1.0 - (y / z)); else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1e+157], N[(t + x), $MachinePrecision], If[LessEqual[z, -1e-82], N[(x - N[(t / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e-73], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e+26], N[(x - N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e+43], N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+157}:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq -1 \cdot 10^{-82}:\\
\;\;\;\;x - \frac{t}{\frac{z}{y}}\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-73}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+26}:\\
\;\;\;\;x - \frac{z \cdot t}{a}\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+43}:\\
\;\;\;\;t \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -9.99999999999999983e156 or 2.60000000000000021e43 < z Initial program 67.6%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 82.4%
if -9.99999999999999983e156 < z < -1e-82Initial program 85.8%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in a around 0 74.2%
mul-1-neg74.2%
unsub-neg74.2%
associate-/l*84.7%
Simplified84.7%
Taylor expanded in z around 0 70.8%
if -1e-82 < z < 4.1999999999999997e-73Initial program 98.9%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in z around 0 85.5%
if 4.1999999999999997e-73 < z < 5.20000000000000004e26Initial program 94.8%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 90.3%
mul-1-neg90.3%
*-commutative90.3%
associate-*r/85.8%
unsub-neg85.8%
associate-*r/90.3%
*-commutative90.3%
associate-/l*90.2%
div-sub90.2%
*-inverses90.2%
Simplified90.2%
Taylor expanded in a around inf 90.1%
if 5.20000000000000004e26 < z < 2.60000000000000021e43Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in a around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in t around inf 100.0%
Final simplification82.1%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.2e+156)
(+ t x)
(if (<= z -1.7e-82)
(- x (* t (/ y z)))
(if (<= z 7.2e-74)
(+ x (/ (* y t) a))
(if (<= z 1e+26)
(- x (/ (* z t) a))
(if (<= z 2.2e+43) (* t (- 1.0 (/ y z))) (+ t x)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.2e+156) {
tmp = t + x;
} else if (z <= -1.7e-82) {
tmp = x - (t * (y / z));
} else if (z <= 7.2e-74) {
tmp = x + ((y * t) / a);
} else if (z <= 1e+26) {
tmp = x - ((z * t) / a);
} else if (z <= 2.2e+43) {
tmp = t * (1.0 - (y / z));
} else {
tmp = t + x;
}
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.2d+156)) then
tmp = t + x
else if (z <= (-1.7d-82)) then
tmp = x - (t * (y / z))
else if (z <= 7.2d-74) then
tmp = x + ((y * t) / a)
else if (z <= 1d+26) then
tmp = x - ((z * t) / a)
else if (z <= 2.2d+43) then
tmp = t * (1.0d0 - (y / z))
else
tmp = t + x
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.2e+156) {
tmp = t + x;
} else if (z <= -1.7e-82) {
tmp = x - (t * (y / z));
} else if (z <= 7.2e-74) {
tmp = x + ((y * t) / a);
} else if (z <= 1e+26) {
tmp = x - ((z * t) / a);
} else if (z <= 2.2e+43) {
tmp = t * (1.0 - (y / z));
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.2e+156: tmp = t + x elif z <= -1.7e-82: tmp = x - (t * (y / z)) elif z <= 7.2e-74: tmp = x + ((y * t) / a) elif z <= 1e+26: tmp = x - ((z * t) / a) elif z <= 2.2e+43: tmp = t * (1.0 - (y / z)) else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.2e+156) tmp = Float64(t + x); elseif (z <= -1.7e-82) tmp = Float64(x - Float64(t * Float64(y / z))); elseif (z <= 7.2e-74) tmp = Float64(x + Float64(Float64(y * t) / a)); elseif (z <= 1e+26) tmp = Float64(x - Float64(Float64(z * t) / a)); elseif (z <= 2.2e+43) tmp = Float64(t * Float64(1.0 - Float64(y / z))); else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.2e+156) tmp = t + x; elseif (z <= -1.7e-82) tmp = x - (t * (y / z)); elseif (z <= 7.2e-74) tmp = x + ((y * t) / a); elseif (z <= 1e+26) tmp = x - ((z * t) / a); elseif (z <= 2.2e+43) tmp = t * (1.0 - (y / z)); else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.2e+156], N[(t + x), $MachinePrecision], If[LessEqual[z, -1.7e-82], N[(x - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e-74], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e+26], N[(x - N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e+43], N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+156}:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{-82}:\\
\;\;\;\;x - t \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-74}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{elif}\;z \leq 10^{+26}:\\
\;\;\;\;x - \frac{z \cdot t}{a}\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+43}:\\
\;\;\;\;t \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -3.20000000000000002e156 or 2.20000000000000001e43 < z Initial program 67.6%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 82.4%
if -3.20000000000000002e156 < z < -1.69999999999999988e-82Initial program 85.8%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around inf 78.0%
Taylor expanded in a around 0 71.0%
associate-*r/71.0%
neg-mul-171.0%
Simplified71.0%
if -1.69999999999999988e-82 < z < 7.2000000000000005e-74Initial program 98.9%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in z around 0 85.5%
if 7.2000000000000005e-74 < z < 1.00000000000000005e26Initial program 94.8%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 90.3%
mul-1-neg90.3%
*-commutative90.3%
associate-*r/85.8%
unsub-neg85.8%
associate-*r/90.3%
*-commutative90.3%
associate-/l*90.2%
div-sub90.2%
*-inverses90.2%
Simplified90.2%
Taylor expanded in a around inf 90.1%
if 1.00000000000000005e26 < z < 2.20000000000000001e43Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in a around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in t around inf 100.0%
Final simplification82.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.6e+160)
(+ t x)
(if (<= z -1.85e-82)
(- x (/ t (/ z y)))
(if (<= z 1.0) (+ x (* y (/ t a))) (+ t x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.6e+160) {
tmp = t + x;
} else if (z <= -1.85e-82) {
tmp = x - (t / (z / y));
} else if (z <= 1.0) {
tmp = x + (y * (t / a));
} else {
tmp = t + x;
}
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.6d+160)) then
tmp = t + x
else if (z <= (-1.85d-82)) then
tmp = x - (t / (z / y))
else if (z <= 1.0d0) then
tmp = x + (y * (t / a))
else
tmp = t + x
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.6e+160) {
tmp = t + x;
} else if (z <= -1.85e-82) {
tmp = x - (t / (z / y));
} else if (z <= 1.0) {
tmp = x + (y * (t / a));
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.6e+160: tmp = t + x elif z <= -1.85e-82: tmp = x - (t / (z / y)) elif z <= 1.0: tmp = x + (y * (t / a)) else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.6e+160) tmp = Float64(t + x); elseif (z <= -1.85e-82) tmp = Float64(x - Float64(t / Float64(z / y))); elseif (z <= 1.0) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.6e+160) tmp = t + x; elseif (z <= -1.85e-82) tmp = x - (t / (z / y)); elseif (z <= 1.0) tmp = x + (y * (t / a)); else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.6e+160], N[(t + x), $MachinePrecision], If[LessEqual[z, -1.85e-82], N[(x - N[(t / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+160}:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq -1.85 \cdot 10^{-82}:\\
\;\;\;\;x - \frac{t}{\frac{z}{y}}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -2.6e160 or 1 < z Initial program 71.1%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 78.9%
if -2.6e160 < z < -1.85e-82Initial program 85.8%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in a around 0 74.2%
mul-1-neg74.2%
unsub-neg74.2%
associate-/l*84.7%
Simplified84.7%
Taylor expanded in z around 0 70.8%
if -1.85e-82 < z < 1Initial program 98.2%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in z around 0 84.0%
associate-/l*83.0%
associate-/r/84.2%
Applied egg-rr84.2%
Final simplification79.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.9e+159) (not (<= z 2.6e+61))) (+ t x) (+ x (* t (/ y (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.9e+159) || !(z <= 2.6e+61)) {
tmp = t + x;
} 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.9d+159)) .or. (.not. (z <= 2.6d+61))) then
tmp = t + x
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.9e+159) || !(z <= 2.6e+61)) {
tmp = t + x;
} else {
tmp = x + (t * (y / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.9e+159) or not (z <= 2.6e+61): tmp = t + x else: tmp = x + (t * (y / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.9e+159) || !(z <= 2.6e+61)) tmp = Float64(t + x); 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.9e+159) || ~((z <= 2.6e+61))) tmp = t + x; else tmp = x + (t * (y / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.9e+159], N[Not[LessEqual[z, 2.6e+61]], $MachinePrecision]], N[(t + x), $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.9 \cdot 10^{+159} \lor \neg \left(z \leq 2.6 \cdot 10^{+61}\right):\\
\;\;\;\;t + x\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if z < -1.89999999999999983e159 or 2.59999999999999973e61 < z Initial program 68.3%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 85.1%
if -1.89999999999999983e159 < z < 2.59999999999999973e61Initial program 93.6%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in y around inf 87.1%
Final simplification86.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.5e+158) (not (<= z 2.6e+61))) (+ t x) (+ x (/ y (/ (- a z) t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.5e+158) || !(z <= 2.6e+61)) {
tmp = t + x;
} else {
tmp = x + (y / ((a - z) / 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 <= (-6.5d+158)) .or. (.not. (z <= 2.6d+61))) then
tmp = t + x
else
tmp = x + (y / ((a - z) / 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 <= -6.5e+158) || !(z <= 2.6e+61)) {
tmp = t + x;
} else {
tmp = x + (y / ((a - z) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.5e+158) or not (z <= 2.6e+61): tmp = t + x else: tmp = x + (y / ((a - z) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.5e+158) || !(z <= 2.6e+61)) tmp = Float64(t + x); else tmp = Float64(x + Float64(y / Float64(Float64(a - z) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -6.5e+158) || ~((z <= 2.6e+61))) tmp = t + x; else tmp = x + (y / ((a - z) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.5e+158], N[Not[LessEqual[z, 2.6e+61]], $MachinePrecision]], N[(t + x), $MachinePrecision], N[(x + N[(y / N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+158} \lor \neg \left(z \leq 2.6 \cdot 10^{+61}\right):\\
\;\;\;\;t + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - z}{t}}\\
\end{array}
\end{array}
if z < -6.5000000000000001e158 or 2.59999999999999973e61 < z Initial program 68.3%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 85.1%
if -6.5000000000000001e158 < z < 2.59999999999999973e61Initial program 93.6%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in y around inf 87.1%
associate-*l/84.6%
associate-/l*88.0%
Applied egg-rr88.0%
Final simplification87.1%
(FPCore (x y z t a) :precision binary64 (if (<= y -2.6e+30) (+ x (* t (/ y (- a z)))) (if (<= y 6.8e+19) (- x (/ t (+ (/ a z) -1.0))) (+ x (/ y (/ (- a z) t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.6e+30) {
tmp = x + (t * (y / (a - z)));
} else if (y <= 6.8e+19) {
tmp = x - (t / ((a / z) + -1.0));
} else {
tmp = x + (y / ((a - z) / 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 (y <= (-2.6d+30)) then
tmp = x + (t * (y / (a - z)))
else if (y <= 6.8d+19) then
tmp = x - (t / ((a / z) + (-1.0d0)))
else
tmp = x + (y / ((a - z) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.6e+30) {
tmp = x + (t * (y / (a - z)));
} else if (y <= 6.8e+19) {
tmp = x - (t / ((a / z) + -1.0));
} else {
tmp = x + (y / ((a - z) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -2.6e+30: tmp = x + (t * (y / (a - z))) elif y <= 6.8e+19: tmp = x - (t / ((a / z) + -1.0)) else: tmp = x + (y / ((a - z) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.6e+30) tmp = Float64(x + Float64(t * Float64(y / Float64(a - z)))); elseif (y <= 6.8e+19) tmp = Float64(x - Float64(t / Float64(Float64(a / z) + -1.0))); else tmp = Float64(x + Float64(y / Float64(Float64(a - z) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -2.6e+30) tmp = x + (t * (y / (a - z))); elseif (y <= 6.8e+19) tmp = x - (t / ((a / z) + -1.0)); else tmp = x + (y / ((a - z) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.6e+30], N[(x + N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.8e+19], N[(x - N[(t / N[(N[(a / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+30}:\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+19}:\\
\;\;\;\;x - \frac{t}{\frac{a}{z} + -1}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - z}{t}}\\
\end{array}
\end{array}
if y < -2.59999999999999988e30Initial program 83.9%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in y around inf 94.3%
if -2.59999999999999988e30 < y < 6.8e19Initial program 85.6%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around 0 83.0%
mul-1-neg83.0%
*-commutative83.0%
associate-*r/96.2%
unsub-neg96.2%
associate-*r/83.0%
*-commutative83.0%
associate-/l*97.4%
div-sub97.4%
*-inverses97.4%
Simplified97.4%
if 6.8e19 < y Initial program 88.9%
associate-*l/96.8%
Simplified96.8%
Taylor expanded in y around inf 89.6%
associate-*l/88.8%
associate-/l*90.9%
Applied egg-rr90.9%
Final simplification95.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -1.02e-188) (not (<= x 2.4e-138))) (+ t x) (* t (- 1.0 (/ y z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1.02e-188) || !(x <= 2.4e-138)) {
tmp = t + x;
} else {
tmp = t * (1.0 - (y / 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 ((x <= (-1.02d-188)) .or. (.not. (x <= 2.4d-138))) then
tmp = t + x
else
tmp = t * (1.0d0 - (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1.02e-188) || !(x <= 2.4e-138)) {
tmp = t + x;
} else {
tmp = t * (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -1.02e-188) or not (x <= 2.4e-138): tmp = t + x else: tmp = t * (1.0 - (y / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -1.02e-188) || !(x <= 2.4e-138)) tmp = Float64(t + x); else tmp = Float64(t * Float64(1.0 - Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -1.02e-188) || ~((x <= 2.4e-138))) tmp = t + x; else tmp = t * (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -1.02e-188], N[Not[LessEqual[x, 2.4e-138]], $MachinePrecision]], N[(t + x), $MachinePrecision], N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{-188} \lor \neg \left(x \leq 2.4 \cdot 10^{-138}\right):\\
\;\;\;\;t + x\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{y}{z}\right)\\
\end{array}
\end{array}
if x < -1.02e-188 or 2.3999999999999999e-138 < x Initial program 86.5%
associate-*l/98.5%
Simplified98.5%
Taylor expanded in z around inf 73.4%
if -1.02e-188 < x < 2.3999999999999999e-138Initial program 84.5%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in a around 0 50.3%
mul-1-neg50.3%
unsub-neg50.3%
associate-/l*61.8%
Simplified61.8%
Taylor expanded in t around inf 57.6%
Final simplification69.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.85e-19) (not (<= z 2.4))) (+ t x) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.85e-19) || !(z <= 2.4)) {
tmp = t + x;
} else {
tmp = x + (y * (t / 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 <= (-1.85d-19)) .or. (.not. (z <= 2.4d0))) then
tmp = t + x
else
tmp = x + (y * (t / 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 <= -1.85e-19) || !(z <= 2.4)) {
tmp = t + x;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.85e-19) or not (z <= 2.4): tmp = t + x else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.85e-19) || !(z <= 2.4)) tmp = Float64(t + x); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.85e-19) || ~((z <= 2.4))) tmp = t + x; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.85e-19], N[Not[LessEqual[z, 2.4]], $MachinePrecision]], N[(t + x), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{-19} \lor \neg \left(z \leq 2.4\right):\\
\;\;\;\;t + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -1.85000000000000003e-19 or 2.39999999999999991 < z Initial program 76.4%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 72.1%
if -1.85000000000000003e-19 < z < 2.39999999999999991Initial program 96.7%
associate-*l/97.6%
Simplified97.6%
Taylor expanded in z around 0 80.4%
associate-/l*81.0%
associate-/r/82.2%
Applied egg-rr82.2%
Final simplification76.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.8e-139) (not (<= z 3.8e+21))) (+ t x) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.8e-139) || !(z <= 3.8e+21)) {
tmp = t + x;
} else {
tmp = x;
}
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.8d-139)) .or. (.not. (z <= 3.8d+21))) then
tmp = t + x
else
tmp = x
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.8e-139) || !(z <= 3.8e+21)) {
tmp = t + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.8e-139) or not (z <= 3.8e+21): tmp = t + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.8e-139) || !(z <= 3.8e+21)) tmp = Float64(t + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.8e-139) || ~((z <= 3.8e+21))) tmp = t + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.8e-139], N[Not[LessEqual[z, 3.8e+21]], $MachinePrecision]], N[(t + x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-139} \lor \neg \left(z \leq 3.8 \cdot 10^{+21}\right):\\
\;\;\;\;t + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.80000000000000029e-139 or 3.8e21 < z Initial program 77.2%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 71.3%
if -4.80000000000000029e-139 < z < 3.8e21Initial program 98.1%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in x around inf 63.5%
Final simplification68.0%
(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 86.0%
associate-*l/98.8%
Simplified98.8%
Final simplification98.8%
(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 86.0%
associate-*l/98.8%
Simplified98.8%
Taylor expanded in x around inf 55.8%
Final simplification55.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 2024018
(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))))