
(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-define99.9%
fma-define99.9%
Simplified99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (* x y))))
(if (<= y -1.25e+61)
t_1
(if (<= y -1.05e-105)
(* y z)
(if (<= y 4.5) t (if (<= y 4.6e+37) (* y z) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (x * y);
double tmp;
if (y <= -1.25e+61) {
tmp = t_1;
} else if (y <= -1.05e-105) {
tmp = y * z;
} else if (y <= 4.5) {
tmp = t;
} else if (y <= 4.6e+37) {
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 <= (-1.25d+61)) then
tmp = t_1
else if (y <= (-1.05d-105)) then
tmp = y * z
else if (y <= 4.5d0) then
tmp = t
else if (y <= 4.6d+37) 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 <= -1.25e+61) {
tmp = t_1;
} else if (y <= -1.05e-105) {
tmp = y * z;
} else if (y <= 4.5) {
tmp = t;
} else if (y <= 4.6e+37) {
tmp = y * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (x * y) tmp = 0 if y <= -1.25e+61: tmp = t_1 elif y <= -1.05e-105: tmp = y * z elif y <= 4.5: tmp = t elif y <= 4.6e+37: 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 <= -1.25e+61) tmp = t_1; elseif (y <= -1.05e-105) tmp = Float64(y * z); elseif (y <= 4.5) tmp = t; elseif (y <= 4.6e+37) 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 <= -1.25e+61) tmp = t_1; elseif (y <= -1.05e-105) tmp = y * z; elseif (y <= 4.5) tmp = t; elseif (y <= 4.6e+37) 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, -1.25e+61], t$95$1, If[LessEqual[y, -1.05e-105], N[(y * z), $MachinePrecision], If[LessEqual[y, 4.5], t, If[LessEqual[y, 4.6e+37], 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 -1.25 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{-105}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;y \leq 4.5:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+37}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.25000000000000004e61 or 4.60000000000000005e37 < y Initial program 99.9%
Taylor expanded in z around -inf 97.4%
mul-1-neg97.4%
*-commutative97.4%
distribute-rgt-neg-in97.4%
fma-neg97.4%
*-commutative97.4%
associate-/l*97.4%
metadata-eval97.4%
Simplified97.4%
Taylor expanded in t around 0 87.6%
mul-1-neg87.6%
*-commutative87.6%
fma-neg87.6%
*-commutative87.6%
associate-*r/87.6%
metadata-eval87.6%
associate-*r*84.2%
distribute-rgt-neg-in84.2%
*-commutative84.2%
distribute-lft-neg-in84.2%
fma-undefine84.2%
neg-mul-184.2%
distribute-rgt-neg-in84.2%
fma-define84.2%
distribute-neg-frac284.2%
Simplified84.2%
Taylor expanded in y around 0 89.3%
Taylor expanded in z around 0 73.0%
*-commutative73.0%
Simplified73.0%
if -1.25000000000000004e61 < y < -1.05e-105 or 4.5 < y < 4.60000000000000005e37Initial program 99.9%
Taylor expanded in z around -inf 97.6%
mul-1-neg97.6%
*-commutative97.6%
distribute-rgt-neg-in97.6%
fma-neg97.6%
*-commutative97.6%
associate-/l*95.3%
metadata-eval95.3%
Simplified95.3%
Taylor expanded in t around 0 77.3%
mul-1-neg77.3%
*-commutative77.3%
fma-neg77.3%
*-commutative77.3%
associate-*r/75.0%
metadata-eval75.0%
associate-*r*75.0%
distribute-rgt-neg-in75.0%
*-commutative75.0%
distribute-lft-neg-in75.0%
fma-undefine75.0%
neg-mul-175.0%
distribute-rgt-neg-in75.0%
fma-define75.0%
distribute-neg-frac275.0%
Simplified75.0%
Taylor expanded in y around 0 58.0%
if -1.05e-105 < y < 4.5Initial program 99.9%
Taylor expanded in y around 0 70.8%
Final simplification69.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ z (* x y)))))
(if (<= y -1.3e+114)
t_1
(if (<= y -5.3e+62)
(+ t (* x (* y y)))
(if (<= y 9.5) (+ t (* y z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z + (x * y));
double tmp;
if (y <= -1.3e+114) {
tmp = t_1;
} else if (y <= -5.3e+62) {
tmp = t + (x * (y * y));
} else if (y <= 9.5) {
tmp = t + (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 * (z + (x * y))
if (y <= (-1.3d+114)) then
tmp = t_1
else if (y <= (-5.3d+62)) then
tmp = t + (x * (y * y))
else if (y <= 9.5d0) then
tmp = t + (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 * (z + (x * y));
double tmp;
if (y <= -1.3e+114) {
tmp = t_1;
} else if (y <= -5.3e+62) {
tmp = t + (x * (y * y));
} else if (y <= 9.5) {
tmp = t + (y * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z + (x * y)) tmp = 0 if y <= -1.3e+114: tmp = t_1 elif y <= -5.3e+62: tmp = t + (x * (y * y)) elif y <= 9.5: tmp = t + (y * z) 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 <= -1.3e+114) tmp = t_1; elseif (y <= -5.3e+62) tmp = Float64(t + Float64(x * Float64(y * y))); elseif (y <= 9.5) tmp = Float64(t + Float64(y * z)); 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 <= -1.3e+114) tmp = t_1; elseif (y <= -5.3e+62) tmp = t + (x * (y * y)); elseif (y <= 9.5) tmp = t + (y * z); 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, -1.3e+114], t$95$1, If[LessEqual[y, -5.3e+62], N[(t + N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5], N[(t + N[(y * z), $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 -1.3 \cdot 10^{+114}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -5.3 \cdot 10^{+62}:\\
\;\;\;\;t + x \cdot \left(y \cdot y\right)\\
\mathbf{elif}\;y \leq 9.5:\\
\;\;\;\;t + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.3e114 or 9.5 < y Initial program 99.9%
Taylor expanded in z around -inf 98.1%
mul-1-neg98.1%
*-commutative98.1%
distribute-rgt-neg-in98.1%
fma-neg98.1%
*-commutative98.1%
associate-/l*98.1%
metadata-eval98.1%
Simplified98.1%
Taylor expanded in t around 0 95.1%
mul-1-neg95.1%
*-commutative95.1%
fma-neg95.1%
*-commutative95.1%
associate-*r/95.1%
metadata-eval95.1%
associate-*r*91.4%
distribute-rgt-neg-in91.4%
*-commutative91.4%
distribute-lft-neg-in91.4%
fma-undefine91.4%
neg-mul-191.4%
distribute-rgt-neg-in91.4%
fma-define91.4%
distribute-neg-frac291.4%
Simplified91.4%
Taylor expanded in y around 0 96.1%
if -1.3e114 < y < -5.3000000000000003e62Initial program 99.8%
Taylor expanded in x around inf 87.9%
+-commutative87.9%
unpow287.9%
associate-/l*94.1%
distribute-lft-out94.1%
Simplified94.1%
Taylor expanded in y around inf 88.7%
if -5.3000000000000003e62 < y < 9.5Initial program 99.9%
Taylor expanded in x around 0 86.9%
Final simplification90.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.8e+65) (not (<= y 220.0))) (* y (+ z (* x y))) (+ t (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.8e+65) || !(y <= 220.0)) {
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 <= (-1.8d+65)) .or. (.not. (y <= 220.0d0))) 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 <= -1.8e+65) || !(y <= 220.0)) {
tmp = y * (z + (x * y));
} else {
tmp = t + (y * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.8e+65) or not (y <= 220.0): tmp = y * (z + (x * y)) else: tmp = t + (y * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.8e+65) || !(y <= 220.0)) 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 <= -1.8e+65) || ~((y <= 220.0))) tmp = y * (z + (x * y)); else tmp = t + (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.8e+65], N[Not[LessEqual[y, 220.0]], $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 -1.8 \cdot 10^{+65} \lor \neg \left(y \leq 220\right):\\
\;\;\;\;y \cdot \left(z + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot z\\
\end{array}
\end{array}
if y < -1.79999999999999989e65 or 220 < y Initial program 99.9%
Taylor expanded in z around -inf 98.3%
mul-1-neg98.3%
*-commutative98.3%
distribute-rgt-neg-in98.3%
fma-neg98.3%
*-commutative98.3%
associate-/l*98.3%
metadata-eval98.3%
Simplified98.3%
Taylor expanded in t around 0 90.6%
mul-1-neg90.6%
*-commutative90.6%
fma-neg90.6%
*-commutative90.6%
associate-*r/90.6%
metadata-eval90.6%
associate-*r*87.4%
distribute-rgt-neg-in87.4%
*-commutative87.4%
distribute-lft-neg-in87.4%
fma-undefine87.4%
neg-mul-187.4%
distribute-rgt-neg-in87.4%
fma-define87.4%
distribute-neg-frac287.4%
Simplified87.4%
Taylor expanded in y around 0 91.5%
if -1.79999999999999989e65 < y < 220Initial program 99.9%
Taylor expanded in x around 0 86.4%
Final simplification88.6%
(FPCore (x y z t) :precision binary64 (if (<= z -1.45e+115) (+ t (* y z)) (if (<= z 7.4e+107) (+ t (* y (* x y))) (* y (+ z (* x y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e+115) {
tmp = t + (y * z);
} else if (z <= 7.4e+107) {
tmp = t + (y * (x * y));
} else {
tmp = y * (z + (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 <= (-1.45d+115)) then
tmp = t + (y * z)
else if (z <= 7.4d+107) then
tmp = t + (y * (x * y))
else
tmp = y * (z + (x * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e+115) {
tmp = t + (y * z);
} else if (z <= 7.4e+107) {
tmp = t + (y * (x * y));
} else {
tmp = y * (z + (x * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.45e+115: tmp = t + (y * z) elif z <= 7.4e+107: tmp = t + (y * (x * y)) else: tmp = y * (z + (x * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.45e+115) tmp = Float64(t + Float64(y * z)); elseif (z <= 7.4e+107) tmp = Float64(t + Float64(y * Float64(x * y))); else tmp = Float64(y * Float64(z + Float64(x * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.45e+115) tmp = t + (y * z); elseif (z <= 7.4e+107) tmp = t + (y * (x * y)); else tmp = y * (z + (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.45e+115], N[(t + N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.4e+107], N[(t + N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+115}:\\
\;\;\;\;t + y \cdot z\\
\mathbf{elif}\;z \leq 7.4 \cdot 10^{+107}:\\
\;\;\;\;t + y \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + x \cdot y\right)\\
\end{array}
\end{array}
if z < -1.45000000000000002e115Initial program 100.0%
Taylor expanded in x around 0 89.6%
if -1.45000000000000002e115 < z < 7.4e107Initial program 99.9%
Taylor expanded in x around inf 91.9%
*-commutative91.9%
Simplified91.9%
if 7.4e107 < z Initial program 100.0%
Taylor expanded in z around -inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-neg100.0%
*-commutative100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t around 0 84.3%
mul-1-neg84.3%
*-commutative84.3%
fma-neg84.3%
*-commutative84.3%
associate-*r/84.3%
metadata-eval84.3%
associate-*r*84.3%
distribute-rgt-neg-in84.3%
*-commutative84.3%
distribute-lft-neg-in84.3%
fma-undefine84.3%
neg-mul-184.3%
distribute-rgt-neg-in84.3%
fma-define84.3%
distribute-neg-frac284.3%
Simplified84.3%
Taylor expanded in y around 0 84.3%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5.3e+75) (not (<= y 9e+37))) (* y (* x y)) (+ t (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.3e+75) || !(y <= 9e+37)) {
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 <= (-5.3d+75)) .or. (.not. (y <= 9d+37))) 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 <= -5.3e+75) || !(y <= 9e+37)) {
tmp = y * (x * y);
} else {
tmp = t + (y * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5.3e+75) or not (y <= 9e+37): tmp = y * (x * y) else: tmp = t + (y * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -5.3e+75) || !(y <= 9e+37)) 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 <= -5.3e+75) || ~((y <= 9e+37))) tmp = y * (x * y); else tmp = t + (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5.3e+75], N[Not[LessEqual[y, 9e+37]], $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 -5.3 \cdot 10^{+75} \lor \neg \left(y \leq 9 \cdot 10^{+37}\right):\\
\;\;\;\;y \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t + y \cdot z\\
\end{array}
\end{array}
if y < -5.2999999999999998e75 or 8.99999999999999923e37 < y Initial program 99.9%
Taylor expanded in z around -inf 98.1%
mul-1-neg98.1%
*-commutative98.1%
distribute-rgt-neg-in98.1%
fma-neg98.1%
*-commutative98.1%
associate-/l*98.1%
metadata-eval98.1%
Simplified98.1%
Taylor expanded in t around 0 90.6%
mul-1-neg90.6%
*-commutative90.6%
fma-neg90.6%
*-commutative90.6%
associate-*r/90.6%
metadata-eval90.6%
associate-*r*87.0%
distribute-rgt-neg-in87.0%
*-commutative87.0%
distribute-lft-neg-in87.0%
fma-undefine87.0%
neg-mul-187.0%
distribute-rgt-neg-in87.0%
fma-define87.0%
distribute-neg-frac287.0%
Simplified87.0%
Taylor expanded in y around 0 91.5%
Taylor expanded in z around 0 75.2%
*-commutative75.2%
Simplified75.2%
if -5.2999999999999998e75 < y < 8.99999999999999923e37Initial program 99.9%
Taylor expanded in x around 0 86.1%
Final simplification81.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.4e+90) (not (<= z 6.5e+58))) (* y z) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.4e+90) || !(z <= 6.5e+58)) {
tmp = y * z;
} else {
tmp = t;
}
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 <= (-3.4d+90)) .or. (.not. (z <= 6.5d+58))) then
tmp = y * z
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.4e+90) || !(z <= 6.5e+58)) {
tmp = y * z;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.4e+90) or not (z <= 6.5e+58): tmp = y * z else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.4e+90) || !(z <= 6.5e+58)) tmp = Float64(y * z); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.4e+90) || ~((z <= 6.5e+58))) tmp = y * z; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.4e+90], N[Not[LessEqual[z, 6.5e+58]], $MachinePrecision]], N[(y * z), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+90} \lor \neg \left(z \leq 6.5 \cdot 10^{+58}\right):\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -3.40000000000000018e90 or 6.49999999999999998e58 < z Initial program 100.0%
Taylor expanded in z around -inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-neg100.0%
*-commutative100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t around 0 81.6%
mul-1-neg81.6%
*-commutative81.6%
fma-neg81.6%
*-commutative81.6%
associate-*r/81.6%
metadata-eval81.6%
associate-*r*81.6%
distribute-rgt-neg-in81.6%
*-commutative81.6%
distribute-lft-neg-in81.6%
fma-undefine81.6%
neg-mul-181.6%
distribute-rgt-neg-in81.6%
fma-define81.6%
distribute-neg-frac281.6%
Simplified81.6%
Taylor expanded in y around 0 65.3%
if -3.40000000000000018e90 < z < 6.49999999999999998e58Initial program 99.9%
Taylor expanded in y around 0 49.2%
Final simplification55.3%
(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 38.2%
herbie shell --seed 2024106
(FPCore (x y z t)
:name "Language.Haskell.HsColour.ColourHighlight:unbase from hscolour-1.23"
:precision binary64
(+ (* (+ (* x y) z) y) t))