
(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 10 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 (fma (- z t) (/ y (- z a)) x))
double code(double x, double y, double z, double t, double a) {
return fma((z - t), (y / (z - a)), x);
}
function code(x, y, z, t, a) return fma(Float64(z - t), Float64(y / Float64(z - a)), x) end
code[x_, y_, z_, t_, a_] := N[(N[(z - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z - t, \frac{y}{z - a}, x\right)
\end{array}
Initial program 97.6%
+-commutative97.6%
associate-*r/84.7%
associate-*l/98.3%
*-commutative98.3%
fma-def98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (/ y (/ a (- z t))))) (t_2 (+ x (* y (/ (- z t) z)))))
(if (<= z -2.6e+43)
t_2
(if (<= z -3.5e-55)
t_1
(if (<= z -3.6e-74)
(+ x (/ (- z t) (/ z y)))
(if (<= z -5e-273)
(+ x (* t (/ y a)))
(if (<= z 8.2e-60) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y / (a / (z - t)));
double t_2 = x + (y * ((z - t) / z));
double tmp;
if (z <= -2.6e+43) {
tmp = t_2;
} else if (z <= -3.5e-55) {
tmp = t_1;
} else if (z <= -3.6e-74) {
tmp = x + ((z - t) / (z / y));
} else if (z <= -5e-273) {
tmp = x + (t * (y / a));
} else if (z <= 8.2e-60) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = x - (y / (a / (z - t)))
t_2 = x + (y * ((z - t) / z))
if (z <= (-2.6d+43)) then
tmp = t_2
else if (z <= (-3.5d-55)) then
tmp = t_1
else if (z <= (-3.6d-74)) then
tmp = x + ((z - t) / (z / y))
else if (z <= (-5d-273)) then
tmp = x + (t * (y / a))
else if (z <= 8.2d-60) then
tmp = t_1
else
tmp = t_2
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 / (a / (z - t)));
double t_2 = x + (y * ((z - t) / z));
double tmp;
if (z <= -2.6e+43) {
tmp = t_2;
} else if (z <= -3.5e-55) {
tmp = t_1;
} else if (z <= -3.6e-74) {
tmp = x + ((z - t) / (z / y));
} else if (z <= -5e-273) {
tmp = x + (t * (y / a));
} else if (z <= 8.2e-60) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (y / (a / (z - t))) t_2 = x + (y * ((z - t) / z)) tmp = 0 if z <= -2.6e+43: tmp = t_2 elif z <= -3.5e-55: tmp = t_1 elif z <= -3.6e-74: tmp = x + ((z - t) / (z / y)) elif z <= -5e-273: tmp = x + (t * (y / a)) elif z <= 8.2e-60: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y / Float64(a / Float64(z - t)))) t_2 = Float64(x + Float64(y * Float64(Float64(z - t) / z))) tmp = 0.0 if (z <= -2.6e+43) tmp = t_2; elseif (z <= -3.5e-55) tmp = t_1; elseif (z <= -3.6e-74) tmp = Float64(x + Float64(Float64(z - t) / Float64(z / y))); elseif (z <= -5e-273) tmp = Float64(x + Float64(t * Float64(y / a))); elseif (z <= 8.2e-60) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (y / (a / (z - t))); t_2 = x + (y * ((z - t) / z)); tmp = 0.0; if (z <= -2.6e+43) tmp = t_2; elseif (z <= -3.5e-55) tmp = t_1; elseif (z <= -3.6e-74) tmp = x + ((z - t) / (z / y)); elseif (z <= -5e-273) tmp = x + (t * (y / a)); elseif (z <= 8.2e-60) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.6e+43], t$95$2, If[LessEqual[z, -3.5e-55], t$95$1, If[LessEqual[z, -3.6e-74], N[(x + N[(N[(z - t), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -5e-273], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.2e-60], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{\frac{a}{z - t}}\\
t_2 := x + y \cdot \frac{z - t}{z}\\
\mathbf{if}\;z \leq -2.6 \cdot 10^{+43}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{-55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{-74}:\\
\;\;\;\;x + \frac{z - t}{\frac{z}{y}}\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-273}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-60}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -2.60000000000000021e43 or 8.20000000000000025e-60 < z Initial program 99.9%
Taylor expanded in a around 0 86.6%
if -2.60000000000000021e43 < z < -3.50000000000000025e-55 or -4.99999999999999965e-273 < z < 8.20000000000000025e-60Initial program 98.8%
Taylor expanded in a around inf 83.3%
+-commutative83.3%
mul-1-neg83.3%
*-commutative83.3%
unsub-neg83.3%
associate-/l*88.0%
Simplified88.0%
if -3.50000000000000025e-55 < z < -3.6000000000000002e-74Initial program 84.4%
*-commutative84.4%
associate-*l/99.2%
associate-/l*100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 84.1%
if -3.6000000000000002e-74 < z < -4.99999999999999965e-273Initial program 90.9%
*-commutative90.9%
associate-*l/86.7%
associate-/l*99.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 77.5%
*-commutative77.5%
associate-*r/90.6%
Simplified90.6%
Final simplification87.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.2e+44) (not (<= z 2.22e-60))) (+ x (* y (/ (- z t) z))) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.2e+44) || !(z <= 2.22e-60)) {
tmp = x + (y * ((z - t) / z));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-4.2d+44)) .or. (.not. (z <= 2.22d-60))) then
tmp = x + (y * ((z - t) / z))
else
tmp = x + (t * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.2e+44) || !(z <= 2.22e-60)) {
tmp = x + (y * ((z - t) / z));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.2e+44) or not (z <= 2.22e-60): tmp = x + (y * ((z - t) / z)) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.2e+44) || !(z <= 2.22e-60)) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); else tmp = Float64(x + Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.2e+44) || ~((z <= 2.22e-60))) tmp = x + (y * ((z - t) / z)); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.2e+44], N[Not[LessEqual[z, 2.22e-60]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+44} \lor \neg \left(z \leq 2.22 \cdot 10^{-60}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -4.19999999999999974e44 or 2.21999999999999998e-60 < z Initial program 99.9%
Taylor expanded in a around 0 86.6%
if -4.19999999999999974e44 < z < 2.21999999999999998e-60Initial program 95.9%
*-commutative95.9%
associate-*l/92.8%
associate-/l*98.6%
Applied egg-rr98.6%
Taylor expanded in z around 0 75.2%
*-commutative75.2%
associate-*r/81.0%
Simplified81.0%
Final simplification83.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.4e-74) (not (<= z 3.8e-91))) (+ x (/ y (- 1.0 (/ a z)))) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.4e-74) || !(z <= 3.8e-91)) {
tmp = x + (y / (1.0 - (a / z)));
} else {
tmp = x + (t * (y / 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 <= (-3.4d-74)) .or. (.not. (z <= 3.8d-91))) then
tmp = x + (y / (1.0d0 - (a / z)))
else
tmp = x + (t * (y / 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 <= -3.4e-74) || !(z <= 3.8e-91)) {
tmp = x + (y / (1.0 - (a / z)));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.4e-74) or not (z <= 3.8e-91): tmp = x + (y / (1.0 - (a / z))) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.4e-74) || !(z <= 3.8e-91)) tmp = Float64(x + Float64(y / Float64(1.0 - Float64(a / z)))); else tmp = Float64(x + Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.4e-74) || ~((z <= 3.8e-91))) tmp = x + (y / (1.0 - (a / z))); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.4e-74], N[Not[LessEqual[z, 3.8e-91]], $MachinePrecision]], N[(x + N[(y / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{-74} \lor \neg \left(z \leq 3.8 \cdot 10^{-91}\right):\\
\;\;\;\;x + \frac{y}{1 - \frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -3.4000000000000001e-74 or 3.79999999999999978e-91 < z Initial program 99.3%
Taylor expanded in t around 0 66.3%
associate-/l*80.2%
div-sub80.2%
*-inverses80.2%
Simplified80.2%
if -3.4000000000000001e-74 < z < 3.79999999999999978e-91Initial program 94.9%
*-commutative94.9%
associate-*l/91.3%
associate-/l*98.9%
Applied egg-rr98.9%
Taylor expanded in z around 0 81.4%
*-commutative81.4%
associate-*r/89.1%
Simplified89.1%
Final simplification83.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.5e+56) (+ y x) (if (<= z 1.95e-60) (+ x (* t (/ y a))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.5e+56) {
tmp = y + x;
} else if (z <= 1.95e-60) {
tmp = x + (t * (y / a));
} else {
tmp = y + x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-1.5d+56)) then
tmp = y + x
else if (z <= 1.95d-60) then
tmp = x + (t * (y / a))
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.5e+56) {
tmp = y + x;
} else if (z <= 1.95e-60) {
tmp = x + (t * (y / a));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.5e+56: tmp = y + x elif z <= 1.95e-60: tmp = x + (t * (y / a)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.5e+56) tmp = Float64(y + x); elseif (z <= 1.95e-60) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.5e+56) tmp = y + x; elseif (z <= 1.95e-60) tmp = x + (t * (y / a)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.5e+56], N[(y + x), $MachinePrecision], If[LessEqual[z, 1.95e-60], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+56}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{-60}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -1.50000000000000003e56 or 1.9500000000000001e-60 < z Initial program 99.9%
Taylor expanded in z around inf 76.7%
if -1.50000000000000003e56 < z < 1.9500000000000001e-60Initial program 95.9%
*-commutative95.9%
associate-*l/92.9%
associate-/l*98.0%
Applied egg-rr98.0%
Taylor expanded in z around 0 74.7%
*-commutative74.7%
associate-*r/80.5%
Simplified80.5%
Final simplification78.9%
(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 97.6%
Final simplification97.6%
(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(z - t) / Float64(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[(z - t), $MachinePrecision] / N[(N[(z - a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - t}{\frac{z - a}{y}}
\end{array}
Initial program 97.6%
*-commutative97.6%
associate-*l/84.7%
associate-/l*98.0%
Applied egg-rr98.0%
Final simplification98.0%
(FPCore (x y z t a) :precision binary64 (if (<= y -1.16e+106) y (if (<= y 4.6e-16) x (if (<= y 1.75e+207) y (if (<= y 1.26e+296) x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.16e+106) {
tmp = y;
} else if (y <= 4.6e-16) {
tmp = x;
} else if (y <= 1.75e+207) {
tmp = y;
} else if (y <= 1.26e+296) {
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 <= (-1.16d+106)) then
tmp = y
else if (y <= 4.6d-16) then
tmp = x
else if (y <= 1.75d+207) then
tmp = y
else if (y <= 1.26d+296) 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 <= -1.16e+106) {
tmp = y;
} else if (y <= 4.6e-16) {
tmp = x;
} else if (y <= 1.75e+207) {
tmp = y;
} else if (y <= 1.26e+296) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.16e+106: tmp = y elif y <= 4.6e-16: tmp = x elif y <= 1.75e+207: tmp = y elif y <= 1.26e+296: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.16e+106) tmp = y; elseif (y <= 4.6e-16) tmp = x; elseif (y <= 1.75e+207) tmp = y; elseif (y <= 1.26e+296) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.16e+106) tmp = y; elseif (y <= 4.6e-16) tmp = x; elseif (y <= 1.75e+207) tmp = y; elseif (y <= 1.26e+296) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.16e+106], y, If[LessEqual[y, 4.6e-16], x, If[LessEqual[y, 1.75e+207], y, If[LessEqual[y, 1.26e+296], x, y]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.16 \cdot 10^{+106}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{-16}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{+207}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.26 \cdot 10^{+296}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -1.16000000000000004e106 or 4.5999999999999998e-16 < y < 1.75000000000000014e207 or 1.25999999999999992e296 < y Initial program 99.8%
Taylor expanded in t around 0 38.9%
associate-/l*58.0%
div-sub58.0%
*-inverses58.0%
Simplified58.0%
Taylor expanded in y around inf 44.9%
Taylor expanded in a around 0 37.2%
if -1.16000000000000004e106 < y < 4.5999999999999998e-16 or 1.75000000000000014e207 < y < 1.25999999999999992e296Initial program 96.4%
Taylor expanded in x around inf 66.2%
Final simplification55.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -9.4e-185) (+ y x) (if (<= z 3e-96) x (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.4e-185) {
tmp = y + x;
} else if (z <= 3e-96) {
tmp = x;
} else {
tmp = y + x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-9.4d-185)) then
tmp = y + x
else if (z <= 3d-96) then
tmp = x
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.4e-185) {
tmp = y + x;
} else if (z <= 3e-96) {
tmp = x;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -9.4e-185: tmp = y + x elif z <= 3e-96: tmp = x else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.4e-185) tmp = Float64(y + x); elseif (z <= 3e-96) tmp = x; else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -9.4e-185) tmp = y + x; elseif (z <= 3e-96) tmp = x; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.4e-185], N[(y + x), $MachinePrecision], If[LessEqual[z, 3e-96], x, N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.4 \cdot 10^{-185}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-96}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -9.4000000000000004e-185 or 3e-96 < z Initial program 98.8%
Taylor expanded in z around inf 65.5%
if -9.4000000000000004e-185 < z < 3e-96Initial program 94.7%
Taylor expanded in x around inf 53.0%
Final simplification61.9%
(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 97.6%
Taylor expanded in x around inf 47.7%
Final simplification47.7%
(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 2023238
(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)))))