
(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-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= x -2.1e+33) (+ z x) (if (<= x 1.85e-26) (+ (sin y) (* z (cos y))) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.1e+33) {
tmp = z + x;
} else if (x <= 1.85e-26) {
tmp = sin(y) + (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 (x <= (-2.1d+33)) then
tmp = z + x
else if (x <= 1.85d-26) then
tmp = sin(y) + (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 (x <= -2.1e+33) {
tmp = z + x;
} else if (x <= 1.85e-26) {
tmp = Math.sin(y) + (z * Math.cos(y));
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.1e+33: tmp = z + x elif x <= 1.85e-26: tmp = math.sin(y) + (z * math.cos(y)) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.1e+33) tmp = Float64(z + x); elseif (x <= 1.85e-26) tmp = Float64(sin(y) + Float64(z * cos(y))); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.1e+33) tmp = z + x; elseif (x <= 1.85e-26) tmp = sin(y) + (z * cos(y)); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.1e+33], N[(z + x), $MachinePrecision], If[LessEqual[x, 1.85e-26], N[(N[Sin[y], $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+33}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-26}:\\
\;\;\;\;\sin y + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -2.1000000000000001e33 or 1.8499999999999999e-26 < x Initial program 99.9%
Taylor expanded in y around 0 87.7%
if -2.1000000000000001e33 < x < 1.8499999999999999e-26Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in x around 0 93.8%
Final simplification90.8%
(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
(if (<= y -1.2e+15)
(+ z x)
(if (<= y 44000.0)
(+ y (+ (+ z x) (* (* y (* z y)) -0.5)))
(if (or (<= y 5.7e+32) (and (not (<= y 1.05e+70)) (<= y 4e+129)))
(sin y)
(+ z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.2e+15) {
tmp = z + x;
} else if (y <= 44000.0) {
tmp = y + ((z + x) + ((y * (z * y)) * -0.5));
} else if ((y <= 5.7e+32) || (!(y <= 1.05e+70) && (y <= 4e+129))) {
tmp = sin(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 (y <= (-1.2d+15)) then
tmp = z + x
else if (y <= 44000.0d0) then
tmp = y + ((z + x) + ((y * (z * y)) * (-0.5d0)))
else if ((y <= 5.7d+32) .or. (.not. (y <= 1.05d+70)) .and. (y <= 4d+129)) then
tmp = sin(y)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.2e+15) {
tmp = z + x;
} else if (y <= 44000.0) {
tmp = y + ((z + x) + ((y * (z * y)) * -0.5));
} else if ((y <= 5.7e+32) || (!(y <= 1.05e+70) && (y <= 4e+129))) {
tmp = Math.sin(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.2e+15: tmp = z + x elif y <= 44000.0: tmp = y + ((z + x) + ((y * (z * y)) * -0.5)) elif (y <= 5.7e+32) or (not (y <= 1.05e+70) and (y <= 4e+129)): tmp = math.sin(y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.2e+15) tmp = Float64(z + x); elseif (y <= 44000.0) tmp = Float64(y + Float64(Float64(z + x) + Float64(Float64(y * Float64(z * y)) * -0.5))); elseif ((y <= 5.7e+32) || (!(y <= 1.05e+70) && (y <= 4e+129))) tmp = sin(y); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.2e+15) tmp = z + x; elseif (y <= 44000.0) tmp = y + ((z + x) + ((y * (z * y)) * -0.5)); elseif ((y <= 5.7e+32) || (~((y <= 1.05e+70)) && (y <= 4e+129))) tmp = sin(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.2e+15], N[(z + x), $MachinePrecision], If[LessEqual[y, 44000.0], N[(y + N[(N[(z + x), $MachinePrecision] + N[(N[(y * N[(z * y), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 5.7e+32], And[N[Not[LessEqual[y, 1.05e+70]], $MachinePrecision], LessEqual[y, 4e+129]]], N[Sin[y], $MachinePrecision], N[(z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+15}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 44000:\\
\;\;\;\;y + \left(\left(z + x\right) + \left(y \cdot \left(z \cdot y\right)\right) \cdot -0.5\right)\\
\mathbf{elif}\;y \leq 5.7 \cdot 10^{+32} \lor \neg \left(y \leq 1.05 \cdot 10^{+70}\right) \land y \leq 4 \cdot 10^{+129}:\\
\;\;\;\;\sin y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -1.2e15 or 5.7e32 < y < 1.05000000000000004e70 or 4e129 < y Initial program 99.8%
Taylor expanded in y around 0 42.6%
if -1.2e15 < y < 44000Initial program 100.0%
Taylor expanded in y around 0 97.4%
fma-def97.4%
*-commutative97.4%
unpow297.4%
Simplified97.4%
fma-udef97.4%
+-commutative97.4%
associate-+r+97.4%
*-commutative97.4%
*-commutative97.4%
associate-*l*97.4%
Applied egg-rr97.4%
if 44000 < y < 5.7e32 or 1.05000000000000004e70 < y < 4e129Initial program 100.0%
Taylor expanded in z around 0 69.1%
Taylor expanded in x around 0 64.6%
Final simplification70.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -4e+90)
t_0
(if (<= z -1.1e+74)
(+ z x)
(if (or (<= z -390.0) (not (<= z 0.0095))) t_0 (+ x (sin y)))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -4e+90) {
tmp = t_0;
} else if (z <= -1.1e+74) {
tmp = z + x;
} else if ((z <= -390.0) || !(z <= 0.0095)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (z <= (-4d+90)) then
tmp = t_0
else if (z <= (-1.1d+74)) then
tmp = z + x
else if ((z <= (-390.0d0)) .or. (.not. (z <= 0.0095d0))) then
tmp = t_0
else
tmp = x + sin(y)
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 <= -4e+90) {
tmp = t_0;
} else if (z <= -1.1e+74) {
tmp = z + x;
} else if ((z <= -390.0) || !(z <= 0.0095)) {
tmp = t_0;
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -4e+90: tmp = t_0 elif z <= -1.1e+74: tmp = z + x elif (z <= -390.0) or not (z <= 0.0095): tmp = t_0 else: tmp = x + math.sin(y) return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -4e+90) tmp = t_0; elseif (z <= -1.1e+74) tmp = Float64(z + x); elseif ((z <= -390.0) || !(z <= 0.0095)) tmp = t_0; else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -4e+90) tmp = t_0; elseif (z <= -1.1e+74) tmp = z + x; elseif ((z <= -390.0) || ~((z <= 0.0095))) tmp = t_0; else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4e+90], t$95$0, If[LessEqual[z, -1.1e+74], N[(z + x), $MachinePrecision], If[Or[LessEqual[z, -390.0], N[Not[LessEqual[z, 0.0095]], $MachinePrecision]], t$95$0, N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -4 \cdot 10^{+90}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{+74}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq -390 \lor \neg \left(z \leq 0.0095\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -3.99999999999999987e90 or -1.1000000000000001e74 < z < -390 or 0.00949999999999999976 < z Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
add-cube-cbrt99.2%
associate-*l*99.2%
fma-def99.2%
pow299.2%
Applied egg-rr99.2%
Taylor expanded in z around inf 78.1%
*-commutative78.1%
pow-base-178.1%
*-lft-identity78.1%
Simplified78.1%
if -3.99999999999999987e90 < z < -1.1000000000000001e74Initial program 100.0%
Taylor expanded in y around 0 89.5%
if -390 < z < 0.00949999999999999976Initial program 100.0%
Taylor expanded in z around 0 90.1%
Final simplification84.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -9.2e+73)
(+ t_0 (+ y x))
(if (or (<= z -35.0) (not (<= z 0.0095))) t_0 (+ x (sin y))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -9.2e+73) {
tmp = t_0 + (y + x);
} else if ((z <= -35.0) || !(z <= 0.0095)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = z * cos(y)
if (z <= (-9.2d+73)) then
tmp = t_0 + (y + x)
else if ((z <= (-35.0d0)) .or. (.not. (z <= 0.0095d0))) then
tmp = t_0
else
tmp = x + sin(y)
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 <= -9.2e+73) {
tmp = t_0 + (y + x);
} else if ((z <= -35.0) || !(z <= 0.0095)) {
tmp = t_0;
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -9.2e+73: tmp = t_0 + (y + x) elif (z <= -35.0) or not (z <= 0.0095): tmp = t_0 else: tmp = x + math.sin(y) return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -9.2e+73) tmp = Float64(t_0 + Float64(y + x)); elseif ((z <= -35.0) || !(z <= 0.0095)) tmp = t_0; else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -9.2e+73) tmp = t_0 + (y + x); elseif ((z <= -35.0) || ~((z <= 0.0095))) tmp = t_0; else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.2e+73], N[(t$95$0 + N[(y + x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -35.0], N[Not[LessEqual[z, 0.0095]], $MachinePrecision]], t$95$0, N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -9.2 \cdot 10^{+73}:\\
\;\;\;\;t_0 + \left(y + x\right)\\
\mathbf{elif}\;z \leq -35 \lor \neg \left(z \leq 0.0095\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -9.199999999999999e73Initial program 99.9%
Taylor expanded in y around 0 84.2%
if -9.199999999999999e73 < z < -35 or 0.00949999999999999976 < z Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
add-cube-cbrt99.2%
associate-*l*99.2%
fma-def99.2%
pow299.2%
Applied egg-rr99.2%
Taylor expanded in z around inf 80.7%
*-commutative80.7%
pow-base-180.7%
*-lft-identity80.7%
Simplified80.7%
if -35 < z < 0.00949999999999999976Initial program 100.0%
Taylor expanded in z around 0 90.1%
Final simplification86.3%
(FPCore (x y z) :precision binary64 (if (<= x -2.3e+33) (+ z x) (if (<= x 3.2e-27) (* z (cos y)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.3e+33) {
tmp = z + x;
} else if (x <= 3.2e-27) {
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 (x <= (-2.3d+33)) then
tmp = z + x
else if (x <= 3.2d-27) 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 (x <= -2.3e+33) {
tmp = z + x;
} else if (x <= 3.2e-27) {
tmp = z * Math.cos(y);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.3e+33: tmp = z + x elif x <= 3.2e-27: tmp = z * math.cos(y) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.3e+33) tmp = Float64(z + x); elseif (x <= 3.2e-27) 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 (x <= -2.3e+33) tmp = z + x; elseif (x <= 3.2e-27) tmp = z * cos(y); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.3e+33], N[(z + x), $MachinePrecision], If[LessEqual[x, 3.2e-27], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+33}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-27}:\\
\;\;\;\;z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if x < -2.30000000000000011e33 or 3.19999999999999991e-27 < x Initial program 99.9%
Taylor expanded in y around 0 87.0%
if -2.30000000000000011e33 < x < 3.19999999999999991e-27Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.5%
associate-*l*99.4%
fma-def99.4%
pow299.4%
Applied egg-rr99.4%
Taylor expanded in z around inf 57.6%
*-commutative57.6%
pow-base-157.6%
*-lft-identity57.6%
Simplified57.6%
Final simplification72.0%
(FPCore (x y z)
:precision binary64
(if (<= y -1.9e+15)
(+ z x)
(if (<= y 25500000000000.0)
(+ y (+ (+ z x) (* (* y (* z y)) -0.5)))
(+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.9e+15) {
tmp = z + x;
} else if (y <= 25500000000000.0) {
tmp = y + ((z + x) + ((y * (z * y)) * -0.5));
} 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 (y <= (-1.9d+15)) then
tmp = z + x
else if (y <= 25500000000000.0d0) then
tmp = y + ((z + x) + ((y * (z * y)) * (-0.5d0)))
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.9e+15) {
tmp = z + x;
} else if (y <= 25500000000000.0) {
tmp = y + ((z + x) + ((y * (z * y)) * -0.5));
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.9e+15: tmp = z + x elif y <= 25500000000000.0: tmp = y + ((z + x) + ((y * (z * y)) * -0.5)) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.9e+15) tmp = Float64(z + x); elseif (y <= 25500000000000.0) tmp = Float64(y + Float64(Float64(z + x) + Float64(Float64(y * Float64(z * y)) * -0.5))); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.9e+15) tmp = z + x; elseif (y <= 25500000000000.0) tmp = y + ((z + x) + ((y * (z * y)) * -0.5)); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.9e+15], N[(z + x), $MachinePrecision], If[LessEqual[y, 25500000000000.0], N[(y + N[(N[(z + x), $MachinePrecision] + N[(N[(y * N[(z * y), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+15}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 25500000000000:\\
\;\;\;\;y + \left(\left(z + x\right) + \left(y \cdot \left(z \cdot y\right)\right) \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -1.9e15 or 2.55e13 < y Initial program 99.9%
Taylor expanded in y around 0 38.3%
if -1.9e15 < y < 2.55e13Initial program 100.0%
Taylor expanded in y around 0 95.9%
fma-def95.9%
*-commutative95.9%
unpow295.9%
Simplified95.9%
fma-udef95.9%
+-commutative95.9%
associate-+r+95.9%
*-commutative95.9%
*-commutative95.9%
associate-*l*95.9%
Applied egg-rr95.9%
Final simplification65.5%
(FPCore (x y z) :precision binary64 (if (<= y -9.4e+36) (+ z x) (if (<= y 9.4e+17) (+ y (+ z x)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.4e+36) {
tmp = z + x;
} else if (y <= 9.4e+17) {
tmp = y + (z + 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 (y <= (-9.4d+36)) then
tmp = z + x
else if (y <= 9.4d+17) then
tmp = y + (z + x)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -9.4e+36) {
tmp = z + x;
} else if (y <= 9.4e+17) {
tmp = y + (z + x);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.4e+36: tmp = z + x elif y <= 9.4e+17: tmp = y + (z + x) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.4e+36) tmp = Float64(z + x); elseif (y <= 9.4e+17) tmp = Float64(y + Float64(z + x)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.4e+36) tmp = z + x; elseif (y <= 9.4e+17) tmp = y + (z + x); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.4e+36], N[(z + x), $MachinePrecision], If[LessEqual[y, 9.4e+17], N[(y + N[(z + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.4 \cdot 10^{+36}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 9.4 \cdot 10^{+17}:\\
\;\;\;\;y + \left(z + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -9.39999999999999978e36 or 9.4e17 < y Initial program 99.9%
Taylor expanded in y around 0 38.6%
if -9.39999999999999978e36 < y < 9.4e17Initial program 100.0%
Taylor expanded in y around 0 91.5%
Final simplification65.5%
(FPCore (x y z) :precision binary64 (if (<= x -1.3e-8) x (if (<= x 1.3e+50) (+ z y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.3e-8) {
tmp = x;
} else if (x <= 1.3e+50) {
tmp = z + y;
} 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 <= (-1.3d-8)) then
tmp = x
else if (x <= 1.3d+50) then
tmp = z + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.3e-8) {
tmp = x;
} else if (x <= 1.3e+50) {
tmp = z + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.3e-8: tmp = x elif x <= 1.3e+50: tmp = z + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.3e-8) tmp = x; elseif (x <= 1.3e+50) tmp = Float64(z + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.3e-8) tmp = x; elseif (x <= 1.3e+50) tmp = z + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.3e-8], x, If[LessEqual[x, 1.3e+50], N[(z + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-8}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+50}:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.3000000000000001e-8 or 1.3000000000000001e50 < x Initial program 100.0%
Taylor expanded in x around inf 74.8%
if -1.3000000000000001e-8 < x < 1.3000000000000001e50Initial program 99.9%
Taylor expanded in x around 0 91.1%
*-commutative91.1%
fma-def91.1%
Simplified91.1%
Taylor expanded in y around 0 36.9%
Final simplification53.3%
(FPCore (x y z) :precision binary64 (if (<= x -3.3e-93) x (if (<= x 1.3e+50) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.3e-93) {
tmp = x;
} else if (x <= 1.3e+50) {
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 <= (-3.3d-93)) then
tmp = x
else if (x <= 1.3d+50) 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 <= -3.3e-93) {
tmp = x;
} else if (x <= 1.3e+50) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.3e-93: tmp = x elif x <= 1.3e+50: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.3e-93) tmp = x; elseif (x <= 1.3e+50) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.3e-93) tmp = x; elseif (x <= 1.3e+50) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.3e-93], x, If[LessEqual[x, 1.3e+50], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{-93}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+50}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.3000000000000001e-93 or 1.3000000000000001e50 < x Initial program 100.0%
Taylor expanded in x around inf 68.2%
if -3.3000000000000001e-93 < x < 1.3000000000000001e50Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
add-cube-cbrt99.5%
associate-*l*99.5%
fma-def99.5%
pow299.5%
Applied egg-rr99.5%
Taylor expanded in z around inf 59.2%
*-commutative59.2%
pow-base-159.2%
*-lft-identity59.2%
Simplified59.2%
Taylor expanded in y around 0 32.1%
Final simplification50.0%
(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%
Taylor expanded in y around 0 60.6%
Final simplification60.6%
(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%
Taylor expanded in x around inf 38.6%
Final simplification38.6%
herbie shell --seed 2023192
(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))))