
(FPCore (x y z t) :precision binary64 (+ (* (+ (* x y) z) y) t))
double code(double x, double y, double z, double t) {
return (((x * y) + z) * y) + t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * y) + z) * y) + t
end function
public static double code(double x, double y, double z, double t) {
return (((x * y) + z) * y) + t;
}
def code(x, y, z, t): return (((x * y) + z) * y) + t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * y) + z) * y) + t) end
function tmp = code(x, y, z, t) tmp = (((x * y) + z) * y) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y + z\right) \cdot y + t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* (+ (* x y) z) y) t))
double code(double x, double y, double z, double t) {
return (((x * y) + z) * y) + t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * y) + z) * y) + t
end function
public static double code(double x, double y, double z, double t) {
return (((x * y) + z) * y) + t;
}
def code(x, y, z, t): return (((x * y) + z) * y) + t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * y) + z) * y) + t) end
function tmp = code(x, y, z, t) tmp = (((x * y) + z) * y) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y + z\right) \cdot y + t
\end{array}
(FPCore (x y z t) :precision binary64 (fma (fma x y z) y t))
double code(double x, double y, double z, double t) {
return fma(fma(x, y, z), y, t);
}
function code(x, y, z, t) return fma(fma(x, y, z), y, t) end
code[x_, y_, z_, t_] := N[(N[(x * y + z), $MachinePrecision] * y + t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(x, y, z\right), y, t\right)
\end{array}
Initial program 99.9%
fma-def99.9%
fma-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (* x y))))
(if (<= y -4e+35)
t_1
(if (<= y -4000000.0)
(* y z)
(if (<= y -1.4e-14)
t_1
(if (<= y 2.3e-24)
t
(if (<= y 1.15e+28)
t_1
(if (<= y 6.6e+82) t (if (<= y 3.5e+103) (* y z) t_1)))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (x * y);
double tmp;
if (y <= -4e+35) {
tmp = t_1;
} else if (y <= -4000000.0) {
tmp = y * z;
} else if (y <= -1.4e-14) {
tmp = t_1;
} else if (y <= 2.3e-24) {
tmp = t;
} else if (y <= 1.15e+28) {
tmp = t_1;
} else if (y <= 6.6e+82) {
tmp = t;
} else if (y <= 3.5e+103) {
tmp = y * z;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (x * y)
if (y <= (-4d+35)) then
tmp = t_1
else if (y <= (-4000000.0d0)) then
tmp = y * z
else if (y <= (-1.4d-14)) then
tmp = t_1
else if (y <= 2.3d-24) then
tmp = t
else if (y <= 1.15d+28) then
tmp = t_1
else if (y <= 6.6d+82) then
tmp = t
else if (y <= 3.5d+103) then
tmp = y * z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (x * y);
double tmp;
if (y <= -4e+35) {
tmp = t_1;
} else if (y <= -4000000.0) {
tmp = y * z;
} else if (y <= -1.4e-14) {
tmp = t_1;
} else if (y <= 2.3e-24) {
tmp = t;
} else if (y <= 1.15e+28) {
tmp = t_1;
} else if (y <= 6.6e+82) {
tmp = t;
} else if (y <= 3.5e+103) {
tmp = y * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (x * y) tmp = 0 if y <= -4e+35: tmp = t_1 elif y <= -4000000.0: tmp = y * z elif y <= -1.4e-14: tmp = t_1 elif y <= 2.3e-24: tmp = t elif y <= 1.15e+28: tmp = t_1 elif y <= 6.6e+82: tmp = t elif y <= 3.5e+103: tmp = y * z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(x * y)) tmp = 0.0 if (y <= -4e+35) tmp = t_1; elseif (y <= -4000000.0) tmp = Float64(y * z); elseif (y <= -1.4e-14) tmp = t_1; elseif (y <= 2.3e-24) tmp = t; elseif (y <= 1.15e+28) tmp = t_1; elseif (y <= 6.6e+82) tmp = t; elseif (y <= 3.5e+103) tmp = Float64(y * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (x * y); tmp = 0.0; if (y <= -4e+35) tmp = t_1; elseif (y <= -4000000.0) tmp = y * z; elseif (y <= -1.4e-14) tmp = t_1; elseif (y <= 2.3e-24) tmp = t; elseif (y <= 1.15e+28) tmp = t_1; elseif (y <= 6.6e+82) tmp = t; elseif (y <= 3.5e+103) tmp = y * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4e+35], t$95$1, If[LessEqual[y, -4000000.0], N[(y * z), $MachinePrecision], If[LessEqual[y, -1.4e-14], t$95$1, If[LessEqual[y, 2.3e-24], t, If[LessEqual[y, 1.15e+28], t$95$1, If[LessEqual[y, 6.6e+82], t, If[LessEqual[y, 3.5e+103], N[(y * z), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(x \cdot y\right)\\
\mathbf{if}\;y \leq -4 \cdot 10^{+35}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -4000000:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-14}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{-24}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+28}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{+82}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+103}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -3.9999999999999999e35 or -4e6 < y < -1.4e-14 or 2.3000000000000001e-24 < y < 1.14999999999999992e28 or 3.5e103 < y Initial program 99.9%
Taylor expanded in x around 0 83.7%
associate-+r+83.7%
fma-def83.7%
unpow283.7%
associate-*r*96.1%
Simplified96.1%
Taylor expanded in y around inf 67.5%
unpow267.5%
associate-*r*72.9%
Simplified72.9%
if -3.9999999999999999e35 < y < -4e6 or 6.5999999999999997e82 < y < 3.5e103Initial program 100.0%
Taylor expanded in x around 0 100.0%
associate-+r+100.0%
fma-def100.0%
unpow2100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in z around inf 68.6%
if -1.4e-14 < y < 2.3000000000000001e-24 or 1.14999999999999992e28 < y < 6.5999999999999997e82Initial program 100.0%
Taylor expanded in y around 0 70.3%
Final simplification71.3%
(FPCore (x y z t)
:precision binary64
(if (or (<= y -7.2e+123)
(not (or (<= y -6.8e+64) (and (not (<= y -4e+37)) (<= y 2.4e+109)))))
(* y (* x y))
(+ t (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.2e+123) || !((y <= -6.8e+64) || (!(y <= -4e+37) && (y <= 2.4e+109)))) {
tmp = y * (x * y);
} else {
tmp = t + (y * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-7.2d+123)) .or. (.not. (y <= (-6.8d+64)) .or. (.not. (y <= (-4d+37))) .and. (y <= 2.4d+109))) then
tmp = y * (x * y)
else
tmp = t + (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.2e+123) || !((y <= -6.8e+64) || (!(y <= -4e+37) && (y <= 2.4e+109)))) {
tmp = y * (x * y);
} else {
tmp = t + (y * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.2e+123) or not ((y <= -6.8e+64) or (not (y <= -4e+37) and (y <= 2.4e+109))): tmp = y * (x * y) else: tmp = t + (y * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.2e+123) || !((y <= -6.8e+64) || (!(y <= -4e+37) && (y <= 2.4e+109)))) tmp = Float64(y * Float64(x * y)); else tmp = Float64(t + Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.2e+123) || ~(((y <= -6.8e+64) || (~((y <= -4e+37)) && (y <= 2.4e+109))))) tmp = y * (x * y); else tmp = t + (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.2e+123], N[Not[Or[LessEqual[y, -6.8e+64], And[N[Not[LessEqual[y, -4e+37]], $MachinePrecision], LessEqual[y, 2.4e+109]]]], $MachinePrecision]], N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision], N[(t + N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+123} \lor \neg \left(y \leq -6.8 \cdot 10^{+64} \lor \neg \left(y \leq -4 \cdot 10^{+37}\right) \land y \leq 2.4 \cdot 10^{+109}\right):\\
\;\;\;\;y \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot z\\
\end{array}
\end{array}
if y < -7.19999999999999996e123 or -6.8000000000000003e64 < y < -3.99999999999999982e37 or 2.39999999999999987e109 < y Initial program 99.9%
Taylor expanded in x around 0 77.6%
associate-+r+77.6%
fma-def77.6%
unpow277.6%
associate-*r*94.7%
Simplified94.7%
Taylor expanded in y around inf 76.1%
unpow276.1%
associate-*r*83.5%
Simplified83.5%
if -7.19999999999999996e123 < y < -6.8000000000000003e64 or -3.99999999999999982e37 < y < 2.39999999999999987e109Initial program 99.9%
Taylor expanded in x around 0 84.5%
Final simplification84.2%
(FPCore (x y z t)
:precision binary64
(if (<= z -2.05e+158)
(* y (+ z (* x y)))
(if (or (<= z -7.4e+63) (not (<= z 4.4e-18)))
(+ t (* y z))
(+ t (* y (* x y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.05e+158) {
tmp = y * (z + (x * y));
} else if ((z <= -7.4e+63) || !(z <= 4.4e-18)) {
tmp = t + (y * z);
} else {
tmp = t + (y * (x * y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-2.05d+158)) then
tmp = y * (z + (x * y))
else if ((z <= (-7.4d+63)) .or. (.not. (z <= 4.4d-18))) then
tmp = t + (y * z)
else
tmp = t + (y * (x * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.05e+158) {
tmp = y * (z + (x * y));
} else if ((z <= -7.4e+63) || !(z <= 4.4e-18)) {
tmp = t + (y * z);
} else {
tmp = t + (y * (x * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.05e+158: tmp = y * (z + (x * y)) elif (z <= -7.4e+63) or not (z <= 4.4e-18): tmp = t + (y * z) else: tmp = t + (y * (x * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.05e+158) tmp = Float64(y * Float64(z + Float64(x * y))); elseif ((z <= -7.4e+63) || !(z <= 4.4e-18)) tmp = Float64(t + Float64(y * z)); else tmp = Float64(t + Float64(y * Float64(x * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.05e+158) tmp = y * (z + (x * y)); elseif ((z <= -7.4e+63) || ~((z <= 4.4e-18))) tmp = t + (y * z); else tmp = t + (y * (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.05e+158], N[(y * N[(z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -7.4e+63], N[Not[LessEqual[z, 4.4e-18]], $MachinePrecision]], N[(t + N[(y * z), $MachinePrecision]), $MachinePrecision], N[(t + N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{+158}:\\
\;\;\;\;y \cdot \left(z + x \cdot y\right)\\
\mathbf{elif}\;z \leq -7.4 \cdot 10^{+63} \lor \neg \left(z \leq 4.4 \cdot 10^{-18}\right):\\
\;\;\;\;t + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot \left(x \cdot y\right)\\
\end{array}
\end{array}
if z < -2.05000000000000002e158Initial program 100.0%
Taylor expanded in t around 0 94.3%
if -2.05000000000000002e158 < z < -7.39999999999999937e63 or 4.3999999999999997e-18 < z Initial program 99.9%
Taylor expanded in x around 0 88.4%
if -7.39999999999999937e63 < z < 4.3999999999999997e-18Initial program 99.9%
Taylor expanded in x around inf 90.1%
unpow290.1%
associate-*r*96.6%
Simplified96.6%
Final simplification93.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ z (* x y)))))
(if (<= y -2.2e-11)
t_1
(if (<= y 4.6e-133)
(+ t (* y z))
(if (<= y 8.4e+74) (+ t (* x (* y y))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z + (x * y));
double tmp;
if (y <= -2.2e-11) {
tmp = t_1;
} else if (y <= 4.6e-133) {
tmp = t + (y * z);
} else if (y <= 8.4e+74) {
tmp = t + (x * (y * y));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (z + (x * y))
if (y <= (-2.2d-11)) then
tmp = t_1
else if (y <= 4.6d-133) then
tmp = t + (y * z)
else if (y <= 8.4d+74) then
tmp = t + (x * (y * y))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z + (x * y));
double tmp;
if (y <= -2.2e-11) {
tmp = t_1;
} else if (y <= 4.6e-133) {
tmp = t + (y * z);
} else if (y <= 8.4e+74) {
tmp = t + (x * (y * y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z + (x * y)) tmp = 0 if y <= -2.2e-11: tmp = t_1 elif y <= 4.6e-133: tmp = t + (y * z) elif y <= 8.4e+74: tmp = t + (x * (y * y)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z + Float64(x * y))) tmp = 0.0 if (y <= -2.2e-11) tmp = t_1; elseif (y <= 4.6e-133) tmp = Float64(t + Float64(y * z)); elseif (y <= 8.4e+74) tmp = Float64(t + Float64(x * Float64(y * y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z + (x * y)); tmp = 0.0; if (y <= -2.2e-11) tmp = t_1; elseif (y <= 4.6e-133) tmp = t + (y * z); elseif (y <= 8.4e+74) tmp = t + (x * (y * y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.2e-11], t$95$1, If[LessEqual[y, 4.6e-133], N[(t + N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.4e+74], N[(t + N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z + x \cdot y\right)\\
\mathbf{if}\;y \leq -2.2 \cdot 10^{-11}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{-133}:\\
\;\;\;\;t + y \cdot z\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{+74}:\\
\;\;\;\;t + x \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -2.2000000000000002e-11 or 8.3999999999999995e74 < y Initial program 99.9%
Taylor expanded in t around 0 90.9%
if -2.2000000000000002e-11 < y < 4.6000000000000001e-133Initial program 100.0%
Taylor expanded in x around 0 95.4%
if 4.6000000000000001e-133 < y < 8.3999999999999995e74Initial program 99.8%
Taylor expanded in x around inf 85.4%
unpow285.4%
associate-*r*85.3%
Simplified85.3%
flip-+47.3%
div-sub47.3%
pow247.3%
Applied egg-rr47.3%
div-sub47.3%
unpow247.3%
associate-*r*47.3%
*-commutative47.3%
associate-*r*47.3%
*-commutative47.3%
swap-sqr31.5%
unpow231.5%
unpow231.5%
pow-sqr31.5%
metadata-eval31.5%
Simplified31.5%
*-commutative31.5%
metadata-eval31.5%
metadata-eval31.5%
metadata-eval31.5%
pow-prod-up31.5%
pow-prod-down31.5%
metadata-eval31.5%
pow231.5%
swap-sqr47.3%
associate-*r*47.3%
associate-*r*47.3%
flip-+85.3%
Applied egg-rr85.4%
Final simplification91.6%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.05e+158)
(* y z)
(if (<= z -1.95e+90)
t
(if (and (not (<= z -8.5e+59)) (<= z 3e+217)) t (* y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05e+158) {
tmp = y * z;
} else if (z <= -1.95e+90) {
tmp = t;
} else if (!(z <= -8.5e+59) && (z <= 3e+217)) {
tmp = t;
} else {
tmp = y * z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.05d+158)) then
tmp = y * z
else if (z <= (-1.95d+90)) then
tmp = t
else if ((.not. (z <= (-8.5d+59))) .and. (z <= 3d+217)) then
tmp = t
else
tmp = y * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05e+158) {
tmp = y * z;
} else if (z <= -1.95e+90) {
tmp = t;
} else if (!(z <= -8.5e+59) && (z <= 3e+217)) {
tmp = t;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.05e+158: tmp = y * z elif z <= -1.95e+90: tmp = t elif not (z <= -8.5e+59) and (z <= 3e+217): tmp = t else: tmp = y * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.05e+158) tmp = Float64(y * z); elseif (z <= -1.95e+90) tmp = t; elseif (!(z <= -8.5e+59) && (z <= 3e+217)) tmp = t; else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.05e+158) tmp = y * z; elseif (z <= -1.95e+90) tmp = t; elseif (~((z <= -8.5e+59)) && (z <= 3e+217)) tmp = t; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.05e+158], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.95e+90], t, If[And[N[Not[LessEqual[z, -8.5e+59]], $MachinePrecision], LessEqual[z, 3e+217]], t, N[(y * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+158}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1.95 \cdot 10^{+90}:\\
\;\;\;\;t\\
\mathbf{elif}\;\neg \left(z \leq -8.5 \cdot 10^{+59}\right) \land z \leq 3 \cdot 10^{+217}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1.0499999999999999e158 or -1.9500000000000001e90 < z < -8.4999999999999999e59 or 2.99999999999999976e217 < z Initial program 99.9%
Taylor expanded in x around 0 87.8%
associate-+r+87.8%
fma-def87.8%
unpow287.8%
associate-*r*92.9%
Simplified92.9%
Taylor expanded in z around inf 76.6%
if -1.0499999999999999e158 < z < -1.9500000000000001e90 or -8.4999999999999999e59 < z < 2.99999999999999976e217Initial program 99.9%
Taylor expanded in y around 0 52.5%
Final simplification57.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.8e-11) (not (<= y 4.8e-24))) (* y (+ z (* x y))) (+ t (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.8e-11) || !(y <= 4.8e-24)) {
tmp = y * (z + (x * y));
} else {
tmp = t + (y * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-3.8d-11)) .or. (.not. (y <= 4.8d-24))) then
tmp = y * (z + (x * y))
else
tmp = t + (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.8e-11) || !(y <= 4.8e-24)) {
tmp = y * (z + (x * y));
} else {
tmp = t + (y * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.8e-11) or not (y <= 4.8e-24): tmp = y * (z + (x * y)) else: tmp = t + (y * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.8e-11) || !(y <= 4.8e-24)) tmp = Float64(y * Float64(z + Float64(x * y))); else tmp = Float64(t + Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.8e-11) || ~((y <= 4.8e-24))) tmp = y * (z + (x * y)); else tmp = t + (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.8e-11], N[Not[LessEqual[y, 4.8e-24]], $MachinePrecision]], N[(y * N[(z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{-11} \lor \neg \left(y \leq 4.8 \cdot 10^{-24}\right):\\
\;\;\;\;y \cdot \left(z + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot z\\
\end{array}
\end{array}
if y < -3.7999999999999998e-11 or 4.7999999999999996e-24 < y Initial program 99.9%
Taylor expanded in t around 0 85.7%
if -3.7999999999999998e-11 < y < 4.7999999999999996e-24Initial program 100.0%
Taylor expanded in x around 0 91.9%
Final simplification88.8%
(FPCore (x y z t) :precision binary64 (+ t (* y (+ z (* x y)))))
double code(double x, double y, double z, double t) {
return t + (y * (z + (x * y)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t + (y * (z + (x * y)))
end function
public static double code(double x, double y, double z, double t) {
return t + (y * (z + (x * y)));
}
def code(x, y, z, t): return t + (y * (z + (x * y)))
function code(x, y, z, t) return Float64(t + Float64(y * Float64(z + Float64(x * y)))) end
function tmp = code(x, y, z, t) tmp = t + (y * (z + (x * y))); end
code[x_, y_, z_, t_] := N[(t + N[(y * N[(z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + y \cdot \left(z + x \cdot y\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 43.4%
Final simplification43.4%
herbie shell --seed 2023230
(FPCore (x y z t)
:name "Language.Haskell.HsColour.ColourHighlight:unbase from hscolour-1.23"
:precision binary64
(+ (* (+ (* x y) z) y) t))