
(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 11 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 (if (<= x -1e-13) (+ x (* (/ y (- z a)) (- z t))) (+ x (/ y (/ (- z a) (- z t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1e-13) {
tmp = x + ((y / (z - a)) * (z - t));
} else {
tmp = x + (y / ((z - 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 (x <= (-1d-13)) then
tmp = x + ((y / (z - a)) * (z - t))
else
tmp = x + (y / ((z - 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 (x <= -1e-13) {
tmp = x + ((y / (z - a)) * (z - t));
} else {
tmp = x + (y / ((z - a) / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1e-13: tmp = x + ((y / (z - a)) * (z - t)) else: tmp = x + (y / ((z - a) / (z - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1e-13) tmp = Float64(x + Float64(Float64(y / Float64(z - a)) * Float64(z - t))); else tmp = Float64(x + Float64(y / Float64(Float64(z - a) / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1e-13) tmp = x + ((y / (z - a)) * (z - t)); else tmp = x + (y / ((z - a) / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1e-13], N[(x + N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-13}:\\
\;\;\;\;x + \frac{y}{z - a} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z - t}}\\
\end{array}
\end{array}
if x < -1e-13Initial program 77.8%
associate-*l/99.9%
Simplified99.9%
if -1e-13 < x Initial program 82.1%
associate-/l*99.4%
Simplified99.4%
Final simplification99.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- z t) (/ y z)))))
(if (<= z -4.2e+15)
t_1
(if (<= z 1.1e-132) (+ x (/ y (/ a t))) (if (<= z 6e+215) t_1 (+ x y))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((z - t) * (y / z));
double tmp;
if (z <= -4.2e+15) {
tmp = t_1;
} else if (z <= 1.1e-132) {
tmp = x + (y / (a / t));
} else if (z <= 6e+215) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x + ((z - t) * (y / z))
if (z <= (-4.2d+15)) then
tmp = t_1
else if (z <= 1.1d-132) then
tmp = x + (y / (a / t))
else if (z <= 6d+215) then
tmp = t_1
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 t_1 = x + ((z - t) * (y / z));
double tmp;
if (z <= -4.2e+15) {
tmp = t_1;
} else if (z <= 1.1e-132) {
tmp = x + (y / (a / t));
} else if (z <= 6e+215) {
tmp = t_1;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((z - t) * (y / z)) tmp = 0 if z <= -4.2e+15: tmp = t_1 elif z <= 1.1e-132: tmp = x + (y / (a / t)) elif z <= 6e+215: tmp = t_1 else: tmp = x + y return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(z - t) * Float64(y / z))) tmp = 0.0 if (z <= -4.2e+15) tmp = t_1; elseif (z <= 1.1e-132) tmp = Float64(x + Float64(y / Float64(a / t))); elseif (z <= 6e+215) tmp = t_1; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((z - t) * (y / z)); tmp = 0.0; if (z <= -4.2e+15) tmp = t_1; elseif (z <= 1.1e-132) tmp = x + (y / (a / t)); elseif (z <= 6e+215) tmp = t_1; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.2e+15], t$95$1, If[LessEqual[z, 1.1e-132], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e+215], t$95$1, N[(x + y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(z - t\right) \cdot \frac{y}{z}\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{+15}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-132}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+215}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -4.2e15 or 1.09999999999999995e-132 < z < 5.9999999999999998e215Initial program 79.1%
associate-*l/97.0%
Simplified97.0%
Taylor expanded in z around inf 80.3%
if -4.2e15 < z < 1.09999999999999995e-132Initial program 94.1%
associate-/l*95.9%
Simplified95.9%
Taylor expanded in z around 0 84.7%
if 5.9999999999999998e215 < z Initial program 40.6%
associate-*l/84.8%
Simplified84.8%
Taylor expanded in z around inf 96.7%
+-commutative96.7%
Simplified96.7%
Final simplification83.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.8e+20)
(+ x y)
(if (<= z 1.65e-132)
(+ x (/ y (/ a t)))
(if (<= z 1.8e+15) (- x (* t (/ y z))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.8e+20) {
tmp = x + y;
} else if (z <= 1.65e-132) {
tmp = x + (y / (a / t));
} else if (z <= 1.8e+15) {
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 <= (-2.8d+20)) then
tmp = x + y
else if (z <= 1.65d-132) then
tmp = x + (y / (a / t))
else if (z <= 1.8d+15) 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 <= -2.8e+20) {
tmp = x + y;
} else if (z <= 1.65e-132) {
tmp = x + (y / (a / t));
} else if (z <= 1.8e+15) {
tmp = x - (t * (y / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.8e+20: tmp = x + y elif z <= 1.65e-132: tmp = x + (y / (a / t)) elif z <= 1.8e+15: tmp = x - (t * (y / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.8e+20) tmp = Float64(x + y); elseif (z <= 1.65e-132) tmp = Float64(x + Float64(y / Float64(a / t))); elseif (z <= 1.8e+15) 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 <= -2.8e+20) tmp = x + y; elseif (z <= 1.65e-132) tmp = x + (y / (a / t)); elseif (z <= 1.8e+15) tmp = x - (t * (y / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.8e+20], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.65e-132], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e+15], N[(x - N[(t * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+20}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-132}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+15}:\\
\;\;\;\;x - t \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -2.8e20 or 1.8e15 < z Initial program 67.2%
associate-*l/94.4%
Simplified94.4%
Taylor expanded in z around inf 76.3%
+-commutative76.3%
Simplified76.3%
if -2.8e20 < z < 1.6499999999999999e-132Initial program 94.1%
associate-/l*95.9%
Simplified95.9%
Taylor expanded in z around 0 84.7%
if 1.6499999999999999e-132 < z < 1.8e15Initial program 93.9%
associate-*l/97.0%
Simplified97.0%
Taylor expanded in t around inf 81.6%
associate-*r/81.6%
associate-*r*81.6%
neg-mul-181.6%
associate-*r/87.7%
*-commutative87.7%
Simplified87.7%
Taylor expanded in x around 0 81.6%
mul-1-neg81.6%
associate-*r/87.7%
sub-neg87.7%
Simplified87.7%
Taylor expanded in z around inf 75.3%
Final simplification79.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.15e+16) (not (<= z 1.1e-132))) (+ x (/ y (/ z (- z t)))) (+ x (/ y (/ a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.15e+16) || !(z <= 1.1e-132)) {
tmp = x + (y / (z / (z - t)));
} else {
tmp = x + (y / (a / 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.15d+16)) .or. (.not. (z <= 1.1d-132))) then
tmp = x + (y / (z / (z - t)))
else
tmp = x + (y / (a / 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.15e+16) || !(z <= 1.1e-132)) {
tmp = x + (y / (z / (z - t)));
} else {
tmp = x + (y / (a / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.15e+16) or not (z <= 1.1e-132): tmp = x + (y / (z / (z - t))) else: tmp = x + (y / (a / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.15e+16) || !(z <= 1.1e-132)) tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); else tmp = Float64(x + Float64(y / Float64(a / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.15e+16) || ~((z <= 1.1e-132))) tmp = x + (y / (z / (z - t))); else tmp = x + (y / (a / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.15e+16], N[Not[LessEqual[z, 1.1e-132]], $MachinePrecision]], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+16} \lor \neg \left(z \leq 1.1 \cdot 10^{-132}\right):\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\end{array}
\end{array}
if z < -1.15e16 or 1.09999999999999995e-132 < z Initial program 72.5%
associate-*l/94.9%
Simplified94.9%
Taylor expanded in a around 0 63.8%
+-commutative63.8%
associate-/l*84.3%
Simplified84.3%
if -1.15e16 < z < 1.09999999999999995e-132Initial program 94.1%
associate-/l*95.9%
Simplified95.9%
Taylor expanded in z around 0 84.7%
Final simplification84.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.12e+21) (not (<= z 7.8e-25))) (+ x (/ y (/ z (- z t)))) (- x (* (/ y (- z a)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.12e+21) || !(z <= 7.8e-25)) {
tmp = x + (y / (z / (z - t)));
} else {
tmp = x - ((y / (z - a)) * 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.12d+21)) .or. (.not. (z <= 7.8d-25))) then
tmp = x + (y / (z / (z - t)))
else
tmp = x - ((y / (z - a)) * 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.12e+21) || !(z <= 7.8e-25)) {
tmp = x + (y / (z / (z - t)));
} else {
tmp = x - ((y / (z - a)) * t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.12e+21) or not (z <= 7.8e-25): tmp = x + (y / (z / (z - t))) else: tmp = x - ((y / (z - a)) * t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.12e+21) || !(z <= 7.8e-25)) tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); else tmp = Float64(x - Float64(Float64(y / Float64(z - a)) * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.12e+21) || ~((z <= 7.8e-25))) tmp = x + (y / (z / (z - t))); else tmp = x - ((y / (z - a)) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.12e+21], N[Not[LessEqual[z, 7.8e-25]], $MachinePrecision]], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{+21} \lor \neg \left(z \leq 7.8 \cdot 10^{-25}\right):\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z - a} \cdot t\\
\end{array}
\end{array}
if z < -1.12e21 or 7.8e-25 < z Initial program 68.9%
associate-*l/94.7%
Simplified94.7%
Taylor expanded in a around 0 62.3%
+-commutative62.3%
associate-/l*88.0%
Simplified88.0%
if -1.12e21 < z < 7.8e-25Initial program 93.7%
associate-*l/95.3%
Simplified95.3%
Taylor expanded in t around inf 87.5%
associate-*r/87.5%
associate-*r*87.5%
neg-mul-187.5%
associate-*r/89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in x around 0 87.5%
mul-1-neg87.5%
associate-*r/89.9%
sub-neg89.9%
Simplified89.9%
Final simplification88.9%
(FPCore (x y z t a) :precision binary64 (if (<= z 3.2e+217) (+ x (* (/ y (- z a)) (- z t))) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 3.2e+217) {
tmp = x + ((y / (z - a)) * (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 <= 3.2d+217) then
tmp = x + ((y / (z - a)) * (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 <= 3.2e+217) {
tmp = x + ((y / (z - a)) * (z - t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= 3.2e+217: tmp = x + ((y / (z - a)) * (z - t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= 3.2e+217) tmp = Float64(x + Float64(Float64(y / Float64(z - a)) * 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 <= 3.2e+217) tmp = x + ((y / (z - a)) * (z - t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, 3.2e+217], N[(x + N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.2 \cdot 10^{+217}:\\
\;\;\;\;x + \frac{y}{z - a} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < 3.2000000000000001e217Initial program 85.2%
associate-*l/96.2%
Simplified96.2%
if 3.2000000000000001e217 < z Initial program 42.0%
associate-*l/84.2%
Simplified84.2%
Taylor expanded in z around inf 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification96.6%
(FPCore (x y z t a) :precision binary64 (if (<= x -7.2e-14) (+ x (* (/ y (- z a)) (- z t))) (+ x (* y (/ (- z t) (- z a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -7.2e-14) {
tmp = x + ((y / (z - a)) * (z - t));
} else {
tmp = x + (y * ((z - t) / (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 (x <= (-7.2d-14)) then
tmp = x + ((y / (z - a)) * (z - t))
else
tmp = x + (y * ((z - t) / (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 (x <= -7.2e-14) {
tmp = x + ((y / (z - a)) * (z - t));
} else {
tmp = x + (y * ((z - t) / (z - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -7.2e-14: tmp = x + ((y / (z - a)) * (z - t)) else: tmp = x + (y * ((z - t) / (z - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -7.2e-14) tmp = Float64(x + Float64(Float64(y / Float64(z - a)) * Float64(z - t))); else tmp = Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -7.2e-14) tmp = x + ((y / (z - a)) * (z - t)); else tmp = x + (y * ((z - t) / (z - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -7.2e-14], N[(x + N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-14}:\\
\;\;\;\;x + \frac{y}{z - a} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - t}{z - a}\\
\end{array}
\end{array}
if x < -7.1999999999999996e-14Initial program 77.8%
associate-*l/99.9%
Simplified99.9%
if -7.1999999999999996e-14 < x Initial program 82.1%
associate-/l*99.4%
Simplified99.4%
clear-num99.2%
associate-/r/98.8%
clear-num98.9%
Applied egg-rr98.9%
Final simplification99.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9e+19) (not (<= z 2.35e-26))) (+ x y) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9e+19) || !(z <= 2.35e-26)) {
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 <= (-9d+19)) .or. (.not. (z <= 2.35d-26))) 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 <= -9e+19) || !(z <= 2.35e-26)) {
tmp = x + y;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9e+19) or not (z <= 2.35e-26): tmp = x + y else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9e+19) || !(z <= 2.35e-26)) 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 <= -9e+19) || ~((z <= 2.35e-26))) tmp = x + y; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9e+19], N[Not[LessEqual[z, 2.35e-26]], $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 -9 \cdot 10^{+19} \lor \neg \left(z \leq 2.35 \cdot 10^{-26}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -9e19 or 2.34999999999999995e-26 < z Initial program 68.9%
associate-*l/94.7%
Simplified94.7%
Taylor expanded in z around inf 76.1%
+-commutative76.1%
Simplified76.1%
if -9e19 < z < 2.34999999999999995e-26Initial program 93.7%
associate-/l*95.2%
Simplified95.2%
clear-num95.1%
associate-/r/93.8%
clear-num93.8%
Applied egg-rr93.8%
Taylor expanded in z around 0 78.0%
Final simplification77.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7e+15) (not (<= z 8.5e-26))) (+ x y) (+ x (/ y (/ a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7e+15) || !(z <= 8.5e-26)) {
tmp = x + y;
} else {
tmp = x + (y / (a / 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 <= (-7d+15)) .or. (.not. (z <= 8.5d-26))) then
tmp = x + y
else
tmp = x + (y / (a / 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 <= -7e+15) || !(z <= 8.5e-26)) {
tmp = x + y;
} else {
tmp = x + (y / (a / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7e+15) or not (z <= 8.5e-26): tmp = x + y else: tmp = x + (y / (a / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7e+15) || !(z <= 8.5e-26)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y / Float64(a / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7e+15) || ~((z <= 8.5e-26))) tmp = x + y; else tmp = x + (y / (a / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7e+15], N[Not[LessEqual[z, 8.5e-26]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+15} \lor \neg \left(z \leq 8.5 \cdot 10^{-26}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\end{array}
\end{array}
if z < -7e15 or 8.50000000000000004e-26 < z Initial program 68.9%
associate-*l/94.7%
Simplified94.7%
Taylor expanded in z around inf 76.1%
+-commutative76.1%
Simplified76.1%
if -7e15 < z < 8.50000000000000004e-26Initial program 93.7%
associate-/l*95.2%
Simplified95.2%
Taylor expanded in z around 0 78.2%
Final simplification77.1%
(FPCore (x y z t a) :precision binary64 (+ x y))
double code(double x, double y, double z, double t, double a) {
return x + 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 + y
end function
public static double code(double x, double y, double z, double t, double a) {
return x + y;
}
def code(x, y, z, t, a): return x + y
function code(x, y, z, t, a) return Float64(x + y) end
function tmp = code(x, y, z, t, a) tmp = x + y; end
code[x_, y_, z_, t_, a_] := N[(x + y), $MachinePrecision]
\begin{array}{l}
\\
x + y
\end{array}
Initial program 80.8%
associate-*l/95.0%
Simplified95.0%
Taylor expanded in z around inf 61.1%
+-commutative61.1%
Simplified61.1%
Final simplification61.1%
(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 80.8%
associate-*l/95.0%
Simplified95.0%
Taylor expanded in x around inf 46.6%
Final simplification46.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 2023310
(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))))