
(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 10 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-def98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.8e+173) (not (<= t 10500000000.0))) (+ y x) (+ x (* y (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.8e+173) || !(t <= 10500000000.0)) {
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 <= (-3.8d+173)) .or. (.not. (t <= 10500000000.0d0))) 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 <= -3.8e+173) || !(t <= 10500000000.0)) {
tmp = y + x;
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.8e+173) or not (t <= 10500000000.0): tmp = y + x else: tmp = x + (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.8e+173) || !(t <= 10500000000.0)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y * Float64(z / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.8e+173) || ~((t <= 10500000000.0))) 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, -3.8e+173], N[Not[LessEqual[t, 10500000000.0]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+173} \lor \neg \left(t \leq 10500000000\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
if t < -3.80000000000000011e173 or 1.05e10 < t Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around inf 81.1%
+-commutative81.1%
Simplified81.1%
if -3.80000000000000011e173 < t < 1.05e10Initial program 96.9%
Taylor expanded in z around inf 85.3%
Final simplification83.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.25e-46) (not (<= t 235000.0))) (+ x (* (/ y t) (- t z))) (+ x (/ y (/ (- a t) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.25e-46) || !(t <= 235000.0)) {
tmp = x + ((y / t) * (t - z));
} else {
tmp = x + (y / ((a - t) / 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 <= (-2.25d-46)) .or. (.not. (t <= 235000.0d0))) then
tmp = x + ((y / t) * (t - z))
else
tmp = x + (y / ((a - t) / 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 <= -2.25e-46) || !(t <= 235000.0)) {
tmp = x + ((y / t) * (t - z));
} else {
tmp = x + (y / ((a - t) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.25e-46) or not (t <= 235000.0): tmp = x + ((y / t) * (t - z)) else: tmp = x + (y / ((a - t) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.25e-46) || !(t <= 235000.0)) tmp = Float64(x + Float64(Float64(y / t) * Float64(t - z))); else tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.25e-46) || ~((t <= 235000.0))) tmp = x + ((y / t) * (t - z)); else tmp = x + (y / ((a - t) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.25e-46], N[Not[LessEqual[t, 235000.0]], $MachinePrecision]], N[(x + N[(N[(y / t), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.25 \cdot 10^{-46} \lor \neg \left(t \leq 235000\right):\\
\;\;\;\;x + \frac{y}{t} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\end{array}
\end{array}
if t < -2.25e-46 or 235000 < t Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in a around 0 67.3%
mul-1-neg67.3%
unsub-neg67.3%
associate-/l*86.9%
associate-/r/84.6%
Simplified84.6%
if -2.25e-46 < t < 235000Initial program 95.8%
Taylor expanded in z around inf 84.9%
associate-/l*86.0%
Simplified86.0%
Final simplification85.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.25e+33) (not (<= z 1.9e-11))) (+ x (/ y (/ (- a t) z))) (- x (/ t (/ (- a t) y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.25e+33) || !(z <= 1.9e-11)) {
tmp = x + (y / ((a - t) / z));
} else {
tmp = x - (t / ((a - t) / 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.25d+33)) .or. (.not. (z <= 1.9d-11))) then
tmp = x + (y / ((a - t) / z))
else
tmp = x - (t / ((a - t) / 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.25e+33) || !(z <= 1.9e-11)) {
tmp = x + (y / ((a - t) / z));
} else {
tmp = x - (t / ((a - t) / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.25e+33) or not (z <= 1.9e-11): tmp = x + (y / ((a - t) / z)) else: tmp = x - (t / ((a - t) / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.25e+33) || !(z <= 1.9e-11)) tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); else tmp = Float64(x - Float64(t / Float64(Float64(a - t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.25e+33) || ~((z <= 1.9e-11))) tmp = x + (y / ((a - t) / z)); else tmp = x - (t / ((a - t) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.25e+33], N[Not[LessEqual[z, 1.9e-11]], $MachinePrecision]], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+33} \lor \neg \left(z \leq 1.9 \cdot 10^{-11}\right):\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{t}{\frac{a - t}{y}}\\
\end{array}
\end{array}
if z < -1.24999999999999993e33 or 1.8999999999999999e-11 < z Initial program 96.6%
Taylor expanded in z around inf 76.7%
associate-/l*83.1%
Simplified83.1%
if -1.24999999999999993e33 < z < 1.8999999999999999e-11Initial program 99.2%
+-commutative99.2%
fma-def99.3%
Simplified99.3%
Taylor expanded in z around 0 77.7%
mul-1-neg77.7%
unsub-neg77.7%
associate-/l*89.5%
Simplified89.5%
Final simplification86.5%
(FPCore (x y z t a) :precision binary64 (if (<= t -1e+175) (+ y x) (if (<= t 10500000000.0) (+ x (/ y (/ (- a t) z))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1e+175) {
tmp = y + x;
} else if (t <= 10500000000.0) {
tmp = x + (y / ((a - t) / z));
} 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 (t <= (-1d+175)) then
tmp = y + x
else if (t <= 10500000000.0d0) then
tmp = x + (y / ((a - t) / z))
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 (t <= -1e+175) {
tmp = y + x;
} else if (t <= 10500000000.0) {
tmp = x + (y / ((a - t) / z));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1e+175: tmp = y + x elif t <= 10500000000.0: tmp = x + (y / ((a - t) / z)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1e+175) tmp = Float64(y + x); elseif (t <= 10500000000.0) tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1e+175) tmp = y + x; elseif (t <= 10500000000.0) tmp = x + (y / ((a - t) / z)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1e+175], N[(y + x), $MachinePrecision], If[LessEqual[t, 10500000000.0], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{+175}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 10500000000:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -9.9999999999999994e174 or 1.05e10 < t Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around inf 81.1%
+-commutative81.1%
Simplified81.1%
if -9.9999999999999994e174 < t < 1.05e10Initial program 96.9%
Taylor expanded in z around inf 84.5%
associate-/l*85.9%
Simplified85.9%
Final simplification84.1%
(FPCore (x y z t a)
:precision binary64
(if (<= t -2.6e-49)
(- x (/ y (/ t (- z t))))
(if (<= t 3000000000.0)
(+ x (/ y (/ (- a t) z)))
(- x (/ t (/ (- a t) y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.6e-49) {
tmp = x - (y / (t / (z - t)));
} else if (t <= 3000000000.0) {
tmp = x + (y / ((a - t) / z));
} else {
tmp = x - (t / ((a - t) / 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 <= (-2.6d-49)) then
tmp = x - (y / (t / (z - t)))
else if (t <= 3000000000.0d0) then
tmp = x + (y / ((a - t) / z))
else
tmp = x - (t / ((a - t) / 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 <= -2.6e-49) {
tmp = x - (y / (t / (z - t)));
} else if (t <= 3000000000.0) {
tmp = x + (y / ((a - t) / z));
} else {
tmp = x - (t / ((a - t) / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.6e-49: tmp = x - (y / (t / (z - t))) elif t <= 3000000000.0: tmp = x + (y / ((a - t) / z)) else: tmp = x - (t / ((a - t) / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.6e-49) tmp = Float64(x - Float64(y / Float64(t / Float64(z - t)))); elseif (t <= 3000000000.0) tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); else tmp = Float64(x - Float64(t / Float64(Float64(a - t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.6e-49) tmp = x - (y / (t / (z - t))); elseif (t <= 3000000000.0) tmp = x + (y / ((a - t) / z)); else tmp = x - (t / ((a - t) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.6e-49], N[(x - N[(y / N[(t / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3000000000.0], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.6 \cdot 10^{-49}:\\
\;\;\;\;x - \frac{y}{\frac{t}{z - t}}\\
\mathbf{elif}\;t \leq 3000000000:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{t}{\frac{a - t}{y}}\\
\end{array}
\end{array}
if t < -2.59999999999999995e-49Initial program 99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in a around 0 72.1%
mul-1-neg72.1%
unsub-neg72.1%
associate-/l*88.5%
associate-/r/86.7%
Simplified86.7%
associate-*l/72.1%
associate-/l*88.5%
Applied egg-rr88.5%
if -2.59999999999999995e-49 < t < 3e9Initial program 95.9%
Taylor expanded in z around inf 85.2%
associate-/l*86.2%
Simplified86.2%
if 3e9 < t Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around 0 64.0%
mul-1-neg64.0%
unsub-neg64.0%
associate-/l*85.7%
Simplified85.7%
Final simplification86.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.65e-49) (+ y x) (if (<= t 4.4e-12) (+ x (* y (/ z a))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.65e-49) {
tmp = y + x;
} else if (t <= 4.4e-12) {
tmp = x + (y * (z / 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 (t <= (-1.65d-49)) then
tmp = y + x
else if (t <= 4.4d-12) then
tmp = x + (y * (z / 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 (t <= -1.65e-49) {
tmp = y + x;
} else if (t <= 4.4e-12) {
tmp = x + (y * (z / a));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.65e-49: tmp = y + x elif t <= 4.4e-12: tmp = x + (y * (z / a)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.65e-49) tmp = Float64(y + x); elseif (t <= 4.4e-12) tmp = Float64(x + Float64(y * Float64(z / a))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.65e-49) tmp = y + x; elseif (t <= 4.4e-12) tmp = x + (y * (z / a)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.65e-49], N[(y + x), $MachinePrecision], If[LessEqual[t, 4.4e-12], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{-49}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 4.4 \cdot 10^{-12}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -1.65e-49 or 4.39999999999999983e-12 < t Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around inf 78.1%
+-commutative78.1%
Simplified78.1%
if -1.65e-49 < t < 4.39999999999999983e-12Initial program 95.7%
Taylor expanded in t around 0 77.7%
Final simplification77.9%
(FPCore (x y z t a) :precision binary64 (- x (* y (/ (- t z) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x - (y * ((t - z) / (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 * ((t - z) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (y * ((t - z) / (a - t)));
}
def code(x, y, z, t, a): return x - (y * ((t - z) / (a - t)))
function code(x, y, z, t, a) return Float64(x - Float64(y * Float64(Float64(t - z) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x - (y * ((t - z) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x - N[(y * N[(N[(t - z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - y \cdot \frac{t - z}{a - t}
\end{array}
Initial program 98.0%
Final simplification98.0%
(FPCore (x y z t a) :precision binary64 (+ y x))
double code(double x, double y, double z, double t, double a) {
return y + 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 = y + x
end function
public static double code(double x, double y, double z, double t, double a) {
return y + x;
}
def code(x, y, z, t, a): return y + x
function code(x, y, z, t, a) return Float64(y + x) end
function tmp = code(x, y, z, t, a) tmp = y + x; end
code[x_, y_, z_, t_, a_] := N[(y + x), $MachinePrecision]
\begin{array}{l}
\\
y + x
\end{array}
Initial program 98.0%
+-commutative98.0%
fma-def98.0%
Simplified98.0%
Taylor expanded in t around inf 59.6%
+-commutative59.6%
Simplified59.6%
Final simplification59.6%
(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%
+-commutative98.0%
fma-def98.0%
Simplified98.0%
Taylor expanded in y around 0 46.5%
Final simplification46.5%
(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 2023275
(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)))))