
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (+ (+ x (* y z)) (* t a)) (* (* z a) b)))) (if (<= t_1 2e+258) t_1 (fma a t (fma z (fma a b y) x)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b);
double tmp;
if (t_1 <= 2e+258) {
tmp = t_1;
} else {
tmp = fma(a, t, fma(z, fma(a, b, y), x));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(z * a) * b)) tmp = 0.0 if (t_1 <= 2e+258) tmp = t_1; else tmp = fma(a, t, fma(z, fma(a, b, y), x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+258], t$95$1, N[(a * t + N[(z * N[(a * b + y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(z \cdot a\right) \cdot b\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+258}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), x\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < 2.00000000000000011e258Initial program 99.0%
if 2.00000000000000011e258 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 69.9%
Taylor expanded in x around 0
Applied rewrites98.2%
Final simplification98.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (fma b z t))))
(if (<= a -2.4e-102)
t_1
(if (<= a 1.02e-36)
(fma z y x)
(if (<= a 5.4e+116) (fma a t (* y z)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * fma(b, z, t);
double tmp;
if (a <= -2.4e-102) {
tmp = t_1;
} else if (a <= 1.02e-36) {
tmp = fma(z, y, x);
} else if (a <= 5.4e+116) {
tmp = fma(a, t, (y * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(a * fma(b, z, t)) tmp = 0.0 if (a <= -2.4e-102) tmp = t_1; elseif (a <= 1.02e-36) tmp = fma(z, y, x); elseif (a <= 5.4e+116) tmp = fma(a, t, Float64(y * z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(b * z + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.4e-102], t$95$1, If[LessEqual[a, 1.02e-36], N[(z * y + x), $MachinePrecision], If[LessEqual[a, 5.4e+116], N[(a * t + N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \mathsf{fma}\left(b, z, t\right)\\
\mathbf{if}\;a \leq -2.4 \cdot 10^{-102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.02 \cdot 10^{-36}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;a \leq 5.4 \cdot 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(a, t, y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.4e-102 or 5.3999999999999999e116 < a Initial program 86.4%
Taylor expanded in a around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6480.5
Applied rewrites80.5%
if -2.4e-102 < a < 1.02e-36Initial program 99.9%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6483.4
Applied rewrites83.4%
if 1.02e-36 < a < 5.3999999999999999e116Initial program 92.7%
Taylor expanded in x around 0
Applied rewrites96.4%
Taylor expanded in y around inf
Applied rewrites78.6%
Final simplification81.5%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -3.9e-94)
(fma a t x)
(if (<= a 7.2e-31)
(fma z y x)
(if (<= a 7.6e+113) (fma a t x) (* a (* z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -3.9e-94) {
tmp = fma(a, t, x);
} else if (a <= 7.2e-31) {
tmp = fma(z, y, x);
} else if (a <= 7.6e+113) {
tmp = fma(a, t, x);
} else {
tmp = a * (z * b);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -3.9e-94) tmp = fma(a, t, x); elseif (a <= 7.2e-31) tmp = fma(z, y, x); elseif (a <= 7.6e+113) tmp = fma(a, t, x); else tmp = Float64(a * Float64(z * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.9e-94], N[(a * t + x), $MachinePrecision], If[LessEqual[a, 7.2e-31], N[(z * y + x), $MachinePrecision], If[LessEqual[a, 7.6e+113], N[(a * t + x), $MachinePrecision], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.9 \cdot 10^{-94}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{elif}\;a \leq 7.2 \cdot 10^{-31}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;a \leq 7.6 \cdot 10^{+113}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\end{array}
\end{array}
if a < -3.9000000000000002e-94 or 7.20000000000000007e-31 < a < 7.6000000000000007e113Initial program 91.7%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6459.8
Applied rewrites59.8%
if -3.9000000000000002e-94 < a < 7.20000000000000007e-31Initial program 99.9%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6482.2
Applied rewrites82.2%
if 7.6000000000000007e113 < a Initial program 75.2%
Taylor expanded in b around inf
lower-*.f64N/A
lower-*.f6462.1
Applied rewrites62.1%
Final simplification69.7%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma z (fma a b y) x))) (if (<= z -0.057) t_1 (if (<= z 920.0) (fma a t (fma z y x)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(z, fma(a, b, y), x);
double tmp;
if (z <= -0.057) {
tmp = t_1;
} else if (z <= 920.0) {
tmp = fma(a, t, fma(z, y, x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(z, fma(a, b, y), x) tmp = 0.0 if (z <= -0.057) tmp = t_1; elseif (z <= 920.0) tmp = fma(a, t, fma(z, y, x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(a * b + y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -0.057], t$95$1, If[LessEqual[z, 920.0], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), x\right)\\
\mathbf{if}\;z \leq -0.057:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 920:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.0570000000000000021 or 920 < z Initial program 86.3%
Taylor expanded in t around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6491.8
Applied rewrites91.8%
if -0.0570000000000000021 < z < 920Initial program 99.2%
Taylor expanded in b around 0
Applied rewrites86.7%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* a (fma b z t)))) (if (<= a -6.1e+195) t_1 (if (<= a 1.05e+117) (fma a t (fma z y x)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * fma(b, z, t);
double tmp;
if (a <= -6.1e+195) {
tmp = t_1;
} else if (a <= 1.05e+117) {
tmp = fma(a, t, fma(z, y, x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(a * fma(b, z, t)) tmp = 0.0 if (a <= -6.1e+195) tmp = t_1; elseif (a <= 1.05e+117) tmp = fma(a, t, fma(z, y, x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(b * z + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -6.1e+195], t$95$1, If[LessEqual[a, 1.05e+117], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \mathsf{fma}\left(b, z, t\right)\\
\mathbf{if}\;a \leq -6.1 \cdot 10^{+195}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{+117}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -6.09999999999999974e195 or 1.0500000000000001e117 < a Initial program 77.2%
Taylor expanded in a around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6492.4
Applied rewrites92.4%
if -6.09999999999999974e195 < a < 1.0500000000000001e117Initial program 97.9%
Taylor expanded in b around 0
Applied rewrites85.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* a (fma b z t)))) (if (<= a -2.4e-102) t_1 (if (<= a 5.8e+34) (fma z y x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * fma(b, z, t);
double tmp;
if (a <= -2.4e-102) {
tmp = t_1;
} else if (a <= 5.8e+34) {
tmp = fma(z, y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(a * fma(b, z, t)) tmp = 0.0 if (a <= -2.4e-102) tmp = t_1; elseif (a <= 5.8e+34) tmp = fma(z, y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(b * z + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.4e-102], t$95$1, If[LessEqual[a, 5.8e+34], N[(z * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \mathsf{fma}\left(b, z, t\right)\\
\mathbf{if}\;a \leq -2.4 \cdot 10^{-102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 5.8 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.4e-102 or 5.8000000000000003e34 < a Initial program 87.4%
Taylor expanded in a around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6478.9
Applied rewrites78.9%
if -2.4e-102 < a < 5.8000000000000003e34Initial program 99.1%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6480.9
Applied rewrites80.9%
(FPCore (x y z t a b) :precision binary64 (if (<= z -5500.0) (fma z y x) (if (<= z 3.5e+120) (fma a t x) (fma z y x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -5500.0) {
tmp = fma(z, y, x);
} else if (z <= 3.5e+120) {
tmp = fma(a, t, x);
} else {
tmp = fma(z, y, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -5500.0) tmp = fma(z, y, x); elseif (z <= 3.5e+120) tmp = fma(a, t, x); else tmp = fma(z, y, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -5500.0], N[(z * y + x), $MachinePrecision], If[LessEqual[z, 3.5e+120], N[(a * t + x), $MachinePrecision], N[(z * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5500:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+120}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\end{array}
\end{array}
if z < -5500 or 3.50000000000000007e120 < z Initial program 85.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6463.7
Applied rewrites63.7%
if -5500 < z < 3.50000000000000007e120Initial program 97.4%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6469.5
Applied rewrites69.5%
(FPCore (x y z t a b) :precision binary64 (if (<= z -2.6e+105) (* y z) (if (<= z 3.5e+120) (fma a t x) (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.6e+105) {
tmp = y * z;
} else if (z <= 3.5e+120) {
tmp = fma(a, t, x);
} else {
tmp = y * z;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.6e+105) tmp = Float64(y * z); elseif (z <= 3.5e+120) tmp = fma(a, t, x); else tmp = Float64(y * z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.6e+105], N[(y * z), $MachinePrecision], If[LessEqual[z, 3.5e+120], N[(a * t + x), $MachinePrecision], N[(y * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+105}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+120}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -2.6000000000000002e105 or 3.50000000000000007e120 < z Initial program 84.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6456.2
Applied rewrites56.2%
if -2.6000000000000002e105 < z < 3.50000000000000007e120Initial program 97.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6468.0
Applied rewrites68.0%
Final simplification64.0%
(FPCore (x y z t a b) :precision binary64 (fma a t (fma z (fma a b y) x)))
double code(double x, double y, double z, double t, double a, double b) {
return fma(a, t, fma(z, fma(a, b, y), x));
}
function code(x, y, z, t, a, b) return fma(a, t, fma(z, fma(a, b, y), x)) end
code[x_, y_, z_, t_, a_, b_] := N[(a * t + N[(z * N[(a * b + y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), x\right)\right)
\end{array}
Initial program 92.6%
Taylor expanded in x around 0
Applied rewrites94.7%
(FPCore (x y z t a b) :precision binary64 (if (<= z -0.9) (* y z) (if (<= z 1.7e+14) (* t a) (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -0.9) {
tmp = y * z;
} else if (z <= 1.7e+14) {
tmp = t * a;
} else {
tmp = y * z;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if (z <= (-0.9d0)) then
tmp = y * z
else if (z <= 1.7d+14) then
tmp = t * a
else
tmp = y * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -0.9) {
tmp = y * z;
} else if (z <= 1.7e+14) {
tmp = t * a;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -0.9: tmp = y * z elif z <= 1.7e+14: tmp = t * a else: tmp = y * z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -0.9) tmp = Float64(y * z); elseif (z <= 1.7e+14) tmp = Float64(t * a); else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -0.9) tmp = y * z; elseif (z <= 1.7e+14) tmp = t * a; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -0.9], N[(y * z), $MachinePrecision], If[LessEqual[z, 1.7e+14], N[(t * a), $MachinePrecision], N[(y * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.9:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+14}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -0.900000000000000022 or 1.7e14 < z Initial program 86.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6445.8
Applied rewrites45.8%
if -0.900000000000000022 < z < 1.7e14Initial program 99.2%
Taylor expanded in t around inf
lower-*.f6442.8
Applied rewrites42.8%
Final simplification44.3%
(FPCore (x y z t a b) :precision binary64 (* t a))
double code(double x, double y, double z, double t, double a, double b) {
return t * a;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
code = t * a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return t * a;
}
def code(x, y, z, t, a, b): return t * a
function code(x, y, z, t, a, b) return Float64(t * a) end
function tmp = code(x, y, z, t, a, b) tmp = t * a; end
code[x_, y_, z_, t_, a_, b_] := N[(t * a), $MachinePrecision]
\begin{array}{l}
\\
t \cdot a
\end{array}
Initial program 92.6%
Taylor expanded in t around inf
lower-*.f6427.8
Applied rewrites27.8%
Final simplification27.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* z (+ (* b a) y)) (+ x (* t a)))))
(if (< z -11820553527347888000.0)
t_1
(if (< z 4.7589743188364287e-122)
(+ (* (+ (* b z) t) a) (+ (* z y) x))
t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z * ((b * a) + y)) + (x + (t * a));
double tmp;
if (z < -11820553527347888000.0) {
tmp = t_1;
} else if (z < 4.7589743188364287e-122) {
tmp = (((b * z) + t) * a) + ((z * y) + x);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (z * ((b * a) + y)) + (x + (t * a))
if (z < (-11820553527347888000.0d0)) then
tmp = t_1
else if (z < 4.7589743188364287d-122) then
tmp = (((b * z) + t) * a) + ((z * y) + x)
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 b) {
double t_1 = (z * ((b * a) + y)) + (x + (t * a));
double tmp;
if (z < -11820553527347888000.0) {
tmp = t_1;
} else if (z < 4.7589743188364287e-122) {
tmp = (((b * z) + t) * a) + ((z * y) + x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (z * ((b * a) + y)) + (x + (t * a)) tmp = 0 if z < -11820553527347888000.0: tmp = t_1 elif z < 4.7589743188364287e-122: tmp = (((b * z) + t) * a) + ((z * y) + x) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(z * Float64(Float64(b * a) + y)) + Float64(x + Float64(t * a))) tmp = 0.0 if (z < -11820553527347888000.0) tmp = t_1; elseif (z < 4.7589743188364287e-122) tmp = Float64(Float64(Float64(Float64(b * z) + t) * a) + Float64(Float64(z * y) + x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (z * ((b * a) + y)) + (x + (t * a)); tmp = 0.0; if (z < -11820553527347888000.0) tmp = t_1; elseif (z < 4.7589743188364287e-122) tmp = (((b * z) + t) * a) + ((z * y) + x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z * N[(N[(b * a), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -11820553527347888000.0], t$95$1, If[Less[z, 4.7589743188364287e-122], N[(N[(N[(N[(b * z), $MachinePrecision] + t), $MachinePrecision] * a), $MachinePrecision] + N[(N[(z * y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\
\mathbf{if}\;z < -11820553527347888000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 4.7589743188364287 \cdot 10^{-122}:\\
\;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024238
(FPCore (x y z t a b)
:name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
:precision binary64
:alt
(! :herbie-platform default (if (< z -11820553527347888000) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 47589743188364287/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a))))))
(+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))