
(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 (if (<= (+ (/ (* (- z t) y) (- z a)) x) -5e+108) (+ (/ (/ y (- z a)) (/ 1.0 (- z t))) x) (+ (/ y (/ (- z a) (- z t))) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((((z - t) * y) / (z - a)) + x) <= -5e+108) {
tmp = ((y / (z - a)) / (1.0 / (z - t))) + x;
} else {
tmp = (y / ((z - a) / (z - t))) + 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 (((((z - t) * y) / (z - a)) + x) <= (-5d+108)) then
tmp = ((y / (z - a)) / (1.0d0 / (z - t))) + x
else
tmp = (y / ((z - a) / (z - t))) + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((((z - t) * y) / (z - a)) + x) <= -5e+108) {
tmp = ((y / (z - a)) / (1.0 / (z - t))) + x;
} else {
tmp = (y / ((z - a) / (z - t))) + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((((z - t) * y) / (z - a)) + x) <= -5e+108: tmp = ((y / (z - a)) / (1.0 / (z - t))) + x else: tmp = (y / ((z - a) / (z - t))) + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(Float64(Float64(z - t) * y) / Float64(z - a)) + x) <= -5e+108) tmp = Float64(Float64(Float64(y / Float64(z - a)) / Float64(1.0 / Float64(z - t))) + x); else tmp = Float64(Float64(y / Float64(Float64(z - a) / Float64(z - t))) + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((((z - t) * y) / (z - a)) + x) <= -5e+108) tmp = ((y / (z - a)) / (1.0 / (z - t))) + x; else tmp = (y / ((z - a) / (z - t))) + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], -5e+108], N[(N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\left(z - t\right) \cdot y}{z - a} + x \leq -5 \cdot 10^{+108}:\\
\;\;\;\;\frac{\frac{y}{z - a}}{\frac{1}{z - t}} + x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z - a}{z - t}} + x\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a))) < -4.99999999999999991e108Initial program 82.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.9
Applied rewrites99.9%
lift-*.f64N/A
*-lft-identity99.9
Applied rewrites99.9%
if -4.99999999999999991e108 < (+.f64 x (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a))) Initial program 90.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y (- z a)) (- z t))) (t_2 (/ (* (- z t) y) (- z a))))
(if (<= t_2 -4e+76)
t_1
(if (<= t_2 1e-173)
(+ (/ (* z y) (- z a)) x)
(if (<= t_2 2e+111) (fma (/ (- z t) z) 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 = ((z - t) * y) / (z - a);
double tmp;
if (t_2 <= -4e+76) {
tmp = t_1;
} else if (t_2 <= 1e-173) {
tmp = ((z * y) / (z - a)) + x;
} else if (t_2 <= 2e+111) {
tmp = fma(((z - t) / z), 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(z - t) * y) / Float64(z - a)) tmp = 0.0 if (t_2 <= -4e+76) tmp = t_1; elseif (t_2 <= 1e-173) tmp = Float64(Float64(Float64(z * y) / Float64(z - a)) + x); elseif (t_2 <= 2e+111) tmp = fma(Float64(Float64(z - t) / z), 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[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+76], t$95$1, If[LessEqual[t$95$2, 1e-173], N[(N[(N[(z * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 2e+111], N[(N[(N[(z - t), $MachinePrecision] / z), $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(z - t\right) \cdot y}{z - a}\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{-173}:\\
\;\;\;\;\frac{z \cdot y}{z - a} + x\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+111}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -4.0000000000000002e76 or 1.99999999999999991e111 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 65.8%
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 -4.0000000000000002e76 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 1e-173Initial program 99.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6493.5
Applied rewrites93.5%
if 1e-173 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 1.99999999999999991e111Initial program 99.8%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6489.8
Applied rewrites89.8%
Final simplification89.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y (- z a)) (- z t))) (t_2 (/ (* (- z t) y) (- z a))))
(if (<= t_2 -4e+76)
t_1
(if (<= t_2 1e-173)
(fma (/ z (- z a)) y x)
(if (<= t_2 2e+111) (fma (/ (- z t) z) 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 = ((z - t) * y) / (z - a);
double tmp;
if (t_2 <= -4e+76) {
tmp = t_1;
} else if (t_2 <= 1e-173) {
tmp = fma((z / (z - a)), y, x);
} else if (t_2 <= 2e+111) {
tmp = fma(((z - t) / z), 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(z - t) * y) / Float64(z - a)) tmp = 0.0 if (t_2 <= -4e+76) tmp = t_1; elseif (t_2 <= 1e-173) tmp = fma(Float64(z / Float64(z - a)), y, x); elseif (t_2 <= 2e+111) tmp = fma(Float64(Float64(z - t) / z), 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[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+76], t$95$1, If[LessEqual[t$95$2, 1e-173], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$2, 2e+111], N[(N[(N[(z - t), $MachinePrecision] / z), $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(z - t\right) \cdot y}{z - a}\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{-173}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+111}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -4.0000000000000002e76 or 1.99999999999999991e111 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 65.8%
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 -4.0000000000000002e76 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 1e-173Initial program 99.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6493.5
Applied rewrites93.5%
if 1e-173 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 1.99999999999999991e111Initial program 99.8%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6489.8
Applied rewrites89.8%
Final simplification89.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y (- z a)) (- z t))) (t_2 (/ (* (- z t) y) (- z a)))) (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 2e+303) (+ t_2 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 = ((z - t) * y) / (z - a);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 2e+303) {
tmp = t_2 + x;
} else {
tmp = t_1;
}
return tmp;
}
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 = ((z - t) * y) / (z - a);
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 2e+303) {
tmp = t_2 + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / (z - a)) * (z - t) t_2 = ((z - t) * y) / (z - a) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 2e+303: tmp = t_2 + 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(z - t) * y) / Float64(z - a)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 2e+303) tmp = Float64(t_2 + x); 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 = ((z - t) * y) / (z - a); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= 2e+303) tmp = t_2 + x; 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[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 2e+303], N[(t$95$2 + 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(z - t\right) \cdot y}{z - a}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+303}:\\
\;\;\;\;t\_2 + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < -inf.0 or 2e303 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) Initial program 45.9%
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%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 z a)) < 2e303Initial program 99.4%
Final simplification97.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z t) z) y x)))
(if (<= z -1.12e+54)
t_1
(if (<= z 130.0) (+ (/ (* (- t) y) (- z a)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - t) / z), y, x);
double tmp;
if (z <= -1.12e+54) {
tmp = t_1;
} else if (z <= 130.0) {
tmp = ((-t * y) / (z - a)) + x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - t) / z), y, x) tmp = 0.0 if (z <= -1.12e+54) tmp = t_1; elseif (z <= 130.0) tmp = Float64(Float64(Float64(Float64(-t) * y) / Float64(z - a)) + x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[z, -1.12e+54], t$95$1, If[LessEqual[z, 130.0], N[(N[(N[((-t) * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{if}\;z \leq -1.12 \cdot 10^{+54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 130:\\
\;\;\;\;\frac{\left(-t\right) \cdot y}{z - a} + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.12e54 or 130 < z Initial program 78.5%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6494.1
Applied rewrites94.1%
if -1.12e54 < z < 130Initial program 94.2%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6485.6
Applied rewrites85.6%
Final simplification89.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ (- z t) z) y x))) (if (<= z -2e+53) t_1 (if (<= z 3.9e-49) (fma (/ y a) t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - t) / z), y, x);
double tmp;
if (z <= -2e+53) {
tmp = t_1;
} else if (z <= 3.9e-49) {
tmp = fma((y / a), t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - t) / z), y, x) tmp = 0.0 if (z <= -2e+53) tmp = t_1; elseif (z <= 3.9e-49) tmp = fma(Float64(y / a), t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[z, -2e+53], t$95$1, If[LessEqual[z, 3.9e-49], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{if}\;z \leq -2 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{-49}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2e53 or 3.90000000000000011e-49 < z Initial program 81.0%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6490.9
Applied rewrites90.9%
if -2e53 < z < 3.90000000000000011e-49Initial program 93.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6480.3
Applied rewrites80.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ z (- z a)) y x))) (if (<= z -1850000000.0) t_1 (if (<= z 2.15e-49) (fma (/ y a) t 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 <= -1850000000.0) {
tmp = t_1;
} else if (z <= 2.15e-49) {
tmp = fma((y / a), t, 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 <= -1850000000.0) tmp = t_1; elseif (z <= 2.15e-49) tmp = fma(Float64(y / a), t, 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, -1850000000.0], t$95$1, If[LessEqual[z, 2.15e-49], N[(N[(y / a), $MachinePrecision] * t + 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 -1850000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-49}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.85e9 or 2.15000000000000008e-49 < z Initial program 82.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6485.4
Applied rewrites85.4%
if -1.85e9 < z < 2.15000000000000008e-49Initial program 93.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6481.5
Applied rewrites81.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma z (/ y (- z a)) x))) (if (<= z -1850000000.0) t_1 (if (<= z 2.15e-49) (fma (/ y a) t 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 <= -1850000000.0) {
tmp = t_1;
} else if (z <= 2.15e-49) {
tmp = fma((y / a), t, 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 <= -1850000000.0) tmp = t_1; elseif (z <= 2.15e-49) tmp = fma(Float64(y / a), t, 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, -1850000000.0], t$95$1, If[LessEqual[z, 2.15e-49], N[(N[(y / a), $MachinePrecision] * t + 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 -1850000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-49}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.85e9 or 2.15000000000000008e-49 < z Initial program 82.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6485.4
Applied rewrites85.4%
Applied rewrites83.1%
if -1.85e9 < z < 2.15000000000000008e-49Initial program 93.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6481.5
Applied rewrites81.5%
(FPCore (x y z t a) :precision binary64 (+ (/ y (/ (- z a) (- z t))) x))
double code(double x, double y, double z, double t, double a) {
return (y / ((z - a) / (z - t))) + 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 / ((z - a) / (z - t))) + x
end function
public static double code(double x, double y, double z, double t, double a) {
return (y / ((z - a) / (z - t))) + x;
}
def code(x, y, z, t, a): return (y / ((z - a) / (z - t))) + x
function code(x, y, z, t, a) return Float64(Float64(y / Float64(Float64(z - a) / Float64(z - t))) + x) end
function tmp = code(x, y, z, t, a) tmp = (y / ((z - a) / (z - t))) + x; end
code[x_, y_, z_, t_, a_] := N[(N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{\frac{z - a}{z - t}} + x
\end{array}
Initial program 87.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
Final simplification98.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.3e+53) (+ y x) (if (<= z 160.0) (fma (/ y a) t x) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+53) {
tmp = y + x;
} else if (z <= 160.0) {
tmp = fma((y / a), t, x);
} else {
tmp = y + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.3e+53) tmp = Float64(y + x); elseif (z <= 160.0) tmp = fma(Float64(y / a), t, x); else tmp = Float64(y + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.3e+53], N[(y + x), $MachinePrecision], If[LessEqual[z, 160.0], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+53}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 160:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -2.3000000000000002e53 or 160 < z Initial program 78.5%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6481.3
Applied rewrites81.3%
if -2.3000000000000002e53 < z < 160Initial program 94.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.0
Applied rewrites79.0%
(FPCore (x y z t a) :precision binary64 (if (<= y 3.8e+154) (+ y x) (* (/ t a) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 3.8e+154) {
tmp = y + x;
} else {
tmp = (t / a) * y;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= 3.8d+154) then
tmp = y + x
else
tmp = (t / a) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 3.8e+154) {
tmp = y + x;
} else {
tmp = (t / a) * y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= 3.8e+154: tmp = y + x else: tmp = (t / a) * y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= 3.8e+154) tmp = Float64(y + x); else tmp = Float64(Float64(t / a) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= 3.8e+154) tmp = y + x; else tmp = (t / a) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 3.8e+154], N[(y + x), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.8 \cdot 10^{+154}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot y\\
\end{array}
\end{array}
if y < 3.7999999999999998e154Initial program 91.1%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6466.6
Applied rewrites66.6%
if 3.7999999999999998e154 < y Initial program 67.9%
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--.f6482.6
Applied rewrites82.6%
Taylor expanded in z around 0
Applied rewrites41.8%
Applied rewrites46.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 87.7%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6459.6
Applied rewrites59.6%
(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 2024276
(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))))