
(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 13 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 (fma y (/ (- z t) (- a t)) x))
double code(double x, double y, double z, double t, double a) {
return fma(y, ((z - t) / (a - t)), x);
}
function code(x, y, z, t, a) return fma(y, Float64(Float64(z - t) / Float64(a - t)), x) end
code[x_, y_, z_, t_, a_] := N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)
\end{array}
Initial program 98.0%
+-commutative98.0%
fma-define98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.4e+31)
x
(if (<= a -2e-294)
(+ y x)
(if (<= a 1.5e-300) (* z (- (/ y t))) (if (<= a 1e+126) (+ y x) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.4e+31) {
tmp = x;
} else if (a <= -2e-294) {
tmp = y + x;
} else if (a <= 1.5e-300) {
tmp = z * -(y / t);
} else if (a <= 1e+126) {
tmp = y + x;
} else {
tmp = 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 (a <= (-1.4d+31)) then
tmp = x
else if (a <= (-2d-294)) then
tmp = y + x
else if (a <= 1.5d-300) then
tmp = z * -(y / t)
else if (a <= 1d+126) then
tmp = y + x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.4e+31) {
tmp = x;
} else if (a <= -2e-294) {
tmp = y + x;
} else if (a <= 1.5e-300) {
tmp = z * -(y / t);
} else if (a <= 1e+126) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.4e+31: tmp = x elif a <= -2e-294: tmp = y + x elif a <= 1.5e-300: tmp = z * -(y / t) elif a <= 1e+126: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.4e+31) tmp = x; elseif (a <= -2e-294) tmp = Float64(y + x); elseif (a <= 1.5e-300) tmp = Float64(z * Float64(-Float64(y / t))); elseif (a <= 1e+126) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.4e+31) tmp = x; elseif (a <= -2e-294) tmp = y + x; elseif (a <= 1.5e-300) tmp = z * -(y / t); elseif (a <= 1e+126) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.4e+31], x, If[LessEqual[a, -2e-294], N[(y + x), $MachinePrecision], If[LessEqual[a, 1.5e-300], N[(z * (-N[(y / t), $MachinePrecision])), $MachinePrecision], If[LessEqual[a, 1e+126], N[(y + x), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.4 \cdot 10^{+31}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -2 \cdot 10^{-294}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq 1.5 \cdot 10^{-300}:\\
\;\;\;\;z \cdot \left(-\frac{y}{t}\right)\\
\mathbf{elif}\;a \leq 10^{+126}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.40000000000000008e31 or 9.99999999999999925e125 < a Initial program 99.0%
Taylor expanded in x around inf 72.1%
if -1.40000000000000008e31 < a < -2.00000000000000003e-294 or 1.50000000000000012e-300 < a < 9.99999999999999925e125Initial program 97.9%
Taylor expanded in t around inf 68.3%
+-commutative68.3%
Simplified68.3%
if -2.00000000000000003e-294 < a < 1.50000000000000012e-300Initial program 89.4%
Taylor expanded in z around inf 89.6%
Taylor expanded in a around 0 89.6%
mul-1-neg89.6%
unsub-neg89.6%
associate-/l*79.2%
Simplified79.2%
Taylor expanded in x around 0 78.5%
mul-1-neg78.5%
associate-*l/78.2%
distribute-rgt-neg-in78.2%
Simplified78.2%
Final simplification70.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.1e-12) (not (<= t 1e-57))) (+ y x) (+ x (* y (/ (- z t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.1e-12) || !(t <= 1e-57)) {
tmp = y + x;
} else {
tmp = x + (y * ((z - 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 ((t <= (-3.1d-12)) .or. (.not. (t <= 1d-57))) then
tmp = y + x
else
tmp = x + (y * ((z - 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 ((t <= -3.1e-12) || !(t <= 1e-57)) {
tmp = y + x;
} else {
tmp = x + (y * ((z - t) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.1e-12) or not (t <= 1e-57): tmp = y + x else: tmp = x + (y * ((z - t) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.1e-12) || !(t <= 1e-57)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.1e-12) || ~((t <= 1e-57))) tmp = y + x; else tmp = x + (y * ((z - t) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.1e-12], N[Not[LessEqual[t, 1e-57]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.1 \cdot 10^{-12} \lor \neg \left(t \leq 10^{-57}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\end{array}
\end{array}
if t < -3.1000000000000001e-12 or 9.99999999999999955e-58 < t Initial program 99.9%
Taylor expanded in t around inf 77.6%
+-commutative77.6%
Simplified77.6%
if -3.1000000000000001e-12 < t < 9.99999999999999955e-58Initial program 96.0%
Taylor expanded in a around inf 83.0%
Final simplification80.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.25e+75) (not (<= t 3.1e+15))) (+ y x) (+ x (/ (* y z) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.25e+75) || !(t <= 3.1e+15)) {
tmp = y + x;
} 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 ((t <= (-1.25d+75)) .or. (.not. (t <= 3.1d+15))) then
tmp = y + x
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 ((t <= -1.25e+75) || !(t <= 3.1e+15)) {
tmp = y + x;
} else {
tmp = x + ((y * z) / (a - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.25e+75) or not (t <= 3.1e+15): tmp = y + x else: tmp = x + ((y * z) / (a - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.25e+75) || !(t <= 3.1e+15)) tmp = Float64(y + x); else tmp = Float64(x + Float64(Float64(y * z) / Float64(a - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.25e+75) || ~((t <= 3.1e+15))) tmp = y + x; else tmp = x + ((y * z) / (a - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.25e+75], N[Not[LessEqual[t, 3.1e+15]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{+75} \lor \neg \left(t \leq 3.1 \cdot 10^{+15}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{a - t}\\
\end{array}
\end{array}
if t < -1.2500000000000001e75 or 3.1e15 < t Initial program 99.9%
Taylor expanded in t around inf 80.0%
+-commutative80.0%
Simplified80.0%
if -1.2500000000000001e75 < t < 3.1e15Initial program 96.7%
Taylor expanded in z around inf 88.0%
Final simplification84.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -6.2e-14) (not (<= t 7.5e-58))) (+ x (* (/ y t) (- t z))) (+ x (/ (* y z) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -6.2e-14) || !(t <= 7.5e-58)) {
tmp = x + ((y / t) * (t - z));
} 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 ((t <= (-6.2d-14)) .or. (.not. (t <= 7.5d-58))) then
tmp = x + ((y / t) * (t - z))
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 ((t <= -6.2e-14) || !(t <= 7.5e-58)) {
tmp = x + ((y / t) * (t - z));
} else {
tmp = x + ((y * z) / (a - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -6.2e-14) or not (t <= 7.5e-58): tmp = x + ((y / t) * (t - z)) else: tmp = x + ((y * z) / (a - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -6.2e-14) || !(t <= 7.5e-58)) tmp = Float64(x + Float64(Float64(y / t) * Float64(t - z))); else tmp = Float64(x + Float64(Float64(y * z) / Float64(a - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -6.2e-14) || ~((t <= 7.5e-58))) tmp = x + ((y / t) * (t - z)); else tmp = x + ((y * z) / (a - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -6.2e-14], N[Not[LessEqual[t, 7.5e-58]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{-14} \lor \neg \left(t \leq 7.5 \cdot 10^{-58}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{a - t}\\
\end{array}
\end{array}
if t < -6.20000000000000009e-14 or 7.50000000000000002e-58 < t Initial program 99.9%
associate-*r/83.2%
Simplified83.2%
associate-/l*99.9%
associate-/r/95.0%
Applied egg-rr95.0%
Taylor expanded in a around 0 74.2%
metadata-eval74.2%
associate-/l*86.1%
cancel-sign-sub-inv86.1%
*-lft-identity86.1%
associate-/r/82.6%
*-commutative82.6%
Simplified82.6%
if -6.20000000000000009e-14 < t < 7.50000000000000002e-58Initial program 96.0%
Taylor expanded in z around inf 91.7%
Final simplification86.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2e+34) (not (<= t 235000000000.0))) (- x (* y (/ t (- a t)))) (+ x (/ (* y z) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2e+34) || !(t <= 235000000000.0)) {
tmp = x - (y * (t / (a - 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 ((t <= (-2d+34)) .or. (.not. (t <= 235000000000.0d0))) then
tmp = x - (y * (t / (a - 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 ((t <= -2e+34) || !(t <= 235000000000.0)) {
tmp = x - (y * (t / (a - t)));
} else {
tmp = x + ((y * z) / (a - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2e+34) or not (t <= 235000000000.0): tmp = x - (y * (t / (a - t))) else: tmp = x + ((y * z) / (a - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2e+34) || !(t <= 235000000000.0)) tmp = Float64(x - Float64(y * Float64(t / Float64(a - t)))); else tmp = Float64(x + Float64(Float64(y * z) / Float64(a - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2e+34) || ~((t <= 235000000000.0))) tmp = x - (y * (t / (a - t))); else tmp = x + ((y * z) / (a - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2e+34], N[Not[LessEqual[t, 235000000000.0]], $MachinePrecision]], N[(x - N[(y * N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{+34} \lor \neg \left(t \leq 235000000000\right):\\
\;\;\;\;x - y \cdot \frac{t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{a - t}\\
\end{array}
\end{array}
if t < -1.99999999999999989e34 or 2.35e11 < t Initial program 99.9%
Taylor expanded in z around 0 73.9%
mul-1-neg73.9%
unsub-neg73.9%
associate-/l*86.5%
Simplified86.5%
associate-/r/91.5%
Applied egg-rr91.5%
if -1.99999999999999989e34 < t < 2.35e11Initial program 96.6%
Taylor expanded in z around inf 89.1%
Final simplification90.1%
(FPCore (x y z t a)
:precision binary64
(if (<= t -5.5e-13)
(- x (/ y (/ t (- z t))))
(if (<= t 26000000000000.0)
(+ x (/ (* y z) (- a t)))
(- x (* y (/ t (- a t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.5e-13) {
tmp = x - (y / (t / (z - t)));
} else if (t <= 26000000000000.0) {
tmp = x + ((y * z) / (a - t));
} else {
tmp = x - (y * (t / (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 <= (-5.5d-13)) then
tmp = x - (y / (t / (z - t)))
else if (t <= 26000000000000.0d0) then
tmp = x + ((y * z) / (a - t))
else
tmp = x - (y * (t / (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 <= -5.5e-13) {
tmp = x - (y / (t / (z - t)));
} else if (t <= 26000000000000.0) {
tmp = x + ((y * z) / (a - t));
} else {
tmp = x - (y * (t / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -5.5e-13: tmp = x - (y / (t / (z - t))) elif t <= 26000000000000.0: tmp = x + ((y * z) / (a - t)) else: tmp = x - (y * (t / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -5.5e-13) tmp = Float64(x - Float64(y / Float64(t / Float64(z - t)))); elseif (t <= 26000000000000.0) tmp = Float64(x + Float64(Float64(y * z) / Float64(a - t))); else tmp = Float64(x - Float64(y * Float64(t / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -5.5e-13) tmp = x - (y / (t / (z - t))); elseif (t <= 26000000000000.0) tmp = x + ((y * z) / (a - t)); else tmp = x - (y * (t / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -5.5e-13], N[(x - N[(y / N[(t / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 26000000000000.0], N[(x + N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{-13}:\\
\;\;\;\;x - \frac{y}{\frac{t}{z - t}}\\
\mathbf{elif}\;t \leq 26000000000000:\\
\;\;\;\;x + \frac{y \cdot z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{t}{a - t}\\
\end{array}
\end{array}
if t < -5.49999999999999979e-13Initial program 99.9%
Taylor expanded in a around 0 76.9%
mul-1-neg76.9%
unsub-neg76.9%
associate-/l*89.7%
Simplified89.7%
if -5.49999999999999979e-13 < t < 2.6e13Initial program 96.3%
Taylor expanded in z around inf 91.0%
if 2.6e13 < t Initial program 99.8%
Taylor expanded in z around 0 71.6%
mul-1-neg71.6%
unsub-neg71.6%
associate-/l*83.7%
Simplified83.7%
associate-/r/89.6%
Applied egg-rr89.6%
Final simplification90.3%
(FPCore (x y z t a) :precision binary64 (if (<= a -8.6e-90) x (if (<= a 1.02e-178) (* y (- 1.0 (/ z t))) (if (<= a 6e+121) (+ y x) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -8.6e-90) {
tmp = x;
} else if (a <= 1.02e-178) {
tmp = y * (1.0 - (z / t));
} else if (a <= 6e+121) {
tmp = y + x;
} else {
tmp = 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 (a <= (-8.6d-90)) then
tmp = x
else if (a <= 1.02d-178) then
tmp = y * (1.0d0 - (z / t))
else if (a <= 6d+121) then
tmp = y + x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -8.6e-90) {
tmp = x;
} else if (a <= 1.02e-178) {
tmp = y * (1.0 - (z / t));
} else if (a <= 6e+121) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -8.6e-90: tmp = x elif a <= 1.02e-178: tmp = y * (1.0 - (z / t)) elif a <= 6e+121: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -8.6e-90) tmp = x; elseif (a <= 1.02e-178) tmp = Float64(y * Float64(1.0 - Float64(z / t))); elseif (a <= 6e+121) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -8.6e-90) tmp = x; elseif (a <= 1.02e-178) tmp = y * (1.0 - (z / t)); elseif (a <= 6e+121) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -8.6e-90], x, If[LessEqual[a, 1.02e-178], N[(y * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 6e+121], N[(y + x), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.6 \cdot 10^{-90}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.02 \cdot 10^{-178}:\\
\;\;\;\;y \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{elif}\;a \leq 6 \cdot 10^{+121}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -8.6000000000000004e-90 or 6.0000000000000005e121 < a Initial program 99.1%
Taylor expanded in x around inf 67.5%
if -8.6000000000000004e-90 < a < 1.02000000000000006e-178Initial program 94.4%
Taylor expanded in a around 0 81.6%
+-commutative81.6%
mul-1-neg81.6%
Simplified81.6%
Taylor expanded in y around inf 68.6%
if 1.02000000000000006e-178 < a < 6.0000000000000005e121Initial program 99.9%
Taylor expanded in t around inf 79.8%
+-commutative79.8%
Simplified79.8%
Final simplification70.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.4e-16) (not (<= t 1e-57))) (+ y x) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.4e-16) || !(t <= 1e-57)) {
tmp = y + x;
} else {
tmp = x + (y * (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 ((t <= (-3.4d-16)) .or. (.not. (t <= 1d-57))) then
tmp = y + x
else
tmp = x + (y * (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 ((t <= -3.4e-16) || !(t <= 1e-57)) {
tmp = y + x;
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.4e-16) or not (t <= 1e-57): tmp = y + x else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.4e-16) || !(t <= 1e-57)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y * Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.4e-16) || ~((t <= 1e-57))) tmp = y + x; else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.4e-16], N[Not[LessEqual[t, 1e-57]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{-16} \lor \neg \left(t \leq 10^{-57}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -3.4e-16 or 9.99999999999999955e-58 < t Initial program 99.9%
Taylor expanded in t around inf 77.6%
+-commutative77.6%
Simplified77.6%
if -3.4e-16 < t < 9.99999999999999955e-58Initial program 96.0%
Taylor expanded in t around 0 80.5%
Final simplification79.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.35e-16) (not (<= t 9.2e-58))) (+ y x) (+ x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.35e-16) || !(t <= 9.2e-58)) {
tmp = y + x;
} else {
tmp = x + (y / (a / z));
}
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.35d-16)) .or. (.not. (t <= 9.2d-58))) then
tmp = y + x
else
tmp = x + (y / (a / z))
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.35e-16) || !(t <= 9.2e-58)) {
tmp = y + x;
} else {
tmp = x + (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.35e-16) or not (t <= 9.2e-58): tmp = y + x else: tmp = x + (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.35e-16) || !(t <= 9.2e-58)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y / Float64(a / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.35e-16) || ~((t <= 9.2e-58))) tmp = y + x; else tmp = x + (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.35e-16], N[Not[LessEqual[t, 9.2e-58]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{-16} \lor \neg \left(t \leq 9.2 \cdot 10^{-58}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -1.35e-16 or 9.1999999999999995e-58 < t Initial program 99.9%
Taylor expanded in t around inf 77.6%
+-commutative77.6%
Simplified77.6%
if -1.35e-16 < t < 9.1999999999999995e-58Initial program 96.0%
Taylor expanded in t around 0 80.4%
+-commutative80.4%
associate-/l*81.0%
Simplified81.0%
Final simplification79.2%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.4e+31) x (if (<= a 3.7e+121) (+ y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.4e+31) {
tmp = x;
} else if (a <= 3.7e+121) {
tmp = y + x;
} else {
tmp = 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 (a <= (-1.4d+31)) then
tmp = x
else if (a <= 3.7d+121) then
tmp = y + x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.4e+31) {
tmp = x;
} else if (a <= 3.7e+121) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.4e+31: tmp = x elif a <= 3.7e+121: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.4e+31) tmp = x; elseif (a <= 3.7e+121) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.4e+31) tmp = x; elseif (a <= 3.7e+121) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.4e+31], x, If[LessEqual[a, 3.7e+121], N[(y + x), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.4 \cdot 10^{+31}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 3.7 \cdot 10^{+121}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.40000000000000008e31 or 3.70000000000000013e121 < a Initial program 99.0%
Taylor expanded in x around inf 72.1%
if -1.40000000000000008e31 < a < 3.70000000000000013e121Initial program 97.4%
Taylor expanded in t around inf 65.7%
+-commutative65.7%
Simplified65.7%
Final simplification68.3%
(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.0%
Final simplification98.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 98.0%
Taylor expanded in x around inf 53.3%
Final simplification53.3%
(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 2024034
(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)))))