
(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 (+ x (* (/ (- z t) (- z a)) y)))
double code(double x, double y, double z, double t, double a) {
return x + (((z - t) / (z - a)) * y);
}
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) / (z - a)) * y)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((z - t) / (z - a)) * y);
}
def code(x, y, z, t, a): return x + (((z - t) / (z - a)) * y)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(z - t) / Float64(z - a)) * y)) end
function tmp = code(x, y, z, t, a) tmp = x + (((z - t) / (z - a)) * y); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - t}{z - a} \cdot y
\end{array}
Initial program 82.9%
*-commutative82.9%
associate-/l*96.8%
associate-/r/99.2%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -13500.0)
(+ x y)
(if (<= z 1.58e-115)
(+ x (* y (/ t a)))
(if (<= z 1.95e+90) (+ x (/ y (- (/ z t)))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -13500.0) {
tmp = x + y;
} else if (z <= 1.58e-115) {
tmp = x + (y * (t / a));
} else if (z <= 1.95e+90) {
tmp = x + (y / -(z / 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 <= (-13500.0d0)) then
tmp = x + y
else if (z <= 1.58d-115) then
tmp = x + (y * (t / a))
else if (z <= 1.95d+90) then
tmp = x + (y / -(z / 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 <= -13500.0) {
tmp = x + y;
} else if (z <= 1.58e-115) {
tmp = x + (y * (t / a));
} else if (z <= 1.95e+90) {
tmp = x + (y / -(z / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -13500.0: tmp = x + y elif z <= 1.58e-115: tmp = x + (y * (t / a)) elif z <= 1.95e+90: tmp = x + (y / -(z / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -13500.0) tmp = Float64(x + y); elseif (z <= 1.58e-115) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 1.95e+90) tmp = Float64(x + Float64(y / Float64(-Float64(z / t)))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -13500.0) tmp = x + y; elseif (z <= 1.58e-115) tmp = x + (y * (t / a)); elseif (z <= 1.95e+90) tmp = x + (y / -(z / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -13500.0], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.58e-115], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.95e+90], N[(x + N[(y / (-N[(z / t), $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -13500:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.58 \cdot 10^{-115}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{+90}:\\
\;\;\;\;x + \frac{y}{-\frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -13500 or 1.9500000000000001e90 < z Initial program 69.1%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in z around inf 77.7%
+-commutative77.7%
Simplified77.7%
if -13500 < z < 1.58e-115Initial program 94.3%
*-commutative94.3%
associate-/l*95.5%
associate-/r/97.7%
Applied egg-rr97.7%
Taylor expanded in z around 0 89.0%
if 1.58e-115 < z < 1.9500000000000001e90Initial program 98.0%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in a around 0 74.8%
+-commutative74.8%
associate-/l*76.7%
Simplified76.7%
Taylor expanded in z around 0 76.8%
associate-*r/76.8%
neg-mul-176.8%
Simplified76.8%
Final simplification81.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -8.5e-5)
(+ x y)
(if (<= z 1.58e-115)
(+ x (* y (/ t a)))
(if (<= z 3.3e+84) (- x (* t (/ y z))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8.5e-5) {
tmp = x + y;
} else if (z <= 1.58e-115) {
tmp = x + (y * (t / a));
} else if (z <= 3.3e+84) {
tmp = x - (t * (y / z));
} 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 <= (-8.5d-5)) then
tmp = x + y
else if (z <= 1.58d-115) then
tmp = x + (y * (t / a))
else if (z <= 3.3d+84) then
tmp = x - (t * (y / z))
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 <= -8.5e-5) {
tmp = x + y;
} else if (z <= 1.58e-115) {
tmp = x + (y * (t / a));
} else if (z <= 3.3e+84) {
tmp = x - (t * (y / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -8.5e-5: tmp = x + y elif z <= 1.58e-115: tmp = x + (y * (t / a)) elif z <= 3.3e+84: tmp = x - (t * (y / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8.5e-5) tmp = Float64(x + y); elseif (z <= 1.58e-115) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 3.3e+84) tmp = Float64(x - Float64(t * Float64(y / z))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -8.5e-5) tmp = x + y; elseif (z <= 1.58e-115) tmp = x + (y * (t / a)); elseif (z <= 3.3e+84) tmp = x - (t * (y / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8.5e-5], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.58e-115], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.3e+84], N[(x - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-5}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.58 \cdot 10^{-115}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+84}:\\
\;\;\;\;x - t \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -8.500000000000001e-5 or 3.30000000000000017e84 < z Initial program 69.1%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in z around inf 77.7%
+-commutative77.7%
Simplified77.7%
if -8.500000000000001e-5 < z < 1.58e-115Initial program 94.3%
*-commutative94.3%
associate-/l*95.5%
associate-/r/97.7%
Applied egg-rr97.7%
Taylor expanded in z around 0 89.0%
if 1.58e-115 < z < 3.30000000000000017e84Initial program 98.0%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in t around inf 85.9%
associate-/l*87.7%
associate-*r/87.7%
neg-mul-187.7%
Simplified87.7%
div-inv87.7%
/-rgt-identity87.7%
cancel-sign-sub-inv87.7%
/-rgt-identity87.7%
clear-num87.7%
Applied egg-rr87.7%
Taylor expanded in z around inf 74.9%
*-lft-identity74.9%
times-frac76.8%
/-rgt-identity76.8%
Simplified76.8%
Final simplification81.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1150000.0)
(+ x y)
(if (<= z 1.58e-115)
(+ x (* y (/ t a)))
(if (<= z 2.15e+82) (- x (/ t (/ z y))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1150000.0) {
tmp = x + y;
} else if (z <= 1.58e-115) {
tmp = x + (y * (t / a));
} else if (z <= 2.15e+82) {
tmp = x - (t / (z / y));
} 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 <= (-1150000.0d0)) then
tmp = x + y
else if (z <= 1.58d-115) then
tmp = x + (y * (t / a))
else if (z <= 2.15d+82) then
tmp = x - (t / (z / y))
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 <= -1150000.0) {
tmp = x + y;
} else if (z <= 1.58e-115) {
tmp = x + (y * (t / a));
} else if (z <= 2.15e+82) {
tmp = x - (t / (z / y));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1150000.0: tmp = x + y elif z <= 1.58e-115: tmp = x + (y * (t / a)) elif z <= 2.15e+82: tmp = x - (t / (z / y)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1150000.0) tmp = Float64(x + y); elseif (z <= 1.58e-115) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 2.15e+82) tmp = Float64(x - Float64(t / Float64(z / y))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1150000.0) tmp = x + y; elseif (z <= 1.58e-115) tmp = x + (y * (t / a)); elseif (z <= 2.15e+82) tmp = x - (t / (z / y)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1150000.0], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.58e-115], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.15e+82], N[(x - N[(t / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1150000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.58 \cdot 10^{-115}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+82}:\\
\;\;\;\;x - \frac{t}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1.15e6 or 2.15000000000000007e82 < z Initial program 69.1%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in z around inf 77.7%
+-commutative77.7%
Simplified77.7%
if -1.15e6 < z < 1.58e-115Initial program 94.3%
*-commutative94.3%
associate-/l*95.5%
associate-/r/97.7%
Applied egg-rr97.7%
Taylor expanded in z around 0 89.0%
if 1.58e-115 < z < 2.15000000000000007e82Initial program 98.0%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in t around inf 85.9%
associate-/l*87.7%
associate-*r/87.7%
neg-mul-187.7%
Simplified87.7%
div-inv87.7%
/-rgt-identity87.7%
cancel-sign-sub-inv87.7%
/-rgt-identity87.7%
clear-num87.7%
Applied egg-rr87.7%
Taylor expanded in z around inf 74.9%
associate-/l*76.8%
Simplified76.8%
Final simplification81.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5e-8) (not (<= z 1.58e-115))) (+ x (* (- z t) (/ y z))) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5e-8) || !(z <= 1.58e-115)) {
tmp = x + ((z - t) * (y / z));
} 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 <= (-5d-8)) .or. (.not. (z <= 1.58d-115))) then
tmp = x + ((z - t) * (y / z))
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 <= -5e-8) || !(z <= 1.58e-115)) {
tmp = x + ((z - t) * (y / z));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5e-8) or not (z <= 1.58e-115): tmp = x + ((z - t) * (y / z)) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5e-8) || !(z <= 1.58e-115)) tmp = Float64(x + Float64(Float64(z - t) * Float64(y / z))); 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 <= -5e-8) || ~((z <= 1.58e-115))) tmp = x + ((z - t) * (y / z)); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5e-8], N[Not[LessEqual[z, 1.58e-115]], $MachinePrecision]], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-8} \lor \neg \left(z \leq 1.58 \cdot 10^{-115}\right):\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -4.9999999999999998e-8 or 1.58e-115 < z Initial program 77.0%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in z around inf 82.8%
if -4.9999999999999998e-8 < z < 1.58e-115Initial program 94.3%
*-commutative94.3%
associate-/l*95.5%
associate-/r/97.7%
Applied egg-rr97.7%
Taylor expanded in z around 0 89.0%
Final simplification84.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.6e-9) (not (<= z 1.58e-115))) (+ x (- y (/ t (/ z y)))) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.6e-9) || !(z <= 1.58e-115)) {
tmp = x + (y - (t / (z / 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 <= (-6.6d-9)) .or. (.not. (z <= 1.58d-115))) then
tmp = x + (y - (t / (z / 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 <= -6.6e-9) || !(z <= 1.58e-115)) {
tmp = x + (y - (t / (z / y)));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.6e-9) or not (z <= 1.58e-115): tmp = x + (y - (t / (z / y))) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6.6e-9) || !(z <= 1.58e-115)) tmp = Float64(x + Float64(y - Float64(t / Float64(z / 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 <= -6.6e-9) || ~((z <= 1.58e-115))) tmp = x + (y - (t / (z / y))); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6.6e-9], N[Not[LessEqual[z, 1.58e-115]], $MachinePrecision]], N[(x + N[(y - N[(t / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{-9} \lor \neg \left(z \leq 1.58 \cdot 10^{-115}\right):\\
\;\;\;\;x + \left(y - \frac{t}{\frac{z}{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -6.60000000000000037e-9 or 1.58e-115 < z Initial program 77.0%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in z around inf 82.8%
*-commutative82.8%
clear-num82.6%
un-div-inv82.7%
div-sub82.1%
un-div-inv82.0%
clear-num82.3%
div-inv82.2%
*-commutative82.2%
associate-*r*83.8%
div-inv83.9%
*-inverses83.9%
*-lft-identity83.9%
Applied egg-rr83.9%
if -6.60000000000000037e-9 < z < 1.58e-115Initial program 94.3%
*-commutative94.3%
associate-/l*95.5%
associate-/r/97.7%
Applied egg-rr97.7%
Taylor expanded in z around 0 89.0%
Final simplification85.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -0.017) (+ x (/ y (/ z (- z t)))) (if (<= z 1.58e-115) (+ x (* y (/ t a))) (+ x (- y (/ t (/ z y)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.017) {
tmp = x + (y / (z / (z - t)));
} else if (z <= 1.58e-115) {
tmp = x + (y * (t / a));
} else {
tmp = x + (y - (t / (z / 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 <= (-0.017d0)) then
tmp = x + (y / (z / (z - t)))
else if (z <= 1.58d-115) then
tmp = x + (y * (t / a))
else
tmp = x + (y - (t / (z / 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 <= -0.017) {
tmp = x + (y / (z / (z - t)));
} else if (z <= 1.58e-115) {
tmp = x + (y * (t / a));
} else {
tmp = x + (y - (t / (z / y)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -0.017: tmp = x + (y / (z / (z - t))) elif z <= 1.58e-115: tmp = x + (y * (t / a)) else: tmp = x + (y - (t / (z / y))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.017) tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); elseif (z <= 1.58e-115) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(x + Float64(y - Float64(t / Float64(z / y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -0.017) tmp = x + (y / (z / (z - t))); elseif (z <= 1.58e-115) tmp = x + (y * (t / a)); else tmp = x + (y - (t / (z / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -0.017], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.58e-115], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y - N[(t / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.017:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{elif}\;z \leq 1.58 \cdot 10^{-115}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - \frac{t}{\frac{z}{y}}\right)\\
\end{array}
\end{array}
if z < -0.017000000000000001Initial program 80.6%
associate-*l/95.9%
Simplified95.9%
Taylor expanded in a around 0 68.5%
+-commutative68.5%
associate-/l*87.8%
Simplified87.8%
if -0.017000000000000001 < z < 1.58e-115Initial program 94.3%
*-commutative94.3%
associate-/l*95.5%
associate-/r/97.7%
Applied egg-rr97.7%
Taylor expanded in z around 0 89.0%
if 1.58e-115 < z Initial program 74.6%
associate-*l/98.9%
Simplified98.9%
Taylor expanded in z around inf 81.3%
*-commutative81.3%
clear-num80.9%
un-div-inv81.0%
div-sub80.0%
un-div-inv80.0%
clear-num80.3%
div-inv80.3%
*-commutative80.3%
associate-*r*82.3%
div-inv82.3%
*-inverses82.3%
*-lft-identity82.3%
Applied egg-rr82.3%
Final simplification86.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -8.6e+24) (+ x (/ y (/ z (- z t)))) (if (<= z 5.8e+54) (- x (* t (/ y (- z a)))) (+ x (- y (/ t (/ z y)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8.6e+24) {
tmp = x + (y / (z / (z - t)));
} else if (z <= 5.8e+54) {
tmp = x - (t * (y / (z - a)));
} else {
tmp = x + (y - (t / (z / 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 <= (-8.6d+24)) then
tmp = x + (y / (z / (z - t)))
else if (z <= 5.8d+54) then
tmp = x - (t * (y / (z - a)))
else
tmp = x + (y - (t / (z / 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 <= -8.6e+24) {
tmp = x + (y / (z / (z - t)));
} else if (z <= 5.8e+54) {
tmp = x - (t * (y / (z - a)));
} else {
tmp = x + (y - (t / (z / y)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -8.6e+24: tmp = x + (y / (z / (z - t))) elif z <= 5.8e+54: tmp = x - (t * (y / (z - a))) else: tmp = x + (y - (t / (z / y))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8.6e+24) tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); elseif (z <= 5.8e+54) tmp = Float64(x - Float64(t * Float64(y / Float64(z - a)))); else tmp = Float64(x + Float64(y - Float64(t / Float64(z / y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -8.6e+24) tmp = x + (y / (z / (z - t))); elseif (z <= 5.8e+54) tmp = x - (t * (y / (z - a))); else tmp = x + (y - (t / (z / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8.6e+24], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.8e+54], N[(x - N[(t * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y - N[(t / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.6 \cdot 10^{+24}:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{+54}:\\
\;\;\;\;x - t \cdot \frac{y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - \frac{t}{\frac{z}{y}}\right)\\
\end{array}
\end{array}
if z < -8.59999999999999975e24Initial program 78.1%
associate-*l/95.4%
Simplified95.4%
Taylor expanded in a around 0 67.0%
+-commutative67.0%
associate-/l*88.8%
Simplified88.8%
if -8.59999999999999975e24 < z < 5.7999999999999997e54Initial program 96.1%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in t around inf 90.1%
associate-/l*91.7%
associate-*r/91.7%
neg-mul-191.7%
Simplified91.7%
div-inv91.0%
/-rgt-identity91.0%
cancel-sign-sub-inv91.0%
/-rgt-identity91.0%
clear-num91.1%
Applied egg-rr91.1%
if 5.7999999999999997e54 < z Initial program 61.7%
associate-*l/98.3%
Simplified98.3%
Taylor expanded in z around inf 87.8%
*-commutative87.8%
clear-num87.3%
un-div-inv87.4%
div-sub87.4%
un-div-inv87.3%
clear-num87.8%
div-inv87.8%
*-commutative87.8%
associate-*r*89.3%
div-inv89.3%
*-inverses89.3%
*-lft-identity89.3%
Applied egg-rr89.3%
Final simplification90.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.1e+26) (+ x (/ y (/ z (- z t)))) (if (<= z 4.5e+54) (- x (/ t (/ (- z a) y))) (+ x (- y (/ t (/ z y)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.1e+26) {
tmp = x + (y / (z / (z - t)));
} else if (z <= 4.5e+54) {
tmp = x - (t / ((z - a) / y));
} else {
tmp = x + (y - (t / (z / 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.1d+26)) then
tmp = x + (y / (z / (z - t)))
else if (z <= 4.5d+54) then
tmp = x - (t / ((z - a) / y))
else
tmp = x + (y - (t / (z / 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.1e+26) {
tmp = x + (y / (z / (z - t)));
} else if (z <= 4.5e+54) {
tmp = x - (t / ((z - a) / y));
} else {
tmp = x + (y - (t / (z / y)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.1e+26: tmp = x + (y / (z / (z - t))) elif z <= 4.5e+54: tmp = x - (t / ((z - a) / y)) else: tmp = x + (y - (t / (z / y))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.1e+26) tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); elseif (z <= 4.5e+54) tmp = Float64(x - Float64(t / Float64(Float64(z - a) / y))); else tmp = Float64(x + Float64(y - Float64(t / Float64(z / y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.1e+26) tmp = x + (y / (z / (z - t))); elseif (z <= 4.5e+54) tmp = x - (t / ((z - a) / y)); else tmp = x + (y - (t / (z / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.1e+26], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e+54], N[(x - N[(t / N[(N[(z - a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y - N[(t / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+26}:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+54}:\\
\;\;\;\;x - \frac{t}{\frac{z - a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - \frac{t}{\frac{z}{y}}\right)\\
\end{array}
\end{array}
if z < -3.1e26Initial program 78.1%
associate-*l/95.4%
Simplified95.4%
Taylor expanded in a around 0 67.0%
+-commutative67.0%
associate-/l*88.8%
Simplified88.8%
if -3.1e26 < z < 4.49999999999999984e54Initial program 96.1%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in t around inf 90.1%
associate-/l*91.7%
associate-*r/91.7%
neg-mul-191.7%
Simplified91.7%
if 4.49999999999999984e54 < z Initial program 61.7%
associate-*l/98.3%
Simplified98.3%
Taylor expanded in z around inf 87.8%
*-commutative87.8%
clear-num87.3%
un-div-inv87.4%
div-sub87.4%
un-div-inv87.3%
clear-num87.8%
div-inv87.8%
*-commutative87.8%
associate-*r*89.3%
div-inv89.3%
*-inverses89.3%
*-lft-identity89.3%
Applied egg-rr89.3%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -36000000.0) (+ x y) (if (<= z 2.1e+58) (+ x (* y (/ t a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -36000000.0) {
tmp = x + y;
} else if (z <= 2.1e+58) {
tmp = x + (y * (t / a));
} 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 <= (-36000000.0d0)) then
tmp = x + y
else if (z <= 2.1d+58) then
tmp = x + (y * (t / a))
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 <= -36000000.0) {
tmp = x + y;
} else if (z <= 2.1e+58) {
tmp = x + (y * (t / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -36000000.0: tmp = x + y elif z <= 2.1e+58: tmp = x + (y * (t / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -36000000.0) tmp = Float64(x + y); elseif (z <= 2.1e+58) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -36000000.0) tmp = x + y; elseif (z <= 2.1e+58) tmp = x + (y * (t / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -36000000.0], N[(x + y), $MachinePrecision], If[LessEqual[z, 2.1e+58], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -36000000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+58}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -3.6e7 or 2.10000000000000012e58 < z Initial program 71.0%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in z around inf 76.6%
+-commutative76.6%
Simplified76.6%
if -3.6e7 < z < 2.10000000000000012e58Initial program 95.9%
*-commutative95.9%
associate-/l*96.7%
associate-/r/98.4%
Applied egg-rr98.4%
Taylor expanded in z around 0 81.8%
Final simplification79.1%
(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 82.9%
associate-*l/96.6%
Simplified96.6%
Final simplification96.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.7e-16) (+ x y) (if (<= z 8e+51) x (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.7e-16) {
tmp = x + y;
} else if (z <= 8e+51) {
tmp = x;
} 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 <= (-1.7d-16)) then
tmp = x + y
else if (z <= 8d+51) then
tmp = x
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 <= -1.7e-16) {
tmp = x + y;
} else if (z <= 8e+51) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.7e-16: tmp = x + y elif z <= 8e+51: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.7e-16) tmp = Float64(x + y); elseif (z <= 8e+51) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.7e-16) tmp = x + y; elseif (z <= 8e+51) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.7e-16], N[(x + y), $MachinePrecision], If[LessEqual[z, 8e+51], x, N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-16}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+51}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1.7e-16 or 8e51 < z Initial program 71.4%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in z around inf 75.6%
+-commutative75.6%
Simplified75.6%
if -1.7e-16 < z < 8e51Initial program 95.8%
associate-*l/96.0%
Simplified96.0%
Taylor expanded in x around inf 53.0%
Final simplification65.0%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 82.9%
associate-*l/96.6%
Simplified96.6%
Taylor expanded in x around inf 52.0%
Final simplification52.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(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 2023297
(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))))