
(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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ (- z t) (- a t)) y x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - t) / (a - t)), y, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - t) / Float64(a - t)), y, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z - t}{a - t}, y, x\right)
\end{array}
Initial program 88.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.0
Applied rewrites97.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) (- a t))))
(if (or (<= t_1 -1e+41) (not (<= t_1 5e+16)))
(* (- z t) (/ y (- a t)))
(- x (* y (/ t (- a t)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / (a - t);
double tmp;
if ((t_1 <= -1e+41) || !(t_1 <= 5e+16)) {
tmp = (z - t) * (y / (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) :: t_1
real(8) :: tmp
t_1 = (y * (z - t)) / (a - t)
if ((t_1 <= (-1d+41)) .or. (.not. (t_1 <= 5d+16))) then
tmp = (z - t) * (y / (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 t_1 = (y * (z - t)) / (a - t);
double tmp;
if ((t_1 <= -1e+41) || !(t_1 <= 5e+16)) {
tmp = (z - t) * (y / (a - t));
} else {
tmp = x - (y * (t / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / (a - t) tmp = 0 if (t_1 <= -1e+41) or not (t_1 <= 5e+16): tmp = (z - t) * (y / (a - t)) else: tmp = x - (y * (t / (a - t))) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / Float64(a - t)) tmp = 0.0 if ((t_1 <= -1e+41) || !(t_1 <= 5e+16)) tmp = Float64(Float64(z - t) * Float64(y / 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) t_1 = (y * (z - t)) / (a - t); tmp = 0.0; if ((t_1 <= -1e+41) || ~((t_1 <= 5e+16))) tmp = (z - t) * (y / (a - t)); else tmp = x - (y * (t / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+41], N[Not[LessEqual[t$95$1, 5e+16]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(y / 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}
t_1 := \frac{y \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+41} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+16}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{t}{a - t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -1.00000000000000001e41 or 5e16 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 74.2%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6480.4
Applied rewrites80.4%
if -1.00000000000000001e41 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 5e16Initial program 99.9%
Taylor expanded in z around 0
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6491.5
Applied rewrites91.5%
Final simplification86.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4500000000.0) (not (<= t 3.8e+15))) (- x (* y (/ t (- a t)))) (+ x (/ (* z y) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4500000000.0) || !(t <= 3.8e+15)) {
tmp = x - (y * (t / (a - t)));
} 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 <= (-4500000000.0d0)) .or. (.not. (t <= 3.8d+15))) then
tmp = x - (y * (t / (a - t)))
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 <= -4500000000.0) || !(t <= 3.8e+15)) {
tmp = x - (y * (t / (a - t)));
} else {
tmp = x + ((z * y) / (a - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4500000000.0) or not (t <= 3.8e+15): tmp = x - (y * (t / (a - t))) else: tmp = x + ((z * y) / (a - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4500000000.0) || !(t <= 3.8e+15)) tmp = Float64(x - Float64(y * Float64(t / Float64(a - t)))); else tmp = Float64(x + Float64(Float64(z * y) / Float64(a - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4500000000.0) || ~((t <= 3.8e+15))) tmp = x - (y * (t / (a - t))); else tmp = x + ((z * y) / (a - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4500000000.0], N[Not[LessEqual[t, 3.8e+15]], $MachinePrecision]], N[(x - N[(y * N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4500000000 \lor \neg \left(t \leq 3.8 \cdot 10^{+15}\right):\\
\;\;\;\;x - y \cdot \frac{t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{a - t}\\
\end{array}
\end{array}
if t < -4.5e9 or 3.8e15 < t Initial program 83.2%
Taylor expanded in z around 0
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6488.7
Applied rewrites88.7%
if -4.5e9 < t < 3.8e15Initial program 93.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f6490.0
Applied rewrites90.0%
Final simplification89.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -7e+64) (fma (/ (- z t) (- t)) y x) (if (<= t 3.8e+15) (+ x (/ (* z y) (- a t))) (- x (* y (/ t (- a t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7e+64) {
tmp = fma(((z - t) / -t), y, x);
} else if (t <= 3.8e+15) {
tmp = x + ((z * y) / (a - t));
} else {
tmp = x - (y * (t / (a - t)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7e+64) tmp = fma(Float64(Float64(z - t) / Float64(-t)), y, x); elseif (t <= 3.8e+15) tmp = Float64(x + Float64(Float64(z * y) / Float64(a - t))); else tmp = Float64(x - Float64(y * Float64(t / Float64(a - t)))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7e+64], N[(N[(N[(z - t), $MachinePrecision] / (-t)), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t, 3.8e+15], N[(x + N[(N[(z * y), $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 -7 \cdot 10^{+64}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{-t}, y, x\right)\\
\mathbf{elif}\;t \leq 3.8 \cdot 10^{+15}:\\
\;\;\;\;x + \frac{z \cdot y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{t}{a - t}\\
\end{array}
\end{array}
if t < -6.9999999999999997e64Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in a around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6492.8
Applied rewrites92.8%
if -6.9999999999999997e64 < t < 3.8e15Initial program 93.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f6489.0
Applied rewrites89.0%
if 3.8e15 < t Initial program 80.4%
Taylor expanded in z around 0
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6489.4
Applied rewrites89.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.45e+40) (not (<= t 1.3e+73))) (+ y x) (fma (- z t) (/ y a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.45e+40) || !(t <= 1.3e+73)) {
tmp = y + x;
} else {
tmp = fma((z - t), (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.45e+40) || !(t <= 1.3e+73)) tmp = Float64(y + x); else tmp = fma(Float64(z - t), Float64(y / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.45e+40], N[Not[LessEqual[t, 1.3e+73]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{+40} \lor \neg \left(t \leq 1.3 \cdot 10^{+73}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if t < -1.45000000000000009e40 or 1.3e73 < t Initial program 82.7%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6483.7
Applied rewrites83.7%
if -1.45000000000000009e40 < t < 1.3e73Initial program 92.5%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6478.8
Applied rewrites78.8%
Final simplification80.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.35e+39) (not (<= t 1.7e-46))) (+ y x) (fma (/ z a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.35e+39) || !(t <= 1.7e-46)) {
tmp = y + x;
} else {
tmp = fma((z / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.35e+39) || !(t <= 1.7e-46)) tmp = Float64(y + x); else tmp = fma(Float64(z / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.35e+39], N[Not[LessEqual[t, 1.7e-46]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{+39} \lor \neg \left(t \leq 1.7 \cdot 10^{-46}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\end{array}
\end{array}
if t < -1.35000000000000002e39 or 1.69999999999999998e-46 < t Initial program 85.0%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6477.1
Applied rewrites77.1%
if -1.35000000000000002e39 < t < 1.69999999999999998e-46Initial program 92.7%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.0
Applied rewrites83.0%
Final simplification79.8%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4.4e-224)
(+ y x)
(if (<= t -3.8e-296)
(* y (/ z a))
(if (<= t 7e-17) (* (- x) -1.0) (+ y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.4e-224) {
tmp = y + x;
} else if (t <= -3.8e-296) {
tmp = y * (z / a);
} else if (t <= 7e-17) {
tmp = -x * -1.0;
} 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 <= (-4.4d-224)) then
tmp = y + x
else if (t <= (-3.8d-296)) then
tmp = y * (z / a)
else if (t <= 7d-17) then
tmp = -x * (-1.0d0)
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 <= -4.4e-224) {
tmp = y + x;
} else if (t <= -3.8e-296) {
tmp = y * (z / a);
} else if (t <= 7e-17) {
tmp = -x * -1.0;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4.4e-224: tmp = y + x elif t <= -3.8e-296: tmp = y * (z / a) elif t <= 7e-17: tmp = -x * -1.0 else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.4e-224) tmp = Float64(y + x); elseif (t <= -3.8e-296) tmp = Float64(y * Float64(z / a)); elseif (t <= 7e-17) tmp = Float64(Float64(-x) * -1.0); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4.4e-224) tmp = y + x; elseif (t <= -3.8e-296) tmp = y * (z / a); elseif (t <= 7e-17) tmp = -x * -1.0; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.4e-224], N[(y + x), $MachinePrecision], If[LessEqual[t, -3.8e-296], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7e-17], N[((-x) * -1.0), $MachinePrecision], N[(y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.4 \cdot 10^{-224}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq -3.8 \cdot 10^{-296}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{elif}\;t \leq 7 \cdot 10^{-17}:\\
\;\;\;\;\left(-x\right) \cdot -1\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -4.4000000000000002e-224 or 7.0000000000000003e-17 < t Initial program 87.5%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6469.7
Applied rewrites69.7%
if -4.4000000000000002e-224 < t < -3.8000000000000002e-296Initial program 85.2%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6485.1
Applied rewrites85.1%
Taylor expanded in z around inf
Applied rewrites78.1%
if -3.8000000000000002e-296 < t < 7.0000000000000003e-17Initial program 92.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6495.4
Applied rewrites95.4%
Taylor expanded in x around -inf
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower--.f64N/A
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6483.2
Applied rewrites83.2%
Taylor expanded in x around inf
Applied rewrites58.0%
Final simplification67.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.75e-15) (not (<= t 7e-17))) (+ y x) (* (- x) -1.0)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.75e-15) || !(t <= 7e-17)) {
tmp = y + x;
} else {
tmp = -x * -1.0;
}
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.75d-15)) .or. (.not. (t <= 7d-17))) then
tmp = y + x
else
tmp = -x * (-1.0d0)
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.75e-15) || !(t <= 7e-17)) {
tmp = y + x;
} else {
tmp = -x * -1.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.75e-15) or not (t <= 7e-17): tmp = y + x else: tmp = -x * -1.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.75e-15) || !(t <= 7e-17)) tmp = Float64(y + x); else tmp = Float64(Float64(-x) * -1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.75e-15) || ~((t <= 7e-17))) tmp = y + x; else tmp = -x * -1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.75e-15], N[Not[LessEqual[t, 7e-17]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[((-x) * -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.75 \cdot 10^{-15} \lor \neg \left(t \leq 7 \cdot 10^{-17}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot -1\\
\end{array}
\end{array}
if t < -1.75e-15 or 7.0000000000000003e-17 < t Initial program 84.7%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6475.9
Applied rewrites75.9%
if -1.75e-15 < t < 7.0000000000000003e-17Initial program 92.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6493.8
Applied rewrites93.8%
Taylor expanded in x around -inf
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower--.f64N/A
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6481.2
Applied rewrites81.2%
Taylor expanded in x around inf
Applied rewrites53.6%
Final simplification65.3%
(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 88.6%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6460.9
Applied rewrites60.9%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- a t) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (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 / ((a - t) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((a - t) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((a - t) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a - t}{z - t}}
\end{array}
herbie shell --seed 2024320
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
:precision binary64
:alt
(! :herbie-platform default (+ x (/ y (/ (- a t) (- z t)))))
(+ x (/ (* y (- z t)) (- a t))))