
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * 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 = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * 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 = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (+ (cos y) (- x (* z (sin y)))))
double code(double x, double y, double z) {
return cos(y) + (x - (z * 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 = cos(y) + (x - (z * sin(y)))
end function
public static double code(double x, double y, double z) {
return Math.cos(y) + (x - (z * Math.sin(y)));
}
def code(x, y, z): return math.cos(y) + (x - (z * math.sin(y)))
function code(x, y, z) return Float64(cos(y) + Float64(x - Float64(z * sin(y)))) end
function tmp = code(x, y, z) tmp = cos(y) + (x - (z * sin(y))); end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] + N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos y + \left(x - z \cdot \sin y\right)
\end{array}
Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 99.9%
neg-mul-199.9%
sub-neg99.9%
Simplified99.9%
(FPCore (x y z)
:precision binary64
(if (<= x -32000000.0)
(+ 1.0 (* x (- 1.0 (* (sin y) (/ z x)))))
(if (<= x 1.15e-10)
(- (cos y) (* z (sin y)))
(+ 1.0 (* x (- 1.0 (* z (/ (sin y) x))))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -32000000.0) {
tmp = 1.0 + (x * (1.0 - (sin(y) * (z / x))));
} else if (x <= 1.15e-10) {
tmp = cos(y) - (z * sin(y));
} else {
tmp = 1.0 + (x * (1.0 - (z * (sin(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 (x <= (-32000000.0d0)) then
tmp = 1.0d0 + (x * (1.0d0 - (sin(y) * (z / x))))
else if (x <= 1.15d-10) then
tmp = cos(y) - (z * sin(y))
else
tmp = 1.0d0 + (x * (1.0d0 - (z * (sin(y) / x))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -32000000.0) {
tmp = 1.0 + (x * (1.0 - (Math.sin(y) * (z / x))));
} else if (x <= 1.15e-10) {
tmp = Math.cos(y) - (z * Math.sin(y));
} else {
tmp = 1.0 + (x * (1.0 - (z * (Math.sin(y) / x))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -32000000.0: tmp = 1.0 + (x * (1.0 - (math.sin(y) * (z / x)))) elif x <= 1.15e-10: tmp = math.cos(y) - (z * math.sin(y)) else: tmp = 1.0 + (x * (1.0 - (z * (math.sin(y) / x)))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -32000000.0) tmp = Float64(1.0 + Float64(x * Float64(1.0 - Float64(sin(y) * Float64(z / x))))); elseif (x <= 1.15e-10) tmp = Float64(cos(y) - Float64(z * sin(y))); else tmp = Float64(1.0 + Float64(x * Float64(1.0 - Float64(z * Float64(sin(y) / x))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -32000000.0) tmp = 1.0 + (x * (1.0 - (sin(y) * (z / x)))); elseif (x <= 1.15e-10) tmp = cos(y) - (z * sin(y)); else tmp = 1.0 + (x * (1.0 - (z * (sin(y) / x)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -32000000.0], N[(1.0 + N[(x * N[(1.0 - N[(N[Sin[y], $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.15e-10], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(1.0 - N[(z * N[(N[Sin[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -32000000:\\
\;\;\;\;1 + x \cdot \left(1 - \sin y \cdot \frac{z}{x}\right)\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-10}:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(1 - z \cdot \frac{\sin y}{x}\right)\\
\end{array}
\end{array}
if x < -3.2e7Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
sin-neg100.0%
fma-define100.0%
sin-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 99.4%
if -3.2e7 < x < 1.15000000000000004e-10Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in x around 0 99.5%
neg-mul-199.5%
sub-neg99.5%
Simplified99.5%
if 1.15000000000000004e-10 < x Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in x around inf 99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) (- z)))
(t_1 (+ 1.0 (* x (- 1.0 (* z (/ (sin y) x)))))))
(if (<= z -6.4e+202)
t_0
(if (<= z -28000000000000.0)
t_1
(if (<= z 1.85) (+ (cos y) x) (if (<= z 7.3e+248) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = sin(y) * -z;
double t_1 = 1.0 + (x * (1.0 - (z * (sin(y) / x))));
double tmp;
if (z <= -6.4e+202) {
tmp = t_0;
} else if (z <= -28000000000000.0) {
tmp = t_1;
} else if (z <= 1.85) {
tmp = cos(y) + x;
} else if (z <= 7.3e+248) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = sin(y) * -z
t_1 = 1.0d0 + (x * (1.0d0 - (z * (sin(y) / x))))
if (z <= (-6.4d+202)) then
tmp = t_0
else if (z <= (-28000000000000.0d0)) then
tmp = t_1
else if (z <= 1.85d0) then
tmp = cos(y) + x
else if (z <= 7.3d+248) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) * -z;
double t_1 = 1.0 + (x * (1.0 - (z * (Math.sin(y) / x))));
double tmp;
if (z <= -6.4e+202) {
tmp = t_0;
} else if (z <= -28000000000000.0) {
tmp = t_1;
} else if (z <= 1.85) {
tmp = Math.cos(y) + x;
} else if (z <= 7.3e+248) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * -z t_1 = 1.0 + (x * (1.0 - (z * (math.sin(y) / x)))) tmp = 0 if z <= -6.4e+202: tmp = t_0 elif z <= -28000000000000.0: tmp = t_1 elif z <= 1.85: tmp = math.cos(y) + x elif z <= 7.3e+248: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(sin(y) * Float64(-z)) t_1 = Float64(1.0 + Float64(x * Float64(1.0 - Float64(z * Float64(sin(y) / x))))) tmp = 0.0 if (z <= -6.4e+202) tmp = t_0; elseif (z <= -28000000000000.0) tmp = t_1; elseif (z <= 1.85) tmp = Float64(cos(y) + x); elseif (z <= 7.3e+248) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * -z; t_1 = 1.0 + (x * (1.0 - (z * (sin(y) / x)))); tmp = 0.0; if (z <= -6.4e+202) tmp = t_0; elseif (z <= -28000000000000.0) tmp = t_1; elseif (z <= 1.85) tmp = cos(y) + x; elseif (z <= 7.3e+248) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(x * N[(1.0 - N[(z * N[(N[Sin[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.4e+202], t$95$0, If[LessEqual[z, -28000000000000.0], t$95$1, If[LessEqual[z, 1.85], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 7.3e+248], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot \left(-z\right)\\
t_1 := 1 + x \cdot \left(1 - z \cdot \frac{\sin y}{x}\right)\\
\mathbf{if}\;z \leq -6.4 \cdot 10^{+202}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -28000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.85:\\
\;\;\;\;\cos y + x\\
\mathbf{elif}\;z \leq 7.3 \cdot 10^{+248}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.40000000000000024e202 or 7.2999999999999998e248 < z Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-define99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in z around inf 91.5%
neg-mul-191.5%
*-commutative91.5%
distribute-rgt-neg-in91.5%
Simplified91.5%
if -6.40000000000000024e202 < z < -2.8e13 or 1.8500000000000001 < z < 7.2999999999999998e248Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in x around inf 89.4%
mul-1-neg89.4%
unsub-neg89.4%
*-commutative89.4%
associate-/l*80.8%
Simplified80.8%
Taylor expanded in y around inf 89.4%
associate-/l*89.3%
Simplified89.3%
Taylor expanded in y around 0 88.6%
if -2.8e13 < z < 1.8500000000000001Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
sin-neg100.0%
fma-define100.0%
sin-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 97.8%
Final simplification93.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.8e+120) (not (<= z 6.5e+111))) (* (sin y) (- z)) (+ (cos y) x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.8e+120) || !(z <= 6.5e+111)) {
tmp = sin(y) * -z;
} else {
tmp = cos(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 ((z <= (-1.8d+120)) .or. (.not. (z <= 6.5d+111))) then
tmp = sin(y) * -z
else
tmp = cos(y) + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.8e+120) || !(z <= 6.5e+111)) {
tmp = Math.sin(y) * -z;
} else {
tmp = Math.cos(y) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.8e+120) or not (z <= 6.5e+111): tmp = math.sin(y) * -z else: tmp = math.cos(y) + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.8e+120) || !(z <= 6.5e+111)) tmp = Float64(sin(y) * Float64(-z)); else tmp = Float64(cos(y) + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.8e+120) || ~((z <= 6.5e+111))) tmp = sin(y) * -z; else tmp = cos(y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.8e+120], N[Not[LessEqual[z, 6.5e+111]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+120} \lor \neg \left(z \leq 6.5 \cdot 10^{+111}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y + x\\
\end{array}
\end{array}
if z < -1.80000000000000008e120 or 6.5000000000000002e111 < z Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-define99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in z around inf 73.8%
neg-mul-173.8%
*-commutative73.8%
distribute-rgt-neg-in73.8%
Simplified73.8%
if -1.80000000000000008e120 < z < 6.5000000000000002e111Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
sin-neg100.0%
fma-define100.0%
sin-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 91.5%
Final simplification85.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.0064) (not (<= y 0.25))) (+ (cos y) x) (+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.0064) || !(y <= 0.25)) {
tmp = cos(y) + x;
} else {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
}
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 <= (-0.0064d0)) .or. (.not. (y <= 0.25d0))) then
tmp = cos(y) + x
else
tmp = 1.0d0 + (x + (y * ((y * ((0.16666666666666666d0 * (y * z)) - 0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.0064) || !(y <= 0.25)) {
tmp = Math.cos(y) + x;
} else {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.0064) or not (y <= 0.25): tmp = math.cos(y) + x else: tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.0064) || !(y <= 0.25)) tmp = Float64(cos(y) + x); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(0.16666666666666666 * Float64(y * z)) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.0064) || ~((y <= 0.25))) tmp = cos(y) + x; else tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.0064], N[Not[LessEqual[y, 0.25]], $MachinePrecision]], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0064 \lor \neg \left(y \leq 0.25\right):\\
\;\;\;\;\cos y + x\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right) - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -0.00640000000000000031 or 0.25 < y Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 58.4%
if -0.00640000000000000031 < y < 0.25Initial program 100.0%
Taylor expanded in y around 0 99.5%
Final simplification79.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.9e+16) (not (<= y 30.5))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.9e+16) || !(y <= 30.5)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
}
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.9d+16)) .or. (.not. (y <= 30.5d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * ((0.16666666666666666d0 * (y * z)) - 0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.9e+16) || !(y <= 30.5)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.9e+16) or not (y <= 30.5): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.9e+16) || !(y <= 30.5)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(0.16666666666666666 * Float64(y * z)) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.9e+16) || ~((y <= 30.5))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.9e+16], N[Not[LessEqual[y, 30.5]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+16} \lor \neg \left(y \leq 30.5\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right) - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -2.9e16 or 30.5 < y Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-define99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 29.6%
if -2.9e16 < y < 30.5Initial program 100.0%
Taylor expanded in y around 0 97.1%
Final simplification64.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.8e+88) (not (<= y 5e+118))) (+ x 1.0) (- (+ x 1.0) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.8e+88) || !(y <= 5e+118)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) - (y * z);
}
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 <= (-4.8d+88)) .or. (.not. (y <= 5d+118))) then
tmp = x + 1.0d0
else
tmp = (x + 1.0d0) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -4.8e+88) || !(y <= 5e+118)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.8e+88) or not (y <= 5e+118): tmp = x + 1.0 else: tmp = (x + 1.0) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.8e+88) || !(y <= 5e+118)) tmp = Float64(x + 1.0); else tmp = Float64(Float64(x + 1.0) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4.8e+88) || ~((y <= 5e+118))) tmp = x + 1.0; else tmp = (x + 1.0) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.8e+88], N[Not[LessEqual[y, 5e+118]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{+88} \lor \neg \left(y \leq 5 \cdot 10^{+118}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\end{array}
\end{array}
if y < -4.7999999999999998e88 or 4.99999999999999972e118 < y Initial program 99.7%
cancel-sign-sub-inv99.7%
+-commutative99.7%
associate-+l+99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-define99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 30.6%
if -4.7999999999999998e88 < y < 4.99999999999999972e118Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
sin-neg100.0%
fma-define100.0%
sin-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 80.1%
associate-+r+80.1%
associate-*r*80.1%
mul-1-neg80.1%
Simplified80.1%
Final simplification64.6%
(FPCore (x y z) :precision binary64 (if (<= x -1.15e+16) x (if (<= x 3e-32) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.15e+16) {
tmp = x;
} else if (x <= 3e-32) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.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) :: tmp
if (x <= (-1.15d+16)) then
tmp = x
else if (x <= 3d-32) then
tmp = 1.0d0 - (y * z)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.15e+16) {
tmp = x;
} else if (x <= 3e-32) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.15e+16: tmp = x elif x <= 3e-32: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.15e+16) tmp = x; elseif (x <= 3e-32) tmp = Float64(1.0 - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.15e+16) tmp = x; elseif (x <= 3e-32) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.15e+16], x, If[LessEqual[x, 3e-32], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-32}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1.15e16Initial program 100.0%
cancel-sign-sub-inv100.0%
+-commutative100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
sin-neg100.0%
fma-define100.0%
sin-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 84.3%
if -1.15e16 < x < 3e-32Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in x around 0 99.1%
neg-mul-199.1%
sub-neg99.1%
Simplified99.1%
Taylor expanded in y around 0 49.2%
mul-1-neg49.2%
unsub-neg49.2%
Simplified49.2%
if 3e-32 < x Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in y around 0 76.4%
Final simplification62.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.8e+205) (not (<= z 4.3e+243))) (* y (- z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.8e+205) || !(z <= 4.3e+243)) {
tmp = y * -z;
} else {
tmp = x + 1.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) :: tmp
if ((z <= (-1.8d+205)) .or. (.not. (z <= 4.3d+243))) then
tmp = y * -z
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.8e+205) || !(z <= 4.3e+243)) {
tmp = y * -z;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.8e+205) or not (z <= 4.3e+243): tmp = y * -z else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.8e+205) || !(z <= 4.3e+243)) tmp = Float64(y * Float64(-z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.8e+205) || ~((z <= 4.3e+243))) tmp = y * -z; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.8e+205], N[Not[LessEqual[z, 4.3e+243]], $MachinePrecision]], N[(y * (-z)), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+205} \lor \neg \left(z \leq 4.3 \cdot 10^{+243}\right):\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -1.80000000000000001e205 or 4.29999999999999964e243 < z Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
associate-+l+99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-define99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in x around 0 94.7%
neg-mul-194.7%
sub-neg94.7%
Simplified94.7%
Taylor expanded in y around 0 44.1%
mul-1-neg44.1%
unsub-neg44.1%
Simplified44.1%
Taylor expanded in y around inf 40.6%
mul-1-neg40.6%
*-commutative40.6%
distribute-rgt-neg-in40.6%
Simplified40.6%
if -1.80000000000000001e205 < z < 4.29999999999999964e243Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in y around 0 62.9%
Final simplification59.7%
(FPCore (x y z) :precision binary64 (+ x 1.0))
double code(double x, double y, double z) {
return x + 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + 1.0d0
end function
public static double code(double x, double y, double z) {
return x + 1.0;
}
def code(x, y, z): return x + 1.0
function code(x, y, z) return Float64(x + 1.0) end
function tmp = code(x, y, z) tmp = x + 1.0; end
code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
\begin{array}{l}
\\
x + 1
\end{array}
Initial program 99.9%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in y around 0 55.0%
Final simplification55.0%
(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%
cancel-sign-sub-inv99.9%
+-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-define99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in x around inf 35.2%
herbie shell --seed 2024170
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B"
:precision binary64
(- (+ x (cos y)) (* z (sin y))))