
(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 9 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 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 99.2%
Final simplification99.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -850000.0)
(+ x y)
(if (<= z 1.58e-115)
(+ x (* y (/ t a)))
(if (<= z 4.6e+83) (+ x (/ y (/ (- z) t))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -850000.0) {
tmp = x + y;
} else if (z <= 1.58e-115) {
tmp = x + (y * (t / a));
} else if (z <= 4.6e+83) {
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 <= (-850000.0d0)) then
tmp = x + y
else if (z <= 1.58d-115) then
tmp = x + (y * (t / a))
else if (z <= 4.6d+83) 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 <= -850000.0) {
tmp = x + y;
} else if (z <= 1.58e-115) {
tmp = x + (y * (t / a));
} else if (z <= 4.6e+83) {
tmp = x + (y / (-z / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -850000.0: tmp = x + y elif z <= 1.58e-115: tmp = x + (y * (t / a)) elif z <= 4.6e+83: tmp = x + (y / (-z / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -850000.0) tmp = Float64(x + y); elseif (z <= 1.58e-115) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 4.6e+83) 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 <= -850000.0) tmp = x + y; elseif (z <= 1.58e-115) tmp = x + (y * (t / a)); elseif (z <= 4.6e+83) tmp = x + (y / (-z / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -850000.0], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.58e-115], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.6e+83], N[(x + N[(y / N[((-z) / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -850000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.58 \cdot 10^{-115}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+83}:\\
\;\;\;\;x + \frac{y}{\frac{-z}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -8.5e5 or 4.5999999999999999e83 < z Initial program 99.9%
Taylor expanded in z around inf 77.7%
+-commutative77.7%
Simplified77.7%
if -8.5e5 < z < 1.58e-115Initial program 97.7%
Taylor expanded in z around 0 89.0%
if 1.58e-115 < z < 4.5999999999999999e83Initial program 99.9%
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 -800.0)
(+ x y)
(if (<= z 1.58e-115)
(+ x (* y (/ t a)))
(if (<= z 3.9e+88) (- x (* y (/ t z))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -800.0) {
tmp = x + y;
} else if (z <= 1.58e-115) {
tmp = x + (y * (t / a));
} else if (z <= 3.9e+88) {
tmp = x - (y * (t / 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 <= (-800.0d0)) then
tmp = x + y
else if (z <= 1.58d-115) then
tmp = x + (y * (t / a))
else if (z <= 3.9d+88) then
tmp = x - (y * (t / 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 <= -800.0) {
tmp = x + y;
} else if (z <= 1.58e-115) {
tmp = x + (y * (t / a));
} else if (z <= 3.9e+88) {
tmp = x - (y * (t / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -800.0: tmp = x + y elif z <= 1.58e-115: tmp = x + (y * (t / a)) elif z <= 3.9e+88: tmp = x - (y * (t / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -800.0) tmp = Float64(x + y); elseif (z <= 1.58e-115) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 3.9e+88) tmp = Float64(x - Float64(y * Float64(t / z))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -800.0) tmp = x + y; elseif (z <= 1.58e-115) tmp = x + (y * (t / a)); elseif (z <= 3.9e+88) tmp = x - (y * (t / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -800.0], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.58e-115], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.9e+88], N[(x - N[(y * N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -800:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.58 \cdot 10^{-115}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+88}:\\
\;\;\;\;x - y \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -800 or 3.9000000000000001e88 < z Initial program 99.9%
Taylor expanded in z around inf 77.7%
+-commutative77.7%
Simplified77.7%
if -800 < z < 1.58e-115Initial program 97.7%
Taylor expanded in z around 0 89.0%
if 1.58e-115 < z < 3.9000000000000001e88Initial program 99.9%
Taylor expanded in t around inf 85.9%
associate-*r/85.9%
associate-*r*85.9%
mul-1-neg85.9%
Simplified85.9%
Taylor expanded in z around inf 74.9%
mul-1-neg74.9%
unsub-neg74.9%
associate-/l*76.8%
associate-/r/76.8%
Simplified76.8%
Final simplification81.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.3e-7) (not (<= z 1.58e-115))) (+ x (* y (/ z (- z a)))) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.3e-7) || !(z <= 1.58e-115)) {
tmp = x + (y * (z / (z - a)));
} 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 <= (-2.3d-7)) .or. (.not. (z <= 1.58d-115))) then
tmp = x + (y * (z / (z - a)))
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 <= -2.3e-7) || !(z <= 1.58e-115)) {
tmp = x + (y * (z / (z - a)));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.3e-7) or not (z <= 1.58e-115): tmp = x + (y * (z / (z - a))) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.3e-7) || !(z <= 1.58e-115)) tmp = Float64(x + Float64(y * Float64(z / Float64(z - a)))); 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 <= -2.3e-7) || ~((z <= 1.58e-115))) tmp = x + (y * (z / (z - a))); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.3e-7], N[Not[LessEqual[z, 1.58e-115]], $MachinePrecision]], N[(x + N[(y * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{-7} \lor \neg \left(z \leq 1.58 \cdot 10^{-115}\right):\\
\;\;\;\;x + y \cdot \frac{z}{z - a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -2.29999999999999995e-7 or 1.58e-115 < z Initial program 99.9%
Taylor expanded in t around 0 63.9%
associate-*r/80.8%
Simplified80.8%
if -2.29999999999999995e-7 < z < 1.58e-115Initial program 97.7%
Taylor expanded in z around 0 89.0%
Final simplification83.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6e-7) (not (<= z 1.58e-115))) (+ x (/ y (/ z (- z t)))) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6e-7) || !(z <= 1.58e-115)) {
tmp = x + (y / (z / (z - t)));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-6d-7)) .or. (.not. (z <= 1.58d-115))) then
tmp = x + (y / (z / (z - t)))
else
tmp = x + (y * (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6e-7) || !(z <= 1.58e-115)) {
tmp = x + (y / (z / (z - t)));
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6e-7) or not (z <= 1.58e-115): tmp = x + (y / (z / (z - t))) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6e-7) || !(z <= 1.58e-115)) tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -6e-7) || ~((z <= 1.58e-115))) tmp = x + (y / (z / (z - t))); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6e-7], N[Not[LessEqual[z, 1.58e-115]], $MachinePrecision]], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{-7} \lor \neg \left(z \leq 1.58 \cdot 10^{-115}\right):\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -5.9999999999999997e-7 or 1.58e-115 < z Initial program 99.9%
Taylor expanded in a around 0 64.7%
+-commutative64.7%
associate-/l*84.5%
Simplified84.5%
if -5.9999999999999997e-7 < z < 1.58e-115Initial program 97.7%
Taylor expanded in z around 0 89.0%
Final simplification86.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.48e+57) (not (<= z 4e+51))) (+ x (/ y (/ z (- z t)))) (- x (/ (* y t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.48e+57) || !(z <= 4e+51)) {
tmp = x + (y / (z / (z - t)));
} else {
tmp = x - ((y * 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 ((z <= (-1.48d+57)) .or. (.not. (z <= 4d+51))) then
tmp = x + (y / (z / (z - t)))
else
tmp = x - ((y * 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 ((z <= -1.48e+57) || !(z <= 4e+51)) {
tmp = x + (y / (z / (z - t)));
} else {
tmp = x - ((y * t) / (z - a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.48e+57) or not (z <= 4e+51): tmp = x + (y / (z / (z - t))) else: tmp = x - ((y * t) / (z - a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.48e+57) || !(z <= 4e+51)) tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); else tmp = Float64(x - Float64(Float64(y * t) / Float64(z - a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.48e+57) || ~((z <= 4e+51))) tmp = x + (y / (z / (z - t))); else tmp = x - ((y * t) / (z - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.48e+57], N[Not[LessEqual[z, 4e+51]], $MachinePrecision]], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.48 \cdot 10^{+57} \lor \neg \left(z \leq 4 \cdot 10^{+51}\right):\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot t}{z - a}\\
\end{array}
\end{array}
if z < -1.47999999999999999e57 or 4e51 < z Initial program 99.9%
Taylor expanded in a around 0 62.7%
+-commutative62.7%
associate-/l*91.2%
Simplified91.2%
if -1.47999999999999999e57 < z < 4e51Initial program 98.6%
Taylor expanded in t around inf 88.3%
associate-*r/88.3%
associate-*r*88.3%
mul-1-neg88.3%
Simplified88.3%
Taylor expanded in x around 0 88.3%
mul-1-neg88.3%
associate-*r/88.6%
sub-neg88.6%
associate-*r/88.3%
Simplified88.3%
Final simplification89.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -0.0082) (not (<= z 2.05e+58))) (+ x y) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -0.0082) || !(z <= 2.05e+58)) {
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 <= (-0.0082d0)) .or. (.not. (z <= 2.05d+58))) 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 <= -0.0082) || !(z <= 2.05e+58)) {
tmp = x + y;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -0.0082) or not (z <= 2.05e+58): tmp = x + y else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -0.0082) || !(z <= 2.05e+58)) 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 <= -0.0082) || ~((z <= 2.05e+58))) tmp = x + y; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -0.0082], N[Not[LessEqual[z, 2.05e+58]], $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 -0.0082 \lor \neg \left(z \leq 2.05 \cdot 10^{+58}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -0.00820000000000000069 or 2.05e58 < z Initial program 99.9%
Taylor expanded in z around inf 76.6%
+-commutative76.6%
Simplified76.6%
if -0.00820000000000000069 < z < 2.05e58Initial program 98.4%
Taylor expanded in z around 0 81.8%
Final simplification79.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.5e-15) (+ x y) (if (<= z 1.25e+50) x (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.5e-15) {
tmp = x + y;
} else if (z <= 1.25e+50) {
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.5d-15)) then
tmp = x + y
else if (z <= 1.25d+50) 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.5e-15) {
tmp = x + y;
} else if (z <= 1.25e+50) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.5e-15: tmp = x + y elif z <= 1.25e+50: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.5e-15) tmp = Float64(x + y); elseif (z <= 1.25e+50) 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.5e-15) tmp = x + y; elseif (z <= 1.25e+50) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.5e-15], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.25e+50], x, N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{-15}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+50}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1.5e-15 or 1.25e50 < z Initial program 99.9%
Taylor expanded in z around inf 75.6%
+-commutative75.6%
Simplified75.6%
if -1.5e-15 < z < 1.25e50Initial program 98.3%
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 99.2%
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:renderAxisLine from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(+ x (/ y (/ (- z a) (- z t))))
(+ x (* y (/ (- z t) (- z a)))))