
(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}
Sampling outcomes in binary64 precision:
Herbie found 12 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(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}
(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 98.8%
associate-*r/82.9%
associate-/l*98.8%
Applied egg-rr98.8%
Final simplification98.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ z (- z a))))))
(if (<= z -5.4e-44)
t_1
(if (<= z 1.46e-61)
(+ x (* y (/ t a)))
(if (<= z 0.007)
(- x (/ (* y t) z))
(if (<= z 8.5e+49)
(+ x (/ y (/ a t)))
(if (<= z 3.2e+61) (- x (* t (/ y z))) t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (z / (z - a)));
double tmp;
if (z <= -5.4e-44) {
tmp = t_1;
} else if (z <= 1.46e-61) {
tmp = x + (y * (t / a));
} else if (z <= 0.007) {
tmp = x - ((y * t) / z);
} else if (z <= 8.5e+49) {
tmp = x + (y / (a / t));
} else if (z <= 3.2e+61) {
tmp = x - (t * (y / 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 / (z - a)))
if (z <= (-5.4d-44)) then
tmp = t_1
else if (z <= 1.46d-61) then
tmp = x + (y * (t / a))
else if (z <= 0.007d0) then
tmp = x - ((y * t) / z)
else if (z <= 8.5d+49) then
tmp = x + (y / (a / t))
else if (z <= 3.2d+61) then
tmp = x - (t * (y / 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 / (z - a)));
double tmp;
if (z <= -5.4e-44) {
tmp = t_1;
} else if (z <= 1.46e-61) {
tmp = x + (y * (t / a));
} else if (z <= 0.007) {
tmp = x - ((y * t) / z);
} else if (z <= 8.5e+49) {
tmp = x + (y / (a / t));
} else if (z <= 3.2e+61) {
tmp = x - (t * (y / z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * (z / (z - a))) tmp = 0 if z <= -5.4e-44: tmp = t_1 elif z <= 1.46e-61: tmp = x + (y * (t / a)) elif z <= 0.007: tmp = x - ((y * t) / z) elif z <= 8.5e+49: tmp = x + (y / (a / t)) elif z <= 3.2e+61: tmp = x - (t * (y / z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(z / Float64(z - a)))) tmp = 0.0 if (z <= -5.4e-44) tmp = t_1; elseif (z <= 1.46e-61) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 0.007) tmp = Float64(x - Float64(Float64(y * t) / z)); elseif (z <= 8.5e+49) tmp = Float64(x + Float64(y / Float64(a / t))); elseif (z <= 3.2e+61) tmp = Float64(x - Float64(t * Float64(y / z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * (z / (z - a))); tmp = 0.0; if (z <= -5.4e-44) tmp = t_1; elseif (z <= 1.46e-61) tmp = x + (y * (t / a)); elseif (z <= 0.007) tmp = x - ((y * t) / z); elseif (z <= 8.5e+49) tmp = x + (y / (a / t)); elseif (z <= 3.2e+61) tmp = x - (t * (y / z)); 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 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.4e-44], t$95$1, If[LessEqual[z, 1.46e-61], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.007], N[(x - N[(N[(y * t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e+49], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e+61], N[(x - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z}{z - a}\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{-44}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.46 \cdot 10^{-61}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 0.007:\\
\;\;\;\;x - \frac{y \cdot t}{z}\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+49}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+61}:\\
\;\;\;\;x - t \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -5.3999999999999998e-44 or 3.1999999999999998e61 < z Initial program 100.0%
Taylor expanded in t around 0 92.3%
if -5.3999999999999998e-44 < z < 1.46e-61Initial program 96.8%
Taylor expanded in z around 0 85.4%
if 1.46e-61 < z < 0.00700000000000000015Initial program 99.8%
+-commutative99.8%
associate-*r/99.9%
associate-*l/99.7%
*-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in a around 0 78.1%
associate-/l*78.1%
Simplified78.1%
Taylor expanded in z around 0 77.9%
associate-*r/77.9%
associate-*r*77.9%
neg-mul-177.9%
Simplified77.9%
if 0.00700000000000000015 < z < 8.4999999999999996e49Initial program 99.7%
+-commutative99.7%
associate-*r/93.6%
associate-*l/99.8%
*-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in z around 0 76.7%
associate-/l*83.1%
Simplified83.1%
if 8.4999999999999996e49 < z < 3.1999999999999998e61Initial program 99.7%
+-commutative99.7%
associate-*r/99.7%
associate-*l/100.0%
*-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in a around 0 99.7%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in z around 0 99.7%
associate-*r/99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
associate-*l/100.0%
*-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Final simplification88.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.6e-37)
(+ x y)
(if (<= z 4e-61)
(+ x (* y (/ t a)))
(if (<= z 0.0152)
(- x (* t (/ y z)))
(if (<= z 7.6e+61) (+ x (/ y (/ a t))) (+ x y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.6e-37) {
tmp = x + y;
} else if (z <= 4e-61) {
tmp = x + (y * (t / a));
} else if (z <= 0.0152) {
tmp = x - (t * (y / z));
} else if (z <= 7.6e+61) {
tmp = x + (y / (a / t));
} else {
tmp = x + 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 <= (-3.6d-37)) then
tmp = x + y
else if (z <= 4d-61) then
tmp = x + (y * (t / a))
else if (z <= 0.0152d0) then
tmp = x - (t * (y / z))
else if (z <= 7.6d+61) then
tmp = x + (y / (a / t))
else
tmp = x + 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 <= -3.6e-37) {
tmp = x + y;
} else if (z <= 4e-61) {
tmp = x + (y * (t / a));
} else if (z <= 0.0152) {
tmp = x - (t * (y / z));
} else if (z <= 7.6e+61) {
tmp = x + (y / (a / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.6e-37: tmp = x + y elif z <= 4e-61: tmp = x + (y * (t / a)) elif z <= 0.0152: tmp = x - (t * (y / z)) elif z <= 7.6e+61: tmp = x + (y / (a / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.6e-37) tmp = Float64(x + y); elseif (z <= 4e-61) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 0.0152) tmp = Float64(x - Float64(t * Float64(y / z))); elseif (z <= 7.6e+61) tmp = Float64(x + Float64(y / Float64(a / t))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.6e-37) tmp = x + y; elseif (z <= 4e-61) tmp = x + (y * (t / a)); elseif (z <= 0.0152) tmp = x - (t * (y / z)); elseif (z <= 7.6e+61) tmp = x + (y / (a / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.6e-37], N[(x + y), $MachinePrecision], If[LessEqual[z, 4e-61], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0152], N[(x - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.6e+61], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{-37}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-61}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 0.0152:\\
\;\;\;\;x - t \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+61}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -3.60000000000000007e-37 or 7.5999999999999999e61 < z Initial program 100.0%
+-commutative100.0%
associate-*r/68.9%
associate-*l/97.6%
*-commutative97.6%
fma-def97.6%
Simplified97.6%
Taylor expanded in z around inf 85.3%
if -3.60000000000000007e-37 < z < 4.0000000000000002e-61Initial program 96.8%
Taylor expanded in z around 0 85.4%
if 4.0000000000000002e-61 < z < 0.0152Initial program 99.8%
+-commutative99.8%
associate-*r/99.9%
associate-*l/99.7%
*-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in a around 0 78.1%
associate-/l*78.1%
Simplified78.1%
Taylor expanded in z around 0 77.9%
associate-*r/77.9%
mul-1-neg77.9%
distribute-rgt-neg-in77.9%
associate-*l/77.8%
*-commutative77.8%
distribute-lft-neg-out77.8%
distribute-rgt-neg-in77.8%
Simplified77.8%
if 0.0152 < z < 7.5999999999999999e61Initial program 99.7%
+-commutative99.7%
associate-*r/91.3%
associate-*l/99.9%
*-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around 0 66.6%
associate-/l*75.2%
Simplified75.2%
Final simplification83.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4.8e-37)
(+ x y)
(if (<= z 1.5e-61)
(+ x (* y (/ t a)))
(if (<= z 0.0075)
(+ x (/ y (/ (- z) t)))
(if (<= z 9.4e+61) (+ x (/ y (/ a t))) (+ x y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.8e-37) {
tmp = x + y;
} else if (z <= 1.5e-61) {
tmp = x + (y * (t / a));
} else if (z <= 0.0075) {
tmp = x + (y / (-z / t));
} else if (z <= 9.4e+61) {
tmp = x + (y / (a / t));
} else {
tmp = x + 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.8d-37)) then
tmp = x + y
else if (z <= 1.5d-61) then
tmp = x + (y * (t / a))
else if (z <= 0.0075d0) then
tmp = x + (y / (-z / t))
else if (z <= 9.4d+61) then
tmp = x + (y / (a / t))
else
tmp = x + 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.8e-37) {
tmp = x + y;
} else if (z <= 1.5e-61) {
tmp = x + (y * (t / a));
} else if (z <= 0.0075) {
tmp = x + (y / (-z / t));
} else if (z <= 9.4e+61) {
tmp = x + (y / (a / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.8e-37: tmp = x + y elif z <= 1.5e-61: tmp = x + (y * (t / a)) elif z <= 0.0075: tmp = x + (y / (-z / t)) elif z <= 9.4e+61: tmp = x + (y / (a / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.8e-37) tmp = Float64(x + y); elseif (z <= 1.5e-61) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 0.0075) tmp = Float64(x + Float64(y / Float64(Float64(-z) / t))); elseif (z <= 9.4e+61) tmp = Float64(x + Float64(y / Float64(a / t))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.8e-37) tmp = x + y; elseif (z <= 1.5e-61) tmp = x + (y * (t / a)); elseif (z <= 0.0075) tmp = x + (y / (-z / t)); elseif (z <= 9.4e+61) tmp = x + (y / (a / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.8e-37], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.5e-61], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0075], N[(x + N[(y / N[((-z) / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.4e+61], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-37}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-61}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 0.0075:\\
\;\;\;\;x + \frac{y}{\frac{-z}{t}}\\
\mathbf{elif}\;z \leq 9.4 \cdot 10^{+61}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -4.79999999999999982e-37 or 9.3999999999999997e61 < z Initial program 100.0%
+-commutative100.0%
associate-*r/68.9%
associate-*l/97.6%
*-commutative97.6%
fma-def97.6%
Simplified97.6%
Taylor expanded in z around inf 85.3%
if -4.79999999999999982e-37 < z < 1.50000000000000006e-61Initial program 96.8%
Taylor expanded in z around 0 85.4%
if 1.50000000000000006e-61 < z < 0.0074999999999999997Initial program 99.8%
+-commutative99.8%
associate-*r/99.9%
associate-*l/99.7%
*-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in a around 0 78.1%
associate-/l*78.1%
Simplified78.1%
Taylor expanded in z around 0 77.8%
associate-*r/77.8%
neg-mul-177.8%
Simplified77.8%
if 0.0074999999999999997 < z < 9.3999999999999997e61Initial program 99.7%
+-commutative99.7%
associate-*r/91.3%
associate-*l/99.9%
*-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around 0 66.6%
associate-/l*75.2%
Simplified75.2%
Final simplification83.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4.6e-38)
(+ x y)
(if (<= z 8.8e-59)
(+ x (* y (/ t a)))
(if (<= z 0.145)
(- x (/ (* y t) z))
(if (<= z 5.5e+61) (+ x (/ y (/ a t))) (+ x y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.6e-38) {
tmp = x + y;
} else if (z <= 8.8e-59) {
tmp = x + (y * (t / a));
} else if (z <= 0.145) {
tmp = x - ((y * t) / z);
} else if (z <= 5.5e+61) {
tmp = x + (y / (a / t));
} else {
tmp = x + 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.6d-38)) then
tmp = x + y
else if (z <= 8.8d-59) then
tmp = x + (y * (t / a))
else if (z <= 0.145d0) then
tmp = x - ((y * t) / z)
else if (z <= 5.5d+61) then
tmp = x + (y / (a / t))
else
tmp = x + 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.6e-38) {
tmp = x + y;
} else if (z <= 8.8e-59) {
tmp = x + (y * (t / a));
} else if (z <= 0.145) {
tmp = x - ((y * t) / z);
} else if (z <= 5.5e+61) {
tmp = x + (y / (a / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.6e-38: tmp = x + y elif z <= 8.8e-59: tmp = x + (y * (t / a)) elif z <= 0.145: tmp = x - ((y * t) / z) elif z <= 5.5e+61: tmp = x + (y / (a / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.6e-38) tmp = Float64(x + y); elseif (z <= 8.8e-59) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 0.145) tmp = Float64(x - Float64(Float64(y * t) / z)); elseif (z <= 5.5e+61) tmp = Float64(x + Float64(y / Float64(a / t))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.6e-38) tmp = x + y; elseif (z <= 8.8e-59) tmp = x + (y * (t / a)); elseif (z <= 0.145) tmp = x - ((y * t) / z); elseif (z <= 5.5e+61) tmp = x + (y / (a / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.6e-38], N[(x + y), $MachinePrecision], If[LessEqual[z, 8.8e-59], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.145], N[(x - N[(N[(y * t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.5e+61], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{-38}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{-59}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 0.145:\\
\;\;\;\;x - \frac{y \cdot t}{z}\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{+61}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -4.60000000000000003e-38 or 5.50000000000000036e61 < z Initial program 100.0%
+-commutative100.0%
associate-*r/68.9%
associate-*l/97.6%
*-commutative97.6%
fma-def97.6%
Simplified97.6%
Taylor expanded in z around inf 85.3%
if -4.60000000000000003e-38 < z < 8.7999999999999995e-59Initial program 96.8%
Taylor expanded in z around 0 85.4%
if 8.7999999999999995e-59 < z < 0.14499999999999999Initial program 99.8%
+-commutative99.8%
associate-*r/99.9%
associate-*l/99.7%
*-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in a around 0 78.1%
associate-/l*78.1%
Simplified78.1%
Taylor expanded in z around 0 77.9%
associate-*r/77.9%
associate-*r*77.9%
neg-mul-177.9%
Simplified77.9%
if 0.14499999999999999 < z < 5.50000000000000036e61Initial program 99.7%
+-commutative99.7%
associate-*r/91.3%
associate-*l/99.9%
*-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around 0 66.6%
associate-/l*75.2%
Simplified75.2%
Final simplification84.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.8e+65) (not (<= z 2.6e+62))) (+ x (* y (/ z (- z a)))) (+ x (/ y (/ (- a z) t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.8e+65) || !(z <= 2.6e+62)) {
tmp = x + (y * (z / (z - a)));
} 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 <= (-1.8d+65)) .or. (.not. (z <= 2.6d+62))) then
tmp = x + (y * (z / (z - a)))
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 <= -1.8e+65) || !(z <= 2.6e+62)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + (y / ((a - z) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.8e+65) or not (z <= 2.6e+62): tmp = x + (y * (z / (z - a))) else: tmp = x + (y / ((a - z) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.8e+65) || !(z <= 2.6e+62)) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); 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 <= -1.8e+65) || ~((z <= 2.6e+62))) tmp = x + (y * (z / (z - a))); else tmp = x + (y / ((a - z) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.8e+65], N[Not[LessEqual[z, 2.6e+62]], $MachinePrecision]], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+65} \lor \neg \left(z \leq 2.6 \cdot 10^{+62}\right):\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - z}{t}}\\
\end{array}
\end{array}
if z < -1.79999999999999989e65 or 2.59999999999999984e62 < z Initial program 99.9%
Taylor expanded in t around 0 94.9%
if -1.79999999999999989e65 < z < 2.59999999999999984e62Initial program 98.0%
associate-*r/95.5%
associate-/l*98.0%
Applied egg-rr98.0%
Taylor expanded in t around inf 89.8%
associate-*r/89.8%
neg-mul-189.8%
neg-sub089.8%
associate--r-89.8%
neg-sub089.8%
Simplified89.8%
Taylor expanded in z around 0 89.8%
mul-1-neg89.8%
sub-neg89.8%
div-sub89.8%
Simplified89.8%
Final simplification91.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.8e+65) (+ x (/ y (- 1.0 (/ a z)))) (if (<= z 1.2e+62) (+ x (/ y (/ (- a z) t))) (+ x (* y (/ z (- z a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.8e+65) {
tmp = x + (y / (1.0 - (a / z)));
} else if (z <= 1.2e+62) {
tmp = x + (y / ((a - z) / t));
} else {
tmp = x + (y * (z / (z - 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 <= (-5.8d+65)) then
tmp = x + (y / (1.0d0 - (a / z)))
else if (z <= 1.2d+62) then
tmp = x + (y / ((a - z) / t))
else
tmp = x + (y * (z / (z - 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 <= -5.8e+65) {
tmp = x + (y / (1.0 - (a / z)));
} else if (z <= 1.2e+62) {
tmp = x + (y / ((a - z) / t));
} else {
tmp = x + (y * (z / (z - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.8e+65: tmp = x + (y / (1.0 - (a / z))) elif z <= 1.2e+62: tmp = x + (y / ((a - z) / t)) else: tmp = x + (y * (z / (z - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.8e+65) tmp = Float64(x + Float64(y / Float64(1.0 - Float64(a / z)))); elseif (z <= 1.2e+62) tmp = Float64(x + Float64(y / Float64(Float64(a - z) / t))); else tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5.8e+65) tmp = x + (y / (1.0 - (a / z))); elseif (z <= 1.2e+62) tmp = x + (y / ((a - z) / t)); else tmp = x + (y * (z / (z - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.8e+65], N[(x + N[(y / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e+62], N[(x + N[(y / N[(N[(a - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+65}:\\
\;\;\;\;x + \frac{y}{1 - \frac{a}{z}}\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+62}:\\
\;\;\;\;x + \frac{y}{\frac{a - z}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\end{array}
\end{array}
if z < -5.8000000000000001e65Initial program 99.9%
+-commutative99.9%
associate-*r/64.8%
associate-*l/96.6%
*-commutative96.6%
fma-def96.6%
Simplified96.6%
Taylor expanded in t around 0 62.2%
associate-/l*96.8%
div-sub96.8%
*-inverses96.8%
Simplified96.8%
if -5.8000000000000001e65 < z < 1.2e62Initial program 98.0%
associate-*r/95.5%
associate-/l*98.0%
Applied egg-rr98.0%
Taylor expanded in t around inf 89.8%
associate-*r/89.8%
neg-mul-189.8%
neg-sub089.8%
associate--r-89.8%
neg-sub089.8%
Simplified89.8%
Taylor expanded in z around 0 89.8%
mul-1-neg89.8%
sub-neg89.8%
div-sub89.8%
Simplified89.8%
if 1.2e62 < z Initial program 100.0%
Taylor expanded in t around 0 93.1%
Final simplification91.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.52e-43) (not (<= z 1.2e+62))) (+ x y) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.52e-43) || !(z <= 1.2e+62)) {
tmp = x + y;
} 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.52d-43)) .or. (.not. (z <= 1.2d+62))) then
tmp = x + y
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.52e-43) || !(z <= 1.2e+62)) {
tmp = x + y;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.52e-43) or not (z <= 1.2e+62): tmp = x + y else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.52e-43) || !(z <= 1.2e+62)) tmp = Float64(x + y); 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.52e-43) || ~((z <= 1.2e+62))) tmp = x + y; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.52e-43], N[Not[LessEqual[z, 1.2e+62]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.52 \cdot 10^{-43} \lor \neg \left(z \leq 1.2 \cdot 10^{+62}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -1.52e-43 or 1.2e62 < z Initial program 100.0%
+-commutative100.0%
associate-*r/68.9%
associate-*l/97.6%
*-commutative97.6%
fma-def97.6%
Simplified97.6%
Taylor expanded in z around inf 85.3%
if -1.52e-43 < z < 1.2e62Initial program 97.7%
Taylor expanded in z around 0 78.1%
Final simplification81.6%
(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 98.8%
Final simplification98.8%
(FPCore (x y z t a) :precision binary64 (if (<= y -3e+232) y (if (<= y -5.5e+135) x (if (<= y -1.36e+45) y (if (<= y 5.3e+129) x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3e+232) {
tmp = y;
} else if (y <= -5.5e+135) {
tmp = x;
} else if (y <= -1.36e+45) {
tmp = y;
} else if (y <= 5.3e+129) {
tmp = x;
} else {
tmp = 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 (y <= (-3d+232)) then
tmp = y
else if (y <= (-5.5d+135)) then
tmp = x
else if (y <= (-1.36d+45)) then
tmp = y
else if (y <= 5.3d+129) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3e+232) {
tmp = y;
} else if (y <= -5.5e+135) {
tmp = x;
} else if (y <= -1.36e+45) {
tmp = y;
} else if (y <= 5.3e+129) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -3e+232: tmp = y elif y <= -5.5e+135: tmp = x elif y <= -1.36e+45: tmp = y elif y <= 5.3e+129: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -3e+232) tmp = y; elseif (y <= -5.5e+135) tmp = x; elseif (y <= -1.36e+45) tmp = y; elseif (y <= 5.3e+129) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -3e+232) tmp = y; elseif (y <= -5.5e+135) tmp = x; elseif (y <= -1.36e+45) tmp = y; elseif (y <= 5.3e+129) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -3e+232], y, If[LessEqual[y, -5.5e+135], x, If[LessEqual[y, -1.36e+45], y, If[LessEqual[y, 5.3e+129], x, y]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+232}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq -5.5 \cdot 10^{+135}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.36 \cdot 10^{+45}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 5.3 \cdot 10^{+129}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -3.00000000000000003e232 or -5.4999999999999999e135 < y < -1.36e45 or 5.2999999999999999e129 < y Initial program 99.8%
+-commutative99.8%
associate-*r/55.7%
associate-*l/97.1%
*-commutative97.1%
fma-def97.1%
Simplified97.1%
Taylor expanded in t around 0 26.5%
associate-/l*62.9%
div-sub62.9%
*-inverses62.9%
Simplified62.9%
Taylor expanded in y around inf 52.6%
Taylor expanded in a around 0 45.7%
if -3.00000000000000003e232 < y < -5.4999999999999999e135 or -1.36e45 < y < 5.2999999999999999e129Initial program 98.4%
+-commutative98.4%
associate-*r/93.2%
associate-*l/97.0%
*-commutative97.0%
fma-def96.9%
Simplified96.9%
Taylor expanded in y around 0 73.7%
Final simplification66.1%
(FPCore (x y z t a) :precision binary64 (if (<= a -5.5e+152) x (if (<= a 6.5e+182) (+ x y) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5.5e+152) {
tmp = x;
} else if (a <= 6.5e+182) {
tmp = x + y;
} 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 <= (-5.5d+152)) then
tmp = x
else if (a <= 6.5d+182) then
tmp = x + y
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 <= -5.5e+152) {
tmp = x;
} else if (a <= 6.5e+182) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -5.5e+152: tmp = x elif a <= 6.5e+182: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5.5e+152) tmp = x; elseif (a <= 6.5e+182) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -5.5e+152) tmp = x; elseif (a <= 6.5e+182) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5.5e+152], x, If[LessEqual[a, 6.5e+182], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.5 \cdot 10^{+152}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 6.5 \cdot 10^{+182}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -5.4999999999999999e152 or 6.4999999999999998e182 < a Initial program 99.9%
+-commutative99.9%
associate-*r/87.3%
associate-*l/94.0%
*-commutative94.0%
fma-def94.0%
Simplified94.0%
Taylor expanded in y around 0 73.7%
if -5.4999999999999999e152 < a < 6.4999999999999998e182Initial program 98.5%
+-commutative98.5%
associate-*r/81.6%
associate-*l/97.9%
*-commutative97.9%
fma-def97.9%
Simplified97.9%
Taylor expanded in z around inf 72.3%
Final simplification72.6%
(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 98.8%
+-commutative98.8%
associate-*r/82.9%
associate-*l/97.0%
*-commutative97.0%
fma-def97.0%
Simplified97.0%
Taylor expanded in y around 0 56.6%
Final simplification56.6%
(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 2023257
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(+ x (/ y (/ (- z a) (- z t))))
(+ x (* y (/ (- z t) (- z a)))))