
(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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- 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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ (- z t) (- z a)) y x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - t) / (z - a)), y, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - t) / Float64(z - a)), y, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z - t}{z - a}, y, x\right)
\end{array}
Initial program 97.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.0
Applied rewrites97.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ t a) y x)) (t_2 (/ (- z t) (- z a))))
(if (<= t_2 -1e+125)
(* (/ (- y) z) t)
(if (<= t_2 -5e-50)
t_1
(if (<= t_2 5e-16)
(fma (/ z (- a)) y x)
(if (<= t_2 20000000.0)
(+ y x)
(if (<= t_2 1e+143) t_1 (* (- z t) (/ y z)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t / a), y, x);
double t_2 = (z - t) / (z - a);
double tmp;
if (t_2 <= -1e+125) {
tmp = (-y / z) * t;
} else if (t_2 <= -5e-50) {
tmp = t_1;
} else if (t_2 <= 5e-16) {
tmp = fma((z / -a), y, x);
} else if (t_2 <= 20000000.0) {
tmp = y + x;
} else if (t_2 <= 1e+143) {
tmp = t_1;
} else {
tmp = (z - t) * (y / z);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t / a), y, x) t_2 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_2 <= -1e+125) tmp = Float64(Float64(Float64(-y) / z) * t); elseif (t_2 <= -5e-50) tmp = t_1; elseif (t_2 <= 5e-16) tmp = fma(Float64(z / Float64(-a)), y, x); elseif (t_2 <= 20000000.0) tmp = Float64(y + x); elseif (t_2 <= 1e+143) tmp = t_1; else tmp = Float64(Float64(z - t) * Float64(y / z)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+125], N[(N[((-y) / z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$2, -5e-50], t$95$1, If[LessEqual[t$95$2, 5e-16], N[(N[(z / (-a)), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$2, 20000000.0], N[(y + x), $MachinePrecision], If[LessEqual[t$95$2, 1e+143], t$95$1, N[(N[(z - t), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
t_2 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+125}:\\
\;\;\;\;\frac{-y}{z} \cdot t\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{-a}, y, x\right)\\
\mathbf{elif}\;t\_2 \leq 20000000:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t\_2 \leq 10^{+143}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{z}\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -9.9999999999999992e124Initial program 84.1%
Taylor expanded in z around inf
associate-+r+N/A
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites73.4%
Taylor expanded in t around inf
Applied rewrites67.8%
if -9.9999999999999992e124 < (/.f64 (-.f64 z t) (-.f64 z a)) < -4.99999999999999968e-50 or 2e7 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1e143Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
lower-/.f6479.1
Applied rewrites79.1%
if -4.99999999999999968e-50 < (/.f64 (-.f64 z t) (-.f64 z a)) < 5.0000000000000004e-16Initial program 97.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.6
Applied rewrites97.6%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6490.3
Applied rewrites90.3%
Taylor expanded in z around 0
Applied rewrites90.2%
if 5.0000000000000004e-16 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2e7Initial program 100.0%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6499.1
Applied rewrites99.1%
if 1e143 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 80.7%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6486.5
Applied rewrites86.5%
Taylor expanded in z around inf
Applied rewrites77.8%
Final simplification89.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ t a) y x)) (t_2 (/ (- z t) (- z a))))
(if (<= t_2 -1e+125)
(* (/ (- y) z) t)
(if (<= t_2 -5e-50)
t_1
(if (<= t_2 20000000.0)
(fma (/ z (- z a)) y x)
(if (<= t_2 1e+143) t_1 (* (- z t) (/ y z))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t / a), y, x);
double t_2 = (z - t) / (z - a);
double tmp;
if (t_2 <= -1e+125) {
tmp = (-y / z) * t;
} else if (t_2 <= -5e-50) {
tmp = t_1;
} else if (t_2 <= 20000000.0) {
tmp = fma((z / (z - a)), y, x);
} else if (t_2 <= 1e+143) {
tmp = t_1;
} else {
tmp = (z - t) * (y / z);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t / a), y, x) t_2 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_2 <= -1e+125) tmp = Float64(Float64(Float64(-y) / z) * t); elseif (t_2 <= -5e-50) tmp = t_1; elseif (t_2 <= 20000000.0) tmp = fma(Float64(z / Float64(z - a)), y, x); elseif (t_2 <= 1e+143) tmp = t_1; else tmp = Float64(Float64(z - t) * Float64(y / z)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+125], N[(N[((-y) / z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$2, -5e-50], t$95$1, If[LessEqual[t$95$2, 20000000.0], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$2, 1e+143], t$95$1, N[(N[(z - t), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
t_2 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+125}:\\
\;\;\;\;\frac{-y}{z} \cdot t\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 20000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+143}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{z}\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -9.9999999999999992e124Initial program 84.1%
Taylor expanded in z around inf
associate-+r+N/A
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites73.4%
Taylor expanded in t around inf
Applied rewrites67.8%
if -9.9999999999999992e124 < (/.f64 (-.f64 z t) (-.f64 z a)) < -4.99999999999999968e-50 or 2e7 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1e143Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
lower-/.f6479.1
Applied rewrites79.1%
if -4.99999999999999968e-50 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2e7Initial program 98.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6495.0
Applied rewrites95.0%
if 1e143 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 80.7%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6486.5
Applied rewrites86.5%
Taylor expanded in z around inf
Applied rewrites77.8%
Final simplification89.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 -1e+125)
(* (/ (- y) z) t)
(if (<= t_1 2e-53)
(fma (/ y a) t x)
(if (<= t_1 20000000.0)
(+ y x)
(if (<= t_1 1e+143) (fma (/ t a) y x) (* (- z t) (/ y z))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -1e+125) {
tmp = (-y / z) * t;
} else if (t_1 <= 2e-53) {
tmp = fma((y / a), t, x);
} else if (t_1 <= 20000000.0) {
tmp = y + x;
} else if (t_1 <= 1e+143) {
tmp = fma((t / a), y, x);
} else {
tmp = (z - t) * (y / z);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= -1e+125) tmp = Float64(Float64(Float64(-y) / z) * t); elseif (t_1 <= 2e-53) tmp = fma(Float64(y / a), t, x); elseif (t_1 <= 20000000.0) tmp = Float64(y + x); elseif (t_1 <= 1e+143) tmp = fma(Float64(t / a), y, x); else tmp = Float64(Float64(z - t) * Float64(y / z)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+125], N[(N[((-y) / z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$1, 2e-53], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[t$95$1, 20000000.0], N[(y + x), $MachinePrecision], If[LessEqual[t$95$1, 1e+143], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+125}:\\
\;\;\;\;\frac{-y}{z} \cdot t\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-53}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{elif}\;t\_1 \leq 20000000:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t\_1 \leq 10^{+143}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{z}\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -9.9999999999999992e124Initial program 84.1%
Taylor expanded in z around inf
associate-+r+N/A
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites73.4%
Taylor expanded in t around inf
Applied rewrites67.8%
if -9.9999999999999992e124 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2.00000000000000006e-53Initial program 98.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6480.8
Applied rewrites80.8%
if 2.00000000000000006e-53 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2e7Initial program 100.0%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6498.3
Applied rewrites98.3%
if 2e7 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1e143Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
lower-/.f6470.0
Applied rewrites70.0%
if 1e143 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 80.7%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6486.5
Applied rewrites86.5%
Taylor expanded in z around inf
Applied rewrites77.8%
Final simplification85.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (* (/ (- y) z) t)))
(if (<= t_1 -1e+125)
t_2
(if (<= t_1 2e-53)
(fma (/ y a) t x)
(if (<= t_1 20000000.0)
(+ y x)
(if (<= t_1 1e+143) (fma (/ t a) y x) t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = (-y / z) * t;
double tmp;
if (t_1 <= -1e+125) {
tmp = t_2;
} else if (t_1 <= 2e-53) {
tmp = fma((y / a), t, x);
} else if (t_1 <= 20000000.0) {
tmp = y + x;
} else if (t_1 <= 1e+143) {
tmp = fma((t / a), y, x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = Float64(Float64(Float64(-y) / z) * t) tmp = 0.0 if (t_1 <= -1e+125) tmp = t_2; elseif (t_1 <= 2e-53) tmp = fma(Float64(y / a), t, x); elseif (t_1 <= 20000000.0) tmp = Float64(y + x); elseif (t_1 <= 1e+143) tmp = fma(Float64(t / a), y, x); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-y) / z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+125], t$95$2, If[LessEqual[t$95$1, 2e-53], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[t$95$1, 20000000.0], N[(y + x), $MachinePrecision], If[LessEqual[t$95$1, 1e+143], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \frac{-y}{z} \cdot t\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+125}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-53}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{elif}\;t\_1 \leq 20000000:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t\_1 \leq 10^{+143}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -9.9999999999999992e124 or 1e143 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 82.6%
Taylor expanded in z around inf
associate-+r+N/A
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites74.2%
Taylor expanded in t around inf
Applied rewrites72.3%
if -9.9999999999999992e124 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2.00000000000000006e-53Initial program 98.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6480.8
Applied rewrites80.8%
if 2.00000000000000006e-53 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2e7Initial program 100.0%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6498.3
Applied rewrites98.3%
if 2e7 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1e143Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
lower-/.f6470.0
Applied rewrites70.0%
Final simplification85.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (fma (/ (- z t) z) y x)))
(if (<= t_1 -1e+125)
t_2
(if (<= t_1 -5e-50)
(fma (/ t a) y x)
(if (<= t_1 1e-5) (fma (/ z (- z a)) y x) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = fma(((z - t) / z), y, x);
double tmp;
if (t_1 <= -1e+125) {
tmp = t_2;
} else if (t_1 <= -5e-50) {
tmp = fma((t / a), y, x);
} else if (t_1 <= 1e-5) {
tmp = fma((z / (z - a)), y, x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = fma(Float64(Float64(z - t) / z), y, x) tmp = 0.0 if (t_1 <= -1e+125) tmp = t_2; elseif (t_1 <= -5e-50) tmp = fma(Float64(t / a), y, x); elseif (t_1 <= 1e-5) tmp = fma(Float64(z / Float64(z - a)), y, x); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+125], t$95$2, If[LessEqual[t$95$1, -5e-50], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t$95$1, 1e-5], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \mathsf{fma}\left(\frac{z - t}{z}, y, x\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+125}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-50}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;t\_1 \leq 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -9.9999999999999992e124 or 1.00000000000000008e-5 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 96.1%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
div-subN/A
*-inversesN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
fp-cancel-sign-sub-invN/A
*-inversesN/A
metadata-evalN/A
*-lft-identityN/A
div-subN/A
lower-/.f64N/A
lower--.f6488.4
Applied rewrites88.4%
if -9.9999999999999992e124 < (/.f64 (-.f64 z t) (-.f64 z a)) < -4.99999999999999968e-50Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
lower-/.f6487.8
Applied rewrites87.8%
if -4.99999999999999968e-50 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1.00000000000000008e-5Initial program 97.6%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6490.4
Applied rewrites90.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- z t) (- z a)))))
(if (or (<= t_1 -1e+162) (not (<= t_1 1e+127)))
(* (- z t) (/ y (- z a)))
(fma (/ z (- z a)) y x))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / (z - a));
double tmp;
if ((t_1 <= -1e+162) || !(t_1 <= 1e+127)) {
tmp = (z - t) * (y / (z - a));
} else {
tmp = fma((z / (z - a)), y, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(z - t) / Float64(z - a))) tmp = 0.0 if ((t_1 <= -1e+162) || !(t_1 <= 1e+127)) tmp = Float64(Float64(z - t) * Float64(y / Float64(z - a))); else tmp = fma(Float64(z / Float64(z - a)), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+162], N[Not[LessEqual[t$95$1, 1e+127]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+162} \lor \neg \left(t\_1 \leq 10^{+127}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\end{array}
\end{array}
if (*.f64 y (/.f64 (-.f64 z t) (-.f64 z a))) < -9.9999999999999994e161 or 9.99999999999999955e126 < (*.f64 y (/.f64 (-.f64 z t) (-.f64 z a))) Initial program 90.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6490.5
Applied rewrites90.5%
if -9.9999999999999994e161 < (*.f64 y (/.f64 (-.f64 z t) (-.f64 z a))) < 9.99999999999999955e126Initial program 99.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6488.6
Applied rewrites88.6%
Final simplification89.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* y (/ (- z t) (- z a))))) (if (or (<= t_1 -2e+300) (not (<= t_1 2e+248))) (* t (/ y a)) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / (z - a));
double tmp;
if ((t_1 <= -2e+300) || !(t_1 <= 2e+248)) {
tmp = t * (y / 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) :: t_1
real(8) :: tmp
t_1 = y * ((z - t) / (z - a))
if ((t_1 <= (-2d+300)) .or. (.not. (t_1 <= 2d+248))) then
tmp = t * (y / 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 t_1 = y * ((z - t) / (z - a));
double tmp;
if ((t_1 <= -2e+300) || !(t_1 <= 2e+248)) {
tmp = t * (y / a);
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * ((z - t) / (z - a)) tmp = 0 if (t_1 <= -2e+300) or not (t_1 <= 2e+248): tmp = t * (y / a) else: tmp = y + x return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(z - t) / Float64(z - a))) tmp = 0.0 if ((t_1 <= -2e+300) || !(t_1 <= 2e+248)) tmp = Float64(t * Float64(y / a)); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * ((z - t) / (z - a)); tmp = 0.0; if ((t_1 <= -2e+300) || ~((t_1 <= 2e+248))) tmp = t * (y / a); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+300], N[Not[LessEqual[t$95$1, 2e+248]], $MachinePrecision]], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+300} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+248}\right):\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if (*.f64 y (/.f64 (-.f64 z t) (-.f64 z a))) < -2.0000000000000001e300 or 2.00000000000000009e248 < (*.f64 y (/.f64 (-.f64 z t) (-.f64 z a))) Initial program 83.6%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6494.4
Applied rewrites94.4%
Taylor expanded in z around inf
Applied rewrites68.3%
Taylor expanded in z around 0
Applied rewrites59.2%
Applied rewrites66.7%
if -2.0000000000000001e300 < (*.f64 y (/.f64 (-.f64 z t) (-.f64 z a))) < 2.00000000000000009e248Initial program 99.1%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6470.9
Applied rewrites70.9%
Final simplification70.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (or (<= t_1 -5e-50) (not (<= t_1 1.00005)))
(fma (/ (- t) (- z a)) y x)
(fma (/ z (- z a)) y x))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if ((t_1 <= -5e-50) || !(t_1 <= 1.00005)) {
tmp = fma((-t / (z - a)), y, x);
} else {
tmp = fma((z / (z - a)), y, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if ((t_1 <= -5e-50) || !(t_1 <= 1.00005)) tmp = fma(Float64(Float64(-t) / Float64(z - a)), y, x); else tmp = fma(Float64(z / Float64(z - a)), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e-50], N[Not[LessEqual[t$95$1, 1.00005]], $MachinePrecision]], N[(N[((-t) / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-50} \lor \neg \left(t\_1 \leq 1.00005\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{-t}{z - a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -4.99999999999999968e-50 or 1.00005000000000011 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 93.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6493.1
Applied rewrites93.1%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6493.0
Applied rewrites93.0%
if -4.99999999999999968e-50 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1.00005000000000011Initial program 98.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6494.9
Applied rewrites94.9%
Final simplification94.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (or (<= t_1 -4e-16) (not (<= t_1 5e+16)))
(* (- t) (/ y (- z a)))
(fma (/ z (- z a)) y x))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if ((t_1 <= -4e-16) || !(t_1 <= 5e+16)) {
tmp = -t * (y / (z - a));
} else {
tmp = fma((z / (z - a)), y, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if ((t_1 <= -4e-16) || !(t_1 <= 5e+16)) tmp = Float64(Float64(-t) * Float64(y / Float64(z - a))); else tmp = fma(Float64(z / Float64(z - a)), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -4e-16], N[Not[LessEqual[t$95$1, 5e+16]], $MachinePrecision]], N[((-t) * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-16} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+16}\right):\\
\;\;\;\;\left(-t\right) \cdot \frac{y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, y, x\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -3.9999999999999999e-16 or 5e16 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 92.1%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.8
Applied rewrites74.8%
Taylor expanded in z around 0
Applied rewrites74.6%
if -3.9999999999999999e-16 < (/.f64 (-.f64 z t) (-.f64 z a)) < 5e16Initial program 98.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6493.7
Applied rewrites93.7%
Final simplification88.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- z a)))) (if (or (<= t_1 2e-53) (not (<= t_1 1e+27))) (fma (/ y a) t x) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if ((t_1 <= 2e-53) || !(t_1 <= 1e+27)) {
tmp = fma((y / a), t, x);
} else {
tmp = y + x;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if ((t_1 <= 2e-53) || !(t_1 <= 1e+27)) tmp = fma(Float64(y / a), t, x); else tmp = Float64(y + x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, 2e-53], N[Not[LessEqual[t$95$1, 1e+27]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-53} \lor \neg \left(t\_1 \leq 10^{+27}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 2.00000000000000006e-53 or 1e27 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 94.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6471.9
Applied rewrites71.9%
if 2.00000000000000006e-53 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1e27Initial program 100.0%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6494.2
Applied rewrites94.2%
Final simplification81.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 2e-53)
(fma (/ y a) t x)
(if (<= t_1 20000000.0) (+ y x) (fma (/ t a) y x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= 2e-53) {
tmp = fma((y / a), t, x);
} else if (t_1 <= 20000000.0) {
tmp = y + x;
} else {
tmp = fma((t / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= 2e-53) tmp = fma(Float64(y / a), t, x); elseif (t_1 <= 20000000.0) tmp = Float64(y + x); else tmp = fma(Float64(t / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-53], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[t$95$1, 20000000.0], N[(y + x), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-53}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{elif}\;t\_1 \leq 20000000:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 2.00000000000000006e-53Initial program 95.8%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.4
Applied rewrites75.4%
if 2.00000000000000006e-53 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2e7Initial program 100.0%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6498.3
Applied rewrites98.3%
if 2e7 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 92.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6492.4
Applied rewrites92.4%
Taylor expanded in z around 0
lower-/.f6458.9
Applied rewrites58.9%
(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 97.0%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f6462.2
Applied rewrites62.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 2024329
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine 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)))))