
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- z a))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (z - a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (z - a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (z - a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- z a))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y * (z - t)) / (z - a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (z - a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (z - a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{z - a}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (/ (/ y (- a z)) (/ 1.0 (- z t)))))
(t_2 (* (- t z) y))
(t_3 (/ t_2 (- a z))))
(if (<= t_3 -1e+228) t_1 (if (<= t_3 1.8e+282) (- x (/ t_2 (- z a))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((y / (a - z)) / (1.0 / (z - t)));
double t_2 = (t - z) * y;
double t_3 = t_2 / (a - z);
double tmp;
if (t_3 <= -1e+228) {
tmp = t_1;
} else if (t_3 <= 1.8e+282) {
tmp = x - (t_2 / (z - a));
} 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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = x - ((y / (a - z)) / (1.0d0 / (z - t)))
t_2 = (t - z) * y
t_3 = t_2 / (a - z)
if (t_3 <= (-1d+228)) then
tmp = t_1
else if (t_3 <= 1.8d+282) then
tmp = x - (t_2 / (z - a))
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 / (a - z)) / (1.0 / (z - t)));
double t_2 = (t - z) * y;
double t_3 = t_2 / (a - z);
double tmp;
if (t_3 <= -1e+228) {
tmp = t_1;
} else if (t_3 <= 1.8e+282) {
tmp = x - (t_2 / (z - a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - ((y / (a - z)) / (1.0 / (z - t))) t_2 = (t - z) * y t_3 = t_2 / (a - z) tmp = 0 if t_3 <= -1e+228: tmp = t_1 elif t_3 <= 1.8e+282: tmp = x - (t_2 / (z - a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(y / Float64(a - z)) / Float64(1.0 / Float64(z - t)))) t_2 = Float64(Float64(t - z) * y) t_3 = Float64(t_2 / Float64(a - z)) tmp = 0.0 if (t_3 <= -1e+228) tmp = t_1; elseif (t_3 <= 1.8e+282) tmp = Float64(x - Float64(t_2 / Float64(z - a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - ((y / (a - z)) / (1.0 / (z - t))); t_2 = (t - z) * y; t_3 = t_2 / (a - z); tmp = 0.0; if (t_3 <= -1e+228) tmp = t_1; elseif (t_3 <= 1.8e+282) tmp = x - (t_2 / (z - a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -1e+228], t$95$1, If[LessEqual[t$95$3, 1.8e+282], N[(x - N[(t$95$2 / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{\frac{y}{a - z}}{\frac{1}{z - t}}\\
t_2 := \left(t - z\right) \cdot y\\
t_3 := \frac{t\_2}{a - z}\\
\mathbf{if}\;t\_3 \leq -1 \cdot 10^{+228}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 1.8 \cdot 10^{+282}:\\
\;\;\;\;x - \frac{t\_2}{z - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -9.9999999999999992e227 or 1.79999999999999993e282 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 46.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift--.f64N/A
flip--N/A
clear-numN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
if -9.9999999999999992e227 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 1.79999999999999993e282Initial program 99.4%
Final simplification99.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- t z) y)) (t_2 (/ t_1 (- a z))))
(if (<= t_2 -1e+228)
(* (/ y (- z a)) (- z t))
(if (<= t_2 1.8e+282)
(- x (/ t_1 (- z a)))
(/ (/ y (- a z)) (/ -1.0 (- z t)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) * y;
double t_2 = t_1 / (a - z);
double tmp;
if (t_2 <= -1e+228) {
tmp = (y / (z - a)) * (z - t);
} else if (t_2 <= 1.8e+282) {
tmp = x - (t_1 / (z - a));
} else {
tmp = (y / (a - z)) / (-1.0 / (z - 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) :: t_2
real(8) :: tmp
t_1 = (t - z) * y
t_2 = t_1 / (a - z)
if (t_2 <= (-1d+228)) then
tmp = (y / (z - a)) * (z - t)
else if (t_2 <= 1.8d+282) then
tmp = x - (t_1 / (z - a))
else
tmp = (y / (a - z)) / ((-1.0d0) / (z - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) * y;
double t_2 = t_1 / (a - z);
double tmp;
if (t_2 <= -1e+228) {
tmp = (y / (z - a)) * (z - t);
} else if (t_2 <= 1.8e+282) {
tmp = x - (t_1 / (z - a));
} else {
tmp = (y / (a - z)) / (-1.0 / (z - t));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t - z) * y t_2 = t_1 / (a - z) tmp = 0 if t_2 <= -1e+228: tmp = (y / (z - a)) * (z - t) elif t_2 <= 1.8e+282: tmp = x - (t_1 / (z - a)) else: tmp = (y / (a - z)) / (-1.0 / (z - t)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t - z) * y) t_2 = Float64(t_1 / Float64(a - z)) tmp = 0.0 if (t_2 <= -1e+228) tmp = Float64(Float64(y / Float64(z - a)) * Float64(z - t)); elseif (t_2 <= 1.8e+282) tmp = Float64(x - Float64(t_1 / Float64(z - a))); else tmp = Float64(Float64(y / Float64(a - z)) / Float64(-1.0 / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t - z) * y; t_2 = t_1 / (a - z); tmp = 0.0; if (t_2 <= -1e+228) tmp = (y / (z - a)) * (z - t); elseif (t_2 <= 1.8e+282) tmp = x - (t_1 / (z - a)); else tmp = (y / (a - z)) / (-1.0 / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+228], N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1.8e+282], N[(x - N[(t$95$1 / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] / N[(-1.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - z\right) \cdot y\\
t_2 := \frac{t\_1}{a - z}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+228}:\\
\;\;\;\;\frac{y}{z - a} \cdot \left(z - t\right)\\
\mathbf{elif}\;t\_2 \leq 1.8 \cdot 10^{+282}:\\
\;\;\;\;x - \frac{t\_1}{z - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{a - z}}{\frac{-1}{z - t}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -9.9999999999999992e227Initial program 51.0%
Taylor expanded in y around inf
distribute-lft-out--N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6491.6
Applied rewrites91.6%
if -9.9999999999999992e227 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 1.79999999999999993e282Initial program 99.4%
if 1.79999999999999993e282 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 39.2%
Taylor expanded in y around inf
distribute-lft-out--N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6489.6
Applied rewrites89.6%
Applied rewrites89.8%
Final simplification97.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y (- z a)) (- z t)))
(t_2 (* (- t z) y))
(t_3 (/ t_2 (- a z))))
(if (<= t_3 -1e+228) t_1 (if (<= t_3 1e+293) (- x (/ t_2 (- z a))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (z - a)) * (z - t);
double t_2 = (t - z) * y;
double t_3 = t_2 / (a - z);
double tmp;
if (t_3 <= -1e+228) {
tmp = t_1;
} else if (t_3 <= 1e+293) {
tmp = x - (t_2 / (z - a));
} 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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = (y / (z - a)) * (z - t)
t_2 = (t - z) * y
t_3 = t_2 / (a - z)
if (t_3 <= (-1d+228)) then
tmp = t_1
else if (t_3 <= 1d+293) then
tmp = x - (t_2 / (z - a))
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 = (y / (z - a)) * (z - t);
double t_2 = (t - z) * y;
double t_3 = t_2 / (a - z);
double tmp;
if (t_3 <= -1e+228) {
tmp = t_1;
} else if (t_3 <= 1e+293) {
tmp = x - (t_2 / (z - a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / (z - a)) * (z - t) t_2 = (t - z) * y t_3 = t_2 / (a - z) tmp = 0 if t_3 <= -1e+228: tmp = t_1 elif t_3 <= 1e+293: tmp = x - (t_2 / (z - a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / Float64(z - a)) * Float64(z - t)) t_2 = Float64(Float64(t - z) * y) t_3 = Float64(t_2 / Float64(a - z)) tmp = 0.0 if (t_3 <= -1e+228) tmp = t_1; elseif (t_3 <= 1e+293) tmp = Float64(x - Float64(t_2 / Float64(z - a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / (z - a)) * (z - t); t_2 = (t - z) * y; t_3 = t_2 / (a - z); tmp = 0.0; if (t_3 <= -1e+228) tmp = t_1; elseif (t_3 <= 1e+293) tmp = x - (t_2 / (z - a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -1e+228], t$95$1, If[LessEqual[t$95$3, 1e+293], N[(x - N[(t$95$2 / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z - a} \cdot \left(z - t\right)\\
t_2 := \left(t - z\right) \cdot y\\
t_3 := \frac{t\_2}{a - z}\\
\mathbf{if}\;t\_3 \leq -1 \cdot 10^{+228}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq 10^{+293}:\\
\;\;\;\;x - \frac{t\_2}{z - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -9.9999999999999992e227 or 9.9999999999999992e292 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 44.7%
Taylor expanded in y around inf
distribute-lft-out--N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6490.6
Applied rewrites90.6%
if -9.9999999999999992e227 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 9.9999999999999992e292Initial program 99.4%
Final simplification97.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y (- z a)) (- z t))) (t_2 (/ (* (- t z) y) (- a z))))
(if (<= t_2 -2e+111)
t_1
(if (<= t_2 5e+121) (- x (/ (* z y) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (z - a)) * (z - t);
double t_2 = ((t - z) * y) / (a - z);
double tmp;
if (t_2 <= -2e+111) {
tmp = t_1;
} else if (t_2 <= 5e+121) {
tmp = x - ((z * y) / (a - z));
} 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) :: t_2
real(8) :: tmp
t_1 = (y / (z - a)) * (z - t)
t_2 = ((t - z) * y) / (a - z)
if (t_2 <= (-2d+111)) then
tmp = t_1
else if (t_2 <= 5d+121) then
tmp = x - ((z * y) / (a - z))
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 = (y / (z - a)) * (z - t);
double t_2 = ((t - z) * y) / (a - z);
double tmp;
if (t_2 <= -2e+111) {
tmp = t_1;
} else if (t_2 <= 5e+121) {
tmp = x - ((z * y) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / (z - a)) * (z - t) t_2 = ((t - z) * y) / (a - z) tmp = 0 if t_2 <= -2e+111: tmp = t_1 elif t_2 <= 5e+121: tmp = x - ((z * y) / (a - z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / Float64(z - a)) * Float64(z - t)) t_2 = Float64(Float64(Float64(t - z) * y) / Float64(a - z)) tmp = 0.0 if (t_2 <= -2e+111) tmp = t_1; elseif (t_2 <= 5e+121) tmp = Float64(x - Float64(Float64(z * y) / Float64(a - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / (z - a)) * (z - t); t_2 = ((t - z) * y) / (a - z); tmp = 0.0; if (t_2 <= -2e+111) tmp = t_1; elseif (t_2 <= 5e+121) tmp = x - ((z * y) / (a - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+111], t$95$1, If[LessEqual[t$95$2, 5e+121], N[(x - N[(N[(z * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z - a} \cdot \left(z - t\right)\\
t_2 := \frac{\left(t - z\right) \cdot y}{a - z}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+121}:\\
\;\;\;\;x - \frac{z \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -1.99999999999999991e111 or 5.00000000000000007e121 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 62.3%
Taylor expanded in y around inf
distribute-lft-out--N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6484.9
Applied rewrites84.9%
if -1.99999999999999991e111 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 5.00000000000000007e121Initial program 99.3%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6489.9
Applied rewrites89.9%
Final simplification87.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y (- z a)) (- z t))) (t_2 (/ (* (- t z) y) (- a z)))) (if (<= t_2 -2e+111) t_1 (if (<= t_2 5e+121) (fma (/ z (- z a)) y x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (z - a)) * (z - t);
double t_2 = ((t - z) * y) / (a - z);
double tmp;
if (t_2 <= -2e+111) {
tmp = t_1;
} else if (t_2 <= 5e+121) {
tmp = fma((z / (z - a)), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y / Float64(z - a)) * Float64(z - t)) t_2 = Float64(Float64(Float64(t - z) * y) / Float64(a - z)) tmp = 0.0 if (t_2 <= -2e+111) tmp = t_1; elseif (t_2 <= 5e+121) tmp = fma(Float64(z / Float64(z - a)), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+111], t$95$1, If[LessEqual[t$95$2, 5e+121], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z - a} \cdot \left(z - t\right)\\
t_2 := \frac{\left(t - z\right) \cdot y}{a - z}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+121}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -1.99999999999999991e111 or 5.00000000000000007e121 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 62.3%
Taylor expanded in y around inf
distribute-lft-out--N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6484.9
Applied rewrites84.9%
if -1.99999999999999991e111 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 5.00000000000000007e121Initial program 99.3%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6489.5
Applied rewrites89.5%
Final simplification87.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma z (/ y (- z a)) x)))
(if (<= z -1.25e+26)
t_1
(if (<= z -1.28e-79)
(fma (/ (- t) z) y x)
(if (<= z 1.3e-66) (+ (/ (* t y) a) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(z, (y / (z - a)), x);
double tmp;
if (z <= -1.25e+26) {
tmp = t_1;
} else if (z <= -1.28e-79) {
tmp = fma((-t / z), y, x);
} else if (z <= 1.3e-66) {
tmp = ((t * y) / a) + x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(z, Float64(y / Float64(z - a)), x) tmp = 0.0 if (z <= -1.25e+26) tmp = t_1; elseif (z <= -1.28e-79) tmp = fma(Float64(Float64(-t) / z), y, x); elseif (z <= 1.3e-66) tmp = Float64(Float64(Float64(t * y) / a) + x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1.25e+26], t$95$1, If[LessEqual[z, -1.28e-79], N[(N[((-t) / z), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 1.3e-66], N[(N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{y}{z - a}, x\right)\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.28 \cdot 10^{-79}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-t}{z}, y, x\right)\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-66}:\\
\;\;\;\;\frac{t \cdot y}{a} + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.25e26 or 1.2999999999999999e-66 < z Initial program 74.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6485.2
Applied rewrites85.2%
Applied rewrites82.2%
if -1.25e26 < z < -1.28e-79Initial program 99.7%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6494.7
Applied rewrites94.7%
Taylor expanded in t around inf
Applied rewrites83.9%
if -1.28e-79 < z < 1.2999999999999999e-66Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6488.2
Applied rewrites88.2%
Final simplification84.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.25e+27)
(+ x y)
(if (<= z -1.28e-79)
(fma (/ (- t) z) y x)
(if (<= z 2.25e-26) (+ (* (/ t a) y) x) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.25e+27) {
tmp = x + y;
} else if (z <= -1.28e-79) {
tmp = fma((-t / z), y, x);
} else if (z <= 2.25e-26) {
tmp = ((t / a) * y) + x;
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.25e+27) tmp = Float64(x + y); elseif (z <= -1.28e-79) tmp = fma(Float64(Float64(-t) / z), y, x); elseif (z <= 2.25e-26) tmp = Float64(Float64(Float64(t / a) * y) + x); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.25e+27], N[(x + y), $MachinePrecision], If[LessEqual[z, -1.28e-79], N[(N[((-t) / z), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 2.25e-26], N[(N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision] + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+27}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -1.28 \cdot 10^{-79}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-t}{z}, y, x\right)\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-26}:\\
\;\;\;\;\frac{t}{a} \cdot y + x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1.24999999999999995e27 or 2.2499999999999999e-26 < z Initial program 73.4%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
if -1.24999999999999995e27 < z < -1.28e-79Initial program 99.7%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6494.7
Applied rewrites94.7%
Taylor expanded in t around inf
Applied rewrites83.9%
if -1.28e-79 < z < 2.2499999999999999e-26Initial program 96.4%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6484.1
Applied rewrites84.1%
Applied rewrites84.8%
Final simplification79.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.25e+27)
(+ x y)
(if (<= z -4.8e-77)
(fma (/ (- t) z) y x)
(if (<= z 2.25e-26) (fma (/ y a) t x) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.25e+27) {
tmp = x + y;
} else if (z <= -4.8e-77) {
tmp = fma((-t / z), y, x);
} else if (z <= 2.25e-26) {
tmp = fma((y / a), t, x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.25e+27) tmp = Float64(x + y); elseif (z <= -4.8e-77) tmp = fma(Float64(Float64(-t) / z), y, x); elseif (z <= 2.25e-26) tmp = fma(Float64(y / a), t, x); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.25e+27], N[(x + y), $MachinePrecision], If[LessEqual[z, -4.8e-77], N[(N[((-t) / z), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 2.25e-26], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+27}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -4.8 \cdot 10^{-77}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-t}{z}, y, x\right)\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-26}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1.24999999999999995e27 or 2.2499999999999999e-26 < z Initial program 73.4%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
if -1.24999999999999995e27 < z < -4.7999999999999998e-77Initial program 99.7%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6494.7
Applied rewrites94.7%
Taylor expanded in t around inf
Applied rewrites83.9%
if -4.7999999999999998e-77 < z < 2.2499999999999999e-26Initial program 96.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.2
Applied rewrites84.2%
Final simplification79.2%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.8e+16) (fma (/ z (- z a)) y x) (if (<= a 4.2e-32) (fma (/ (- z t) z) y x) (+ (* (/ t a) y) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.8e+16) {
tmp = fma((z / (z - a)), y, x);
} else if (a <= 4.2e-32) {
tmp = fma(((z - t) / z), y, x);
} else {
tmp = ((t / a) * y) + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.8e+16) tmp = fma(Float64(z / Float64(z - a)), y, x); elseif (a <= 4.2e-32) tmp = fma(Float64(Float64(z - t) / z), y, x); else tmp = Float64(Float64(Float64(t / a) * y) + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.8e+16], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[a, 4.2e-32], N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.8 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{elif}\;a \leq 4.2 \cdot 10^{-32}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot y + x\\
\end{array}
\end{array}
if a < -2.8e16Initial program 78.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6488.1
Applied rewrites88.1%
if -2.8e16 < a < 4.1999999999999998e-32Initial program 88.6%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6485.8
Applied rewrites85.8%
if 4.1999999999999998e-32 < a Initial program 83.5%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6477.5
Applied rewrites77.5%
Applied rewrites84.5%
Final simplification86.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ z (- z a)) y x))) (if (<= z -9.5e-82) t_1 (if (<= z 7.6e-64) (+ (/ (* t y) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / (z - a)), y, x);
double tmp;
if (z <= -9.5e-82) {
tmp = t_1;
} else if (z <= 7.6e-64) {
tmp = ((t * y) / a) + x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / Float64(z - a)), y, x) tmp = 0.0 if (z <= -9.5e-82) tmp = t_1; elseif (z <= 7.6e-64) tmp = Float64(Float64(Float64(t * y) / a) + x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[z, -9.5e-82], t$95$1, If[LessEqual[z, 7.6e-64], N[(N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{-82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{-64}:\\
\;\;\;\;\frac{t \cdot y}{a} + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.4999999999999996e-82 or 7.6000000000000003e-64 < z Initial program 77.6%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6482.7
Applied rewrites82.7%
if -9.4999999999999996e-82 < z < 7.6000000000000003e-64Initial program 96.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6488.2
Applied rewrites88.2%
Final simplification84.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.1e-5) (+ x y) (if (<= z 2.25e-26) (fma (/ y a) t x) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.1e-5) {
tmp = x + y;
} else if (z <= 2.25e-26) {
tmp = fma((y / a), t, x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.1e-5) tmp = Float64(x + y); elseif (z <= 2.25e-26) tmp = fma(Float64(y / a), t, x); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.1e-5], N[(x + y), $MachinePrecision], If[LessEqual[z, 2.25e-26], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-5}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-26}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -2.09999999999999988e-5 or 2.2499999999999999e-26 < z Initial program 74.9%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6473.0
Applied rewrites73.0%
if -2.09999999999999988e-5 < z < 2.2499999999999999e-26Initial program 96.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.0
Applied rewrites83.0%
Final simplification77.6%
(FPCore (x y z t a) :precision binary64 (+ x y))
double code(double x, double y, double z, double t, double a) {
return x + y;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x + y;
}
def code(x, y, z, t, a): return x + y
function code(x, y, z, t, a) return Float64(x + y) end
function tmp = code(x, y, z, t, a) tmp = x + y; end
code[x_, y_, z_, t_, a_] := N[(x + y), $MachinePrecision]
\begin{array}{l}
\\
x + y
\end{array}
Initial program 84.8%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6461.2
Applied rewrites61.2%
Final simplification61.2%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- z a) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y / ((z - a) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((z - a) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(z - a) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((z - a) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}
herbie shell --seed 2024243
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:precision binary64
:alt
(! :herbie-platform default (+ x (/ y (/ (- z a) (- z t)))))
(+ x (/ (* y (- z t)) (- z a))))