
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- z a))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
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)) / (z - a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (z - a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (z - a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- z a))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
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)) / (z - a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (z - a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (z - a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma y (/ (- z t) (- z a)) x))
double code(double x, double y, double z, double t, double a) {
return fma(y, ((z - t) / (z - a)), x);
}
function code(x, y, z, t, a) return fma(y, Float64(Float64(z - t) / Float64(z - a)), x) end
code[x_, y_, z_, t_, a_] := N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \frac{z - t}{z - a}, x\right)
\end{array}
Initial program 85.4%
+-commutative85.4%
associate-*r/98.8%
fma-def98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1e+143)
(+ y x)
(if (<= z -2.15e-36)
(- x (/ y (/ z t)))
(if (<= z 1e-13)
(+ x (* y (/ t a)))
(if (<= z 2.9e+59)
(+ y x)
(if (<= z 7e+125) (+ x (* t (/ y a))) (+ y x)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e+143) {
tmp = y + x;
} else if (z <= -2.15e-36) {
tmp = x - (y / (z / t));
} else if (z <= 1e-13) {
tmp = x + (y * (t / a));
} else if (z <= 2.9e+59) {
tmp = y + x;
} else if (z <= 7e+125) {
tmp = x + (t * (y / a));
} else {
tmp = y + 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+143)) then
tmp = y + x
else if (z <= (-2.15d-36)) then
tmp = x - (y / (z / t))
else if (z <= 1d-13) then
tmp = x + (y * (t / a))
else if (z <= 2.9d+59) then
tmp = y + x
else if (z <= 7d+125) then
tmp = x + (t * (y / a))
else
tmp = y + 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+143) {
tmp = y + x;
} else if (z <= -2.15e-36) {
tmp = x - (y / (z / t));
} else if (z <= 1e-13) {
tmp = x + (y * (t / a));
} else if (z <= 2.9e+59) {
tmp = y + x;
} else if (z <= 7e+125) {
tmp = x + (t * (y / a));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1e+143: tmp = y + x elif z <= -2.15e-36: tmp = x - (y / (z / t)) elif z <= 1e-13: tmp = x + (y * (t / a)) elif z <= 2.9e+59: tmp = y + x elif z <= 7e+125: tmp = x + (t * (y / a)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1e+143) tmp = Float64(y + x); elseif (z <= -2.15e-36) tmp = Float64(x - Float64(y / Float64(z / t))); elseif (z <= 1e-13) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 2.9e+59) tmp = Float64(y + x); elseif (z <= 7e+125) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1e+143) tmp = y + x; elseif (z <= -2.15e-36) tmp = x - (y / (z / t)); elseif (z <= 1e-13) tmp = x + (y * (t / a)); elseif (z <= 2.9e+59) tmp = y + x; elseif (z <= 7e+125) tmp = x + (t * (y / a)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1e+143], N[(y + x), $MachinePrecision], If[LessEqual[z, -2.15e-36], N[(x - N[(y / N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e-13], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e+59], N[(y + x), $MachinePrecision], If[LessEqual[z, 7e+125], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+143}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq -2.15 \cdot 10^{-36}:\\
\;\;\;\;x - \frac{y}{\frac{z}{t}}\\
\mathbf{elif}\;z \leq 10^{-13}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+59}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+125}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -1e143 or 1e-13 < z < 2.89999999999999991e59 or 7.00000000000000023e125 < z Initial program 68.0%
associate-*l/95.1%
Simplified95.1%
Taylor expanded in z around inf 87.1%
if -1e143 < z < -2.1500000000000001e-36Initial program 90.1%
associate-*l/93.1%
Simplified93.1%
Taylor expanded in t around inf 83.1%
associate-*r/83.1%
mul-1-neg83.1%
distribute-rgt-neg-out83.1%
associate-*l/80.4%
Simplified80.4%
Taylor expanded in z around inf 77.9%
+-commutative77.9%
mul-1-neg77.9%
unsub-neg77.9%
associate-/l*80.3%
Simplified80.3%
if -2.1500000000000001e-36 < z < 1e-13Initial program 98.5%
+-commutative98.5%
associate-*r/97.5%
fma-def97.6%
Simplified97.6%
fma-udef97.5%
Applied egg-rr97.5%
Taylor expanded in z around 0 76.7%
if 2.89999999999999991e59 < z < 7.00000000000000023e125Initial program 68.7%
+-commutative68.7%
associate-*r/99.7%
fma-def99.7%
Simplified99.7%
fma-udef99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 77.5%
*-commutative77.5%
associate-*r/87.7%
Simplified87.7%
Final simplification81.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ y (/ z (- z t))))))
(if (<= z -3.45e-48)
t_1
(if (<= z 5.1e-132)
(+ x (* y (/ t a)))
(if (<= z 1.75e-47)
(+ x (/ y (/ (- z a) z)))
(if (<= z 6.5128e-45) (+ x (* t (/ y a))) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y / (z / (z - t)));
double tmp;
if (z <= -3.45e-48) {
tmp = t_1;
} else if (z <= 5.1e-132) {
tmp = x + (y * (t / a));
} else if (z <= 1.75e-47) {
tmp = x + (y / ((z - a) / z));
} else if (z <= 6.5128e-45) {
tmp = x + (t * (y / a));
} 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 / (z - t)))
if (z <= (-3.45d-48)) then
tmp = t_1
else if (z <= 5.1d-132) then
tmp = x + (y * (t / a))
else if (z <= 1.75d-47) then
tmp = x + (y / ((z - a) / z))
else if (z <= 6.5128d-45) then
tmp = x + (t * (y / a))
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 / (z - t)));
double tmp;
if (z <= -3.45e-48) {
tmp = t_1;
} else if (z <= 5.1e-132) {
tmp = x + (y * (t / a));
} else if (z <= 1.75e-47) {
tmp = x + (y / ((z - a) / z));
} else if (z <= 6.5128e-45) {
tmp = x + (t * (y / a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y / (z / (z - t))) tmp = 0 if z <= -3.45e-48: tmp = t_1 elif z <= 5.1e-132: tmp = x + (y * (t / a)) elif z <= 1.75e-47: tmp = x + (y / ((z - a) / z)) elif z <= 6.5128e-45: tmp = x + (t * (y / a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y / Float64(z / Float64(z - t)))) tmp = 0.0 if (z <= -3.45e-48) tmp = t_1; elseif (z <= 5.1e-132) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 1.75e-47) tmp = Float64(x + Float64(y / Float64(Float64(z - a) / z))); elseif (z <= 6.5128e-45) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y / (z / (z - t))); tmp = 0.0; if (z <= -3.45e-48) tmp = t_1; elseif (z <= 5.1e-132) tmp = x + (y * (t / a)); elseif (z <= 1.75e-47) tmp = x + (y / ((z - a) / z)); elseif (z <= 6.5128e-45) tmp = x + (t * (y / a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.45e-48], t$95$1, If[LessEqual[z, 5.1e-132], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75e-47], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5128e-45], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{if}\;z \leq -3.45 \cdot 10^{-48}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{-132}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-47}:\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\
\mathbf{elif}\;z \leq 6.5128 \cdot 10^{-45}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -3.45000000000000009e-48 or 6.5128000000000001e-45 < z Initial program 75.7%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in a around 0 89.7%
if -3.45000000000000009e-48 < z < 5.10000000000000005e-132Initial program 98.1%
+-commutative98.1%
associate-*r/97.7%
fma-def97.7%
Simplified97.7%
fma-udef97.7%
Applied egg-rr97.7%
Taylor expanded in z around 0 82.2%
if 5.10000000000000005e-132 < z < 1.7499999999999999e-47Initial program 99.7%
associate-/l*95.6%
Simplified95.6%
Taylor expanded in t around 0 81.6%
if 1.7499999999999999e-47 < z < 6.5128000000000001e-45Initial program 99.0%
+-commutative99.0%
associate-*r/99.5%
fma-def100.0%
Simplified100.0%
fma-udef99.5%
Applied egg-rr99.5%
Taylor expanded in z around 0 79.1%
*-commutative79.1%
associate-*r/79.1%
Simplified79.1%
Final simplification86.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.7e-47)
(+ y x)
(if (or (<= z 1.85e-12) (and (not (<= z 5.4e+57)) (<= z 7e+125)))
(+ x (* t (/ y a)))
(+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.7e-47) {
tmp = y + x;
} else if ((z <= 1.85e-12) || (!(z <= 5.4e+57) && (z <= 7e+125))) {
tmp = x + (t * (y / a));
} else {
tmp = y + 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.7d-47)) then
tmp = y + x
else if ((z <= 1.85d-12) .or. (.not. (z <= 5.4d+57)) .and. (z <= 7d+125)) then
tmp = x + (t * (y / a))
else
tmp = y + 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.7e-47) {
tmp = y + x;
} else if ((z <= 1.85e-12) || (!(z <= 5.4e+57) && (z <= 7e+125))) {
tmp = x + (t * (y / a));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.7e-47: tmp = y + x elif (z <= 1.85e-12) or (not (z <= 5.4e+57) and (z <= 7e+125)): tmp = x + (t * (y / a)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.7e-47) tmp = Float64(y + x); elseif ((z <= 1.85e-12) || (!(z <= 5.4e+57) && (z <= 7e+125))) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.7e-47) tmp = y + x; elseif ((z <= 1.85e-12) || (~((z <= 5.4e+57)) && (z <= 7e+125))) tmp = x + (t * (y / a)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.7e-47], N[(y + x), $MachinePrecision], If[Or[LessEqual[z, 1.85e-12], And[N[Not[LessEqual[z, 5.4e+57]], $MachinePrecision], LessEqual[z, 7e+125]]], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{-47}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-12} \lor \neg \left(z \leq 5.4 \cdot 10^{+57}\right) \land z \leq 7 \cdot 10^{+125}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -3.7e-47 or 1.84999999999999999e-12 < z < 5.3999999999999997e57 or 7.00000000000000023e125 < z Initial program 74.9%
associate-*l/94.6%
Simplified94.6%
Taylor expanded in z around inf 80.7%
if -3.7e-47 < z < 1.84999999999999999e-12 or 5.3999999999999997e57 < z < 7.00000000000000023e125Initial program 96.3%
+-commutative96.3%
associate-*r/97.6%
fma-def97.7%
Simplified97.7%
fma-udef97.6%
Applied egg-rr97.6%
Taylor expanded in z around 0 76.5%
*-commutative76.5%
associate-*r/75.6%
Simplified75.6%
Final simplification78.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -7e-48)
(+ y x)
(if (<= z 9e-15)
(+ x (* y (/ t a)))
(if (<= z 2.9e+59)
(+ y x)
(if (<= z 7e+125) (+ x (* t (/ y a))) (+ y x))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -7e-48) {
tmp = y + x;
} else if (z <= 9e-15) {
tmp = x + (y * (t / a));
} else if (z <= 2.9e+59) {
tmp = y + x;
} else if (z <= 7e+125) {
tmp = x + (t * (y / a));
} else {
tmp = y + 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 <= (-7d-48)) then
tmp = y + x
else if (z <= 9d-15) then
tmp = x + (y * (t / a))
else if (z <= 2.9d+59) then
tmp = y + x
else if (z <= 7d+125) then
tmp = x + (t * (y / a))
else
tmp = y + 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 <= -7e-48) {
tmp = y + x;
} else if (z <= 9e-15) {
tmp = x + (y * (t / a));
} else if (z <= 2.9e+59) {
tmp = y + x;
} else if (z <= 7e+125) {
tmp = x + (t * (y / a));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -7e-48: tmp = y + x elif z <= 9e-15: tmp = x + (y * (t / a)) elif z <= 2.9e+59: tmp = y + x elif z <= 7e+125: tmp = x + (t * (y / a)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -7e-48) tmp = Float64(y + x); elseif (z <= 9e-15) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 2.9e+59) tmp = Float64(y + x); elseif (z <= 7e+125) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -7e-48) tmp = y + x; elseif (z <= 9e-15) tmp = x + (y * (t / a)); elseif (z <= 2.9e+59) tmp = y + x; elseif (z <= 7e+125) tmp = x + (t * (y / a)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -7e-48], N[(y + x), $MachinePrecision], If[LessEqual[z, 9e-15], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e+59], N[(y + x), $MachinePrecision], If[LessEqual[z, 7e+125], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-48}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-15}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+59}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+125}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -6.99999999999999982e-48 or 8.9999999999999995e-15 < z < 2.89999999999999991e59 or 7.00000000000000023e125 < z Initial program 74.9%
associate-*l/94.6%
Simplified94.6%
Taylor expanded in z around inf 80.7%
if -6.99999999999999982e-48 < z < 8.9999999999999995e-15Initial program 98.5%
+-commutative98.5%
associate-*r/97.5%
fma-def97.5%
Simplified97.5%
fma-udef97.5%
Applied egg-rr97.5%
Taylor expanded in z around 0 77.2%
if 2.89999999999999991e59 < z < 7.00000000000000023e125Initial program 68.7%
+-commutative68.7%
associate-*r/99.7%
fma-def99.7%
Simplified99.7%
fma-udef99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 77.5%
*-commutative77.5%
associate-*r/87.7%
Simplified87.7%
Final simplification79.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.9e-48) (not (<= z 3.1e-14))) (+ x (/ y (/ z (- z t)))) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.9e-48) || !(z <= 3.1e-14)) {
tmp = x + (y / (z / (z - t)));
} 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 <= (-4.9d-48)) .or. (.not. (z <= 3.1d-14))) then
tmp = x + (y / (z / (z - t)))
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 <= -4.9e-48) || !(z <= 3.1e-14)) {
tmp = x + (y / (z / (z - t)));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.9e-48) or not (z <= 3.1e-14): tmp = x + (y / (z / (z - t))) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.9e-48) || !(z <= 3.1e-14)) tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); 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 <= -4.9e-48) || ~((z <= 3.1e-14))) tmp = x + (y / (z / (z - t))); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.9e-48], N[Not[LessEqual[z, 3.1e-14]], $MachinePrecision]], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.9 \cdot 10^{-48} \lor \neg \left(z \leq 3.1 \cdot 10^{-14}\right):\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -4.9000000000000002e-48 or 3.10000000000000004e-14 < z Initial program 74.5%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in a around 0 90.6%
if -4.9000000000000002e-48 < z < 3.10000000000000004e-14Initial program 98.5%
+-commutative98.5%
associate-*r/97.5%
fma-def97.5%
Simplified97.5%
fma-udef97.5%
Applied egg-rr97.5%
Taylor expanded in z around 0 77.2%
Final simplification84.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.4e+44) (not (<= t 4600000000.0))) (- x (* t (/ y (- z a)))) (+ x (/ y (/ (- z a) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.4e+44) || !(t <= 4600000000.0)) {
tmp = x - (t * (y / (z - a)));
} else {
tmp = x + (y / ((z - 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 ((t <= (-4.4d+44)) .or. (.not. (t <= 4600000000.0d0))) then
tmp = x - (t * (y / (z - a)))
else
tmp = x + (y / ((z - 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 ((t <= -4.4e+44) || !(t <= 4600000000.0)) {
tmp = x - (t * (y / (z - a)));
} else {
tmp = x + (y / ((z - a) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.4e+44) or not (t <= 4600000000.0): tmp = x - (t * (y / (z - a))) else: tmp = x + (y / ((z - a) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.4e+44) || !(t <= 4600000000.0)) tmp = Float64(x - Float64(t * Float64(y / Float64(z - a)))); else tmp = Float64(x + Float64(y / Float64(Float64(z - a) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.4e+44) || ~((t <= 4600000000.0))) tmp = x - (t * (y / (z - a))); else tmp = x + (y / ((z - a) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.4e+44], N[Not[LessEqual[t, 4600000000.0]], $MachinePrecision]], N[(x - N[(t * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.4 \cdot 10^{+44} \lor \neg \left(t \leq 4600000000\right):\\
\;\;\;\;x - t \cdot \frac{y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\
\end{array}
\end{array}
if t < -4.39999999999999991e44 or 4.6e9 < t Initial program 87.6%
associate-*l/95.1%
Simplified95.1%
Taylor expanded in t around inf 83.8%
associate-*r/83.8%
mul-1-neg83.8%
distribute-rgt-neg-out83.8%
associate-*l/87.2%
Simplified87.2%
Taylor expanded in x around 0 83.8%
+-commutative83.8%
mul-1-neg83.8%
*-commutative83.8%
associate-*r/87.2%
sub-neg87.2%
Simplified87.2%
if -4.39999999999999991e44 < t < 4.6e9Initial program 83.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t around 0 95.6%
Final simplification92.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.15e+40) (- x (* t (/ y (- z a)))) (if (<= t 6.2e+17) (+ x (/ y (/ (- z a) z))) (+ x (/ y (/ (- a z) t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.15e+40) {
tmp = x - (t * (y / (z - a)));
} else if (t <= 6.2e+17) {
tmp = x + (y / ((z - a) / z));
} 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 (t <= (-1.15d+40)) then
tmp = x - (t * (y / (z - a)))
else if (t <= 6.2d+17) then
tmp = x + (y / ((z - a) / z))
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 (t <= -1.15e+40) {
tmp = x - (t * (y / (z - a)));
} else if (t <= 6.2e+17) {
tmp = x + (y / ((z - a) / z));
} else {
tmp = x + (y / ((a - z) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.15e+40: tmp = x - (t * (y / (z - a))) elif t <= 6.2e+17: tmp = x + (y / ((z - a) / z)) else: tmp = x + (y / ((a - z) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.15e+40) tmp = Float64(x - Float64(t * Float64(y / Float64(z - a)))); elseif (t <= 6.2e+17) tmp = Float64(x + Float64(y / Float64(Float64(z - a) / z))); 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 (t <= -1.15e+40) tmp = x - (t * (y / (z - a))); elseif (t <= 6.2e+17) tmp = x + (y / ((z - a) / z)); else tmp = x + (y / ((a - z) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.15e+40], N[(x - N[(t * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.2e+17], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.15 \cdot 10^{+40}:\\
\;\;\;\;x - t \cdot \frac{y}{z - a}\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{+17}:\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - z}{t}}\\
\end{array}
\end{array}
if t < -1.14999999999999997e40Initial program 90.6%
associate-*l/94.6%
Simplified94.6%
Taylor expanded in t around inf 83.6%
associate-*r/83.6%
mul-1-neg83.6%
distribute-rgt-neg-out83.6%
associate-*l/86.1%
Simplified86.1%
Taylor expanded in x around 0 83.6%
+-commutative83.6%
mul-1-neg83.6%
*-commutative83.6%
associate-*r/86.1%
sub-neg86.1%
Simplified86.1%
if -1.14999999999999997e40 < t < 6.2e17Initial program 83.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t around 0 95.6%
if 6.2e17 < t Initial program 85.7%
associate-/l*98.4%
Simplified98.4%
Taylor expanded in t around inf 90.7%
associate-*r/90.7%
neg-mul-190.7%
sub-neg90.7%
mul-1-neg90.7%
distribute-neg-in90.7%
mul-1-neg90.7%
remove-double-neg90.7%
Simplified90.7%
Final simplification92.8%
(FPCore (x y z t a) :precision binary64 (+ x (* (- z t) (/ y (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / (z - a)));
}
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 + ((z - t) * (y / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / (z - a)));
}
def code(x, y, z, t, a): return x + ((z - t) * (y / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) * Float64(y / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) * (y / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - t\right) \cdot \frac{y}{z - a}
\end{array}
Initial program 85.4%
associate-*l/95.3%
Simplified95.3%
Final simplification95.3%
(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(y / Float64(Float64(z - a) / Float64(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[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}
Initial program 85.4%
associate-/l*98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
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) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Initial program 85.4%
+-commutative85.4%
associate-*r/98.8%
fma-def98.8%
Simplified98.8%
fma-udef98.8%
Applied egg-rr98.8%
Final simplification98.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -8.5e+175) x (if (<= a 1.65e+116) (+ y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -8.5e+175) {
tmp = x;
} else if (a <= 1.65e+116) {
tmp = y + 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 (a <= (-8.5d+175)) then
tmp = x
else if (a <= 1.65d+116) then
tmp = y + 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 (a <= -8.5e+175) {
tmp = x;
} else if (a <= 1.65e+116) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -8.5e+175: tmp = x elif a <= 1.65e+116: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -8.5e+175) tmp = x; elseif (a <= 1.65e+116) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -8.5e+175) tmp = x; elseif (a <= 1.65e+116) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -8.5e+175], x, If[LessEqual[a, 1.65e+116], N[(y + x), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.5 \cdot 10^{+175}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.65 \cdot 10^{+116}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -8.50000000000000034e175 or 1.6499999999999999e116 < a Initial program 87.4%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in x around inf 74.4%
if -8.50000000000000034e175 < a < 1.6499999999999999e116Initial program 84.7%
associate-*l/94.8%
Simplified94.8%
Taylor expanded in z around inf 64.1%
Final simplification66.5%
(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 85.4%
associate-*l/95.3%
Simplified95.3%
Taylor expanded in x around inf 48.8%
Final simplification48.8%
(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(y / Float64(Float64(z - a) / Float64(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[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}
herbie shell --seed 2023240
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(+ x (/ y (/ (- z a) (- z t))))
(+ x (/ (* y (- z t)) (- z a))))