
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (fma z (cos y) (+ x (sin y))))
double code(double x, double y, double z) {
return fma(z, cos(y), (x + sin(y)));
}
function code(x, y, z) return fma(z, cos(y), Float64(x + sin(y))) end
code[x_, y_, z_] := N[(z * N[Cos[y], $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \cos y, x + \sin y\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
(FPCore (x y z) :precision binary64 (+ (* z (cos y)) (+ x (sin y))))
double code(double x, double y, double z) {
return (z * cos(y)) + (x + sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (z * cos(y)) + (x + sin(y))
end function
public static double code(double x, double y, double z) {
return (z * Math.cos(y)) + (x + Math.sin(y));
}
def code(x, y, z): return (z * math.cos(y)) + (x + math.sin(y))
function code(x, y, z) return Float64(Float64(z * cos(y)) + Float64(x + sin(y))) end
function tmp = code(x, y, z) tmp = (z * cos(y)) + (x + sin(y)); end
code[x_, y_, z_] := N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \cos y + \left(x + \sin y\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -98000000.0)
t_0
(if (<= z 8e-53) (+ x (sin y)) (if (<= z 1.4e+146) (+ z x) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -98000000.0) {
tmp = t_0;
} else if (z <= 8e-53) {
tmp = x + sin(y);
} else if (z <= 1.4e+146) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (z <= (-98000000.0d0)) then
tmp = t_0
else if (z <= 8d-53) then
tmp = x + sin(y)
else if (z <= 1.4d+146) then
tmp = z + x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (z <= -98000000.0) {
tmp = t_0;
} else if (z <= 8e-53) {
tmp = x + Math.sin(y);
} else if (z <= 1.4e+146) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -98000000.0: tmp = t_0 elif z <= 8e-53: tmp = x + math.sin(y) elif z <= 1.4e+146: tmp = z + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -98000000.0) tmp = t_0; elseif (z <= 8e-53) tmp = Float64(x + sin(y)); elseif (z <= 1.4e+146) tmp = Float64(z + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -98000000.0) tmp = t_0; elseif (z <= 8e-53) tmp = x + sin(y); elseif (z <= 1.4e+146) tmp = z + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -98000000.0], t$95$0, If[LessEqual[z, 8e-53], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e+146], N[(z + x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -98000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-53}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+146}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -9.8e7 or 1.4e146 < z Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 80.9%
if -9.8e7 < z < 8.00000000000000025e-53Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 97.7%
+-commutative97.7%
Simplified97.7%
if 8.00000000000000025e-53 < z < 1.4e146Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 90.5%
Final simplification90.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.0) (not (<= z 7.8e-53))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.0) || !(z <= 7.8e-53)) {
tmp = x + (z * cos(y));
} else {
tmp = x + sin(y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-5.0d0)) .or. (.not. (z <= 7.8d-53))) then
tmp = x + (z * cos(y))
else
tmp = x + sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.0) || !(z <= 7.8e-53)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.0) or not (z <= 7.8e-53): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.0) || !(z <= 7.8e-53)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.0) || ~((z <= 7.8e-53))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.0], N[Not[LessEqual[z, 7.8e-53]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \lor \neg \left(z \leq 7.8 \cdot 10^{-53}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -5 or 7.8000000000000004e-53 < z Initial program 99.9%
Taylor expanded in x around inf 99.1%
if -5 < z < 7.8000000000000004e-53Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 97.7%
+-commutative97.7%
Simplified97.7%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.7e+93) (not (<= z 6.9e+146))) (* z (cos y)) (+ z x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.7e+93) || !(z <= 6.9e+146)) {
tmp = z * cos(y);
} else {
tmp = z + x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-2.7d+93)) .or. (.not. (z <= 6.9d+146))) then
tmp = z * cos(y)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.7e+93) || !(z <= 6.9e+146)) {
tmp = z * Math.cos(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.7e+93) or not (z <= 6.9e+146): tmp = z * math.cos(y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.7e+93) || !(z <= 6.9e+146)) tmp = Float64(z * cos(y)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.7e+93) || ~((z <= 6.9e+146))) tmp = z * cos(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.7e+93], N[Not[LessEqual[z, 6.9e+146]], $MachinePrecision]], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+93} \lor \neg \left(z \leq 6.9 \cdot 10^{+146}\right):\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if z < -2.6999999999999999e93 or 6.89999999999999956e146 < z Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 87.7%
if -2.6999999999999999e93 < z < 6.89999999999999956e146Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 69.7%
Final simplification75.1%
(FPCore (x y z) :precision binary64 (if (<= x -2.1e-122) (+ z x) (if (<= x -3.3e-202) (sin y) (if (<= x 7.2e-39) (+ z (+ y x)) (+ z x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.1e-122) {
tmp = z + x;
} else if (x <= -3.3e-202) {
tmp = sin(y);
} else if (x <= 7.2e-39) {
tmp = z + (y + x);
} else {
tmp = z + x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-2.1d-122)) then
tmp = z + x
else if (x <= (-3.3d-202)) then
tmp = sin(y)
else if (x <= 7.2d-39) then
tmp = z + (y + x)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.1e-122) {
tmp = z + x;
} else if (x <= -3.3e-202) {
tmp = Math.sin(y);
} else if (x <= 7.2e-39) {
tmp = z + (y + x);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.1e-122: tmp = z + x elif x <= -3.3e-202: tmp = math.sin(y) elif x <= 7.2e-39: tmp = z + (y + x) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.1e-122) tmp = Float64(z + x); elseif (x <= -3.3e-202) tmp = sin(y); elseif (x <= 7.2e-39) tmp = Float64(z + Float64(y + x)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.1e-122) tmp = z + x; elseif (x <= -3.3e-202) tmp = sin(y); elseif (x <= 7.2e-39) tmp = z + (y + x); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.1e-122], N[(z + x), $MachinePrecision], If[LessEqual[x, -3.3e-202], N[Sin[y], $MachinePrecision], If[LessEqual[x, 7.2e-39], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-122}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq -3.3 \cdot 10^{-202}:\\
\;\;\;\;\sin y\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{-39}:\\
\;\;\;\;z + \left(y + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -2.09999999999999992e-122 or 7.2000000000000001e-39 < x Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 81.4%
if -2.09999999999999992e-122 < x < -3.29999999999999989e-202Initial program 99.7%
+-commutative99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in z around 0 54.4%
+-commutative54.4%
Simplified54.4%
Taylor expanded in x around 0 54.6%
if -3.29999999999999989e-202 < x < 7.2000000000000001e-39Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 60.2%
associate-+r+60.2%
+-commutative60.2%
Simplified60.2%
Final simplification73.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -32000000000.0) (not (<= y 3.3e-5))) (+ z x) (+ x (+ z (* y (+ 1.0 (* y (+ (* z -0.5) (* y -0.16666666666666666)))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -32000000000.0) || !(y <= 3.3e-5)) {
tmp = z + x;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-32000000000.0d0)) .or. (.not. (y <= 3.3d-5))) then
tmp = z + x
else
tmp = x + (z + (y * (1.0d0 + (y * ((z * (-0.5d0)) + (y * (-0.16666666666666666d0)))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -32000000000.0) || !(y <= 3.3e-5)) {
tmp = z + x;
} else {
tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666))))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -32000000000.0) or not (y <= 3.3e-5): tmp = z + x else: tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -32000000000.0) || !(y <= 3.3e-5)) tmp = Float64(z + x); else tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(z * -0.5) + Float64(y * -0.16666666666666666))))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -32000000000.0) || ~((y <= 3.3e-5))) tmp = z + x; else tmp = x + (z + (y * (1.0 + (y * ((z * -0.5) + (y * -0.16666666666666666)))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -32000000000.0], N[Not[LessEqual[y, 3.3e-5]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -32000000000 \lor \neg \left(y \leq 3.3 \cdot 10^{-5}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(z \cdot -0.5 + y \cdot -0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if y < -3.2e10 or 3.3000000000000003e-5 < y Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 42.9%
if -3.2e10 < y < 3.3000000000000003e-5Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 97.3%
Final simplification72.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.4e+61) (not (<= y 3.3e-5))) (+ z x) (+ (+ z x) (* y (+ 1.0 (* -0.5 (* z y)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.4e+61) || !(y <= 3.3e-5)) {
tmp = z + x;
} else {
tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y))));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-6.4d+61)) .or. (.not. (y <= 3.3d-5))) then
tmp = z + x
else
tmp = (z + x) + (y * (1.0d0 + ((-0.5d0) * (z * y))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6.4e+61) || !(y <= 3.3e-5)) {
tmp = z + x;
} else {
tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.4e+61) or not (y <= 3.3e-5): tmp = z + x else: tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.4e+61) || !(y <= 3.3e-5)) tmp = Float64(z + x); else tmp = Float64(Float64(z + x) + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(z * y))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6.4e+61) || ~((y <= 3.3e-5))) tmp = z + x; else tmp = (z + x) + (y * (1.0 + (-0.5 * (z * y)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.4e+61], N[Not[LessEqual[y, 3.3e-5]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(z + x), $MachinePrecision] + N[(y * N[(1.0 + N[(-0.5 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.4 \cdot 10^{+61} \lor \neg \left(y \leq 3.3 \cdot 10^{-5}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\left(z + x\right) + y \cdot \left(1 + -0.5 \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if y < -6.3999999999999997e61 or 3.3000000000000003e-5 < y Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 44.4%
if -6.3999999999999997e61 < y < 3.3000000000000003e-5Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 93.3%
associate-+r+93.3%
Simplified93.3%
Final simplification71.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -17000000.0) (not (<= y 1e-53))) (+ z x) (+ x (+ z (* y (+ 1.0 (* y (* y -0.16666666666666666))))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -17000000.0) || !(y <= 1e-53)) {
tmp = z + x;
} else {
tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666)))));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-17000000.0d0)) .or. (.not. (y <= 1d-53))) then
tmp = z + x
else
tmp = x + (z + (y * (1.0d0 + (y * (y * (-0.16666666666666666d0))))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -17000000.0) || !(y <= 1e-53)) {
tmp = z + x;
} else {
tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666)))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -17000000.0) or not (y <= 1e-53): tmp = z + x else: tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666))))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -17000000.0) || !(y <= 1e-53)) tmp = Float64(z + x); else tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(y * -0.16666666666666666)))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -17000000.0) || ~((y <= 1e-53))) tmp = z + x; else tmp = x + (z + (y * (1.0 + (y * (y * -0.16666666666666666))))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -17000000.0], N[Not[LessEqual[y, 1e-53]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -17000000 \lor \neg \left(y \leq 10^{-53}\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if y < -1.7e7 or 1.00000000000000003e-53 < y Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 44.0%
if -1.7e7 < y < 1.00000000000000003e-53Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 98.6%
Taylor expanded in z around 0 98.5%
*-commutative98.5%
Simplified98.5%
Final simplification71.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.15e+68) (not (<= y 4800000000.0))) (+ z x) (+ z (+ y x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.15e+68) || !(y <= 4800000000.0)) {
tmp = z + x;
} else {
tmp = z + (y + x);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-2.15d+68)) .or. (.not. (y <= 4800000000.0d0))) then
tmp = z + x
else
tmp = z + (y + x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.15e+68) || !(y <= 4800000000.0)) {
tmp = z + x;
} else {
tmp = z + (y + x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.15e+68) or not (y <= 4800000000.0): tmp = z + x else: tmp = z + (y + x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.15e+68) || !(y <= 4800000000.0)) tmp = Float64(z + x); else tmp = Float64(z + Float64(y + x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.15e+68) || ~((y <= 4800000000.0))) tmp = z + x; else tmp = z + (y + x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.15e+68], N[Not[LessEqual[y, 4800000000.0]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{+68} \lor \neg \left(y \leq 4800000000\right):\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;z + \left(y + x\right)\\
\end{array}
\end{array}
if y < -2.1500000000000001e68 or 4.8e9 < y Initial program 99.8%
+-commutative99.8%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 44.8%
if -2.1500000000000001e68 < y < 4.8e9Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 91.7%
associate-+r+91.7%
+-commutative91.7%
Simplified91.7%
Final simplification71.9%
(FPCore (x y z) :precision binary64 (if (<= x -2.6e-6) x (if (<= x 2.4e+18) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.6e-6) {
tmp = x;
} else if (x <= 2.4e+18) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-2.6d-6)) then
tmp = x
else if (x <= 2.4d+18) then
tmp = z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.6e-6) {
tmp = x;
} else if (x <= 2.4e+18) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.6e-6: tmp = x elif x <= 2.4e+18: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.6e-6) tmp = x; elseif (x <= 2.4e+18) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.6e-6) tmp = x; elseif (x <= 2.4e+18) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.6e-6], x, If[LessEqual[x, 2.4e+18], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-6}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+18}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.60000000000000009e-6 or 2.4e18 < x Initial program 100.0%
add-cbrt-cube99.9%
pow399.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 77.1%
if -2.60000000000000009e-6 < x < 2.4e18Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 51.2%
Taylor expanded in z around 0 51.5%
*-commutative51.5%
Simplified51.5%
Taylor expanded in z around inf 35.9%
(FPCore (x y z) :precision binary64 (+ z x))
double code(double x, double y, double z) {
return z + x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z + x
end function
public static double code(double x, double y, double z) {
return z + x;
}
def code(x, y, z): return z + x
function code(x, y, z) return Float64(z + x) end
function tmp = code(x, y, z) tmp = z + x; end
code[x_, y_, z_] := N[(z + x), $MachinePrecision]
\begin{array}{l}
\\
z + x
\end{array}
Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 66.2%
Final simplification66.2%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
add-cbrt-cube99.8%
pow399.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 44.2%
herbie shell --seed 2024186
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
:precision binary64
(+ (+ x (sin y)) (* z (cos y))))