
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\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) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Initial program 98.1%
Final simplification98.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1e-7) (not (<= t 1.7e+123))) (- x (/ y (+ (/ a t) -1.0))) (+ x (* z (/ y (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1e-7) || !(t <= 1.7e+123)) {
tmp = x - (y / ((a / t) + -1.0));
} else {
tmp = x + (z * (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 ((t <= (-1d-7)) .or. (.not. (t <= 1.7d+123))) then
tmp = x - (y / ((a / t) + (-1.0d0)))
else
tmp = x + (z * (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 ((t <= -1e-7) || !(t <= 1.7e+123)) {
tmp = x - (y / ((a / t) + -1.0));
} else {
tmp = x + (z * (y / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1e-7) or not (t <= 1.7e+123): tmp = x - (y / ((a / t) + -1.0)) else: tmp = x + (z * (y / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1e-7) || !(t <= 1.7e+123)) tmp = Float64(x - Float64(y / Float64(Float64(a / t) + -1.0))); else tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1e-7) || ~((t <= 1.7e+123))) tmp = x - (y / ((a / t) + -1.0)); else tmp = x + (z * (y / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1e-7], N[Not[LessEqual[t, 1.7e+123]], $MachinePrecision]], N[(x - N[(y / N[(N[(a / t), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{-7} \lor \neg \left(t \leq 1.7 \cdot 10^{+123}\right):\\
\;\;\;\;x - \frac{y}{\frac{a}{t} + -1}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\end{array}
\end{array}
if t < -9.9999999999999995e-8 or 1.70000000000000001e123 < t Initial program 99.9%
Taylor expanded in z around 0 64.0%
+-commutative64.0%
mul-1-neg64.0%
unsub-neg64.0%
associate-/l*93.2%
div-sub93.2%
*-inverses93.2%
Simplified93.2%
if -9.9999999999999995e-8 < t < 1.70000000000000001e123Initial program 96.8%
associate-*r/96.9%
Simplified96.9%
associate-/l*97.1%
associate-/r/98.7%
Applied egg-rr98.7%
Taylor expanded in z around inf 92.7%
associate-*l/94.5%
*-commutative94.5%
Simplified94.5%
Final simplification94.0%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.05e-7) (+ x y) (if (<= t 1.46e+130) (+ x (* y (/ z (- a t)))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.05e-7) {
tmp = x + y;
} else if (t <= 1.46e+130) {
tmp = x + (y * (z / (a - t)));
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-1.05d-7)) then
tmp = x + y
else if (t <= 1.46d+130) then
tmp = x + (y * (z / (a - t)))
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.05e-7) {
tmp = x + y;
} else if (t <= 1.46e+130) {
tmp = x + (y * (z / (a - t)));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.05e-7: tmp = x + y elif t <= 1.46e+130: tmp = x + (y * (z / (a - t))) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.05e-7) tmp = Float64(x + y); elseif (t <= 1.46e+130) tmp = Float64(x + Float64(y * Float64(z / Float64(a - t)))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.05e-7) tmp = x + y; elseif (t <= 1.46e+130) tmp = x + (y * (z / (a - t))); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.05e-7], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.46e+130], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.05 \cdot 10^{-7}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.46 \cdot 10^{+130}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -1.05e-7 or 1.4600000000000001e130 < t Initial program 99.9%
Taylor expanded in t around inf 82.1%
if -1.05e-7 < t < 1.4600000000000001e130Initial program 96.9%
Taylor expanded in z around inf 92.7%
Final simplification88.6%
(FPCore (x y z t a) :precision binary64 (if (<= t -4e-8) (+ x y) (if (<= t 2.4e+129) (+ x (* z (/ y (- a t)))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4e-8) {
tmp = x + y;
} else if (t <= 2.4e+129) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-4d-8)) then
tmp = x + y
else if (t <= 2.4d+129) then
tmp = x + (z * (y / (a - t)))
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4e-8) {
tmp = x + y;
} else if (t <= 2.4e+129) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4e-8: tmp = x + y elif t <= 2.4e+129: tmp = x + (z * (y / (a - t))) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4e-8) tmp = Float64(x + y); elseif (t <= 2.4e+129) tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4e-8) tmp = x + y; elseif (t <= 2.4e+129) tmp = x + (z * (y / (a - t))); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4e-8], N[(x + y), $MachinePrecision], If[LessEqual[t, 2.4e+129], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{-8}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{+129}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -4.0000000000000001e-8 or 2.3999999999999999e129 < t Initial program 99.9%
Taylor expanded in t around inf 82.1%
if -4.0000000000000001e-8 < t < 2.3999999999999999e129Initial program 96.9%
associate-*r/96.3%
Simplified96.3%
associate-/l*97.1%
associate-/r/98.7%
Applied egg-rr98.7%
Taylor expanded in z around inf 92.7%
associate-*l/94.5%
*-commutative94.5%
Simplified94.5%
Final simplification89.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -5.2e-45) (+ x y) (if (<= t -8e-287) (* (- z t) (/ y a)) (if (<= t 1.65e+129) x (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.2e-45) {
tmp = x + y;
} else if (t <= -8e-287) {
tmp = (z - t) * (y / a);
} else if (t <= 1.65e+129) {
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 (t <= (-5.2d-45)) then
tmp = x + y
else if (t <= (-8d-287)) then
tmp = (z - t) * (y / a)
else if (t <= 1.65d+129) 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 (t <= -5.2e-45) {
tmp = x + y;
} else if (t <= -8e-287) {
tmp = (z - t) * (y / a);
} else if (t <= 1.65e+129) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -5.2e-45: tmp = x + y elif t <= -8e-287: tmp = (z - t) * (y / a) elif t <= 1.65e+129: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -5.2e-45) tmp = Float64(x + y); elseif (t <= -8e-287) tmp = Float64(Float64(z - t) * Float64(y / a)); elseif (t <= 1.65e+129) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -5.2e-45) tmp = x + y; elseif (t <= -8e-287) tmp = (z - t) * (y / a); elseif (t <= 1.65e+129) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -5.2e-45], N[(x + y), $MachinePrecision], If[LessEqual[t, -8e-287], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.65e+129], x, N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{-45}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq -8 \cdot 10^{-287}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{+129}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -5.19999999999999973e-45 or 1.64999999999999995e129 < t Initial program 99.9%
Taylor expanded in t around inf 80.1%
if -5.19999999999999973e-45 < t < -8.00000000000000017e-287Initial program 96.1%
Taylor expanded in x around 0 62.7%
Taylor expanded in a around inf 51.4%
*-commutative51.4%
associate-/l*53.9%
associate-/r/55.1%
Simplified55.1%
if -8.00000000000000017e-287 < t < 1.64999999999999995e129Initial program 97.1%
Taylor expanded in x around inf 63.1%
Final simplification68.5%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.65e-24) (+ x y) (if (<= t 1.65e+129) (+ x (/ y (/ a z))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.65e-24) {
tmp = x + y;
} else if (t <= 1.65e+129) {
tmp = x + (y / (a / 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 (t <= (-1.65d-24)) then
tmp = x + y
else if (t <= 1.65d+129) then
tmp = x + (y / (a / 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 (t <= -1.65e-24) {
tmp = x + y;
} else if (t <= 1.65e+129) {
tmp = x + (y / (a / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.65e-24: tmp = x + y elif t <= 1.65e+129: tmp = x + (y / (a / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.65e-24) tmp = Float64(x + y); elseif (t <= 1.65e+129) tmp = Float64(x + Float64(y / Float64(a / z))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.65e-24) tmp = x + y; elseif (t <= 1.65e+129) tmp = x + (y / (a / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.65e-24], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.65e+129], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{-24}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{+129}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -1.64999999999999992e-24 or 1.64999999999999995e129 < t Initial program 99.9%
Taylor expanded in t around inf 80.7%
if -1.64999999999999992e-24 < t < 1.64999999999999995e129Initial program 96.8%
Taylor expanded in t around 0 80.6%
associate-/l*80.9%
Simplified80.9%
Final simplification80.8%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.05e-22) (+ x y) (if (<= t 1.65e+129) x (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.05e-22) {
tmp = x + y;
} else if (t <= 1.65e+129) {
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 (t <= (-1.05d-22)) then
tmp = x + y
else if (t <= 1.65d+129) 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 (t <= -1.05e-22) {
tmp = x + y;
} else if (t <= 1.65e+129) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.05e-22: tmp = x + y elif t <= 1.65e+129: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.05e-22) tmp = Float64(x + y); elseif (t <= 1.65e+129) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.05e-22) tmp = x + y; elseif (t <= 1.65e+129) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.05e-22], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.65e+129], x, N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.05 \cdot 10^{-22}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{+129}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -1.05000000000000004e-22 or 1.64999999999999995e129 < t Initial program 99.9%
Taylor expanded in t around inf 81.3%
if -1.05000000000000004e-22 < t < 1.64999999999999995e129Initial program 96.8%
Taylor expanded in x around inf 54.0%
Final simplification64.8%
(FPCore (x y z t a) :precision binary64 (if (<= y -1.55e+87) y (if (<= y 1.6e+53) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.55e+87) {
tmp = y;
} else if (y <= 1.6e+53) {
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.55d+87)) then
tmp = y
else if (y <= 1.6d+53) 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.55e+87) {
tmp = y;
} else if (y <= 1.6e+53) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.55e+87: tmp = y elif y <= 1.6e+53: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.55e+87) tmp = y; elseif (y <= 1.6e+53) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.55e+87) tmp = y; elseif (y <= 1.6e+53) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.55e+87], y, If[LessEqual[y, 1.6e+53], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{+87}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+53}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -1.55e87 or 1.6e53 < y Initial program 99.8%
Taylor expanded in x around 0 51.9%
Taylor expanded in t around inf 32.0%
if -1.55e87 < y < 1.6e53Initial program 97.0%
Taylor expanded in x around inf 71.0%
Final simplification56.5%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 98.1%
Taylor expanded in x around inf 51.0%
Final simplification51.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ (- z t) (- a t))))))
(if (< y -8.508084860551241e-17)
t_1
(if (< y 2.894426862792089e-49)
(+ x (* (* y (- z t)) (/ 1.0 (- a t))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (y * ((z - t) / (a - t)))
if (y < (-8.508084860551241d-17)) then
tmp = t_1
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) * (1.0d0 / (a - t)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * ((z - t) / (a - t))) tmp = 0 if y < -8.508084860551241e-17: tmp = t_1 elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) * (1.0 / (a - t))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) * Float64(1.0 / Float64(a - t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * ((z - t) / (a - t))); tmp = 0.0; if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) * (1.0 / (a - t))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -8.508084860551241e-17], t$95$1, If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;y < -8.508084860551241 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023171
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))
(+ x (* y (/ (- z t) (- a t)))))