
(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 14 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 (fma (sin y) (- z) (+ x (cos y))))
double code(double x, double y, double z) {
return fma(sin(y), -z, (x + cos(y)));
}
function code(x, y, z) return fma(sin(y), Float64(-z), Float64(x + cos(y))) end
code[x_, y_, z_] := N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sin y, -z, x + \cos y\right)
\end{array}
Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) z)))
(if (<= x -0.92)
(- x t_0)
(if (<= x 1.7e-32) (- (cos y) t_0) (- (+ x 1.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = sin(y) * z;
double tmp;
if (x <= -0.92) {
tmp = x - t_0;
} else if (x <= 1.7e-32) {
tmp = cos(y) - t_0;
} else {
tmp = (x + 1.0) - 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 = sin(y) * z
if (x <= (-0.92d0)) then
tmp = x - t_0
else if (x <= 1.7d-32) then
tmp = cos(y) - t_0
else
tmp = (x + 1.0d0) - 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 tmp;
if (x <= -0.92) {
tmp = x - t_0;
} else if (x <= 1.7e-32) {
tmp = Math.cos(y) - t_0;
} else {
tmp = (x + 1.0) - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * z tmp = 0 if x <= -0.92: tmp = x - t_0 elif x <= 1.7e-32: tmp = math.cos(y) - t_0 else: tmp = (x + 1.0) - t_0 return tmp
function code(x, y, z) t_0 = Float64(sin(y) * z) tmp = 0.0 if (x <= -0.92) tmp = Float64(x - t_0); elseif (x <= 1.7e-32) tmp = Float64(cos(y) - t_0); else tmp = Float64(Float64(x + 1.0) - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * z; tmp = 0.0; if (x <= -0.92) tmp = x - t_0; elseif (x <= 1.7e-32) tmp = cos(y) - t_0; else tmp = (x + 1.0) - t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, -0.92], N[(x - t$95$0), $MachinePrecision], If[LessEqual[x, 1.7e-32], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot z\\
\mathbf{if}\;x \leq -0.92:\\
\;\;\;\;x - t_0\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-32}:\\
\;\;\;\;\cos y - t_0\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - t_0\\
\end{array}
\end{array}
if x < -0.92000000000000004Initial program 99.9%
Taylor expanded in x around inf 99.9%
if -0.92000000000000004 < x < 1.69999999999999989e-32Initial program 99.9%
Taylor expanded in x around 0 99.9%
if 1.69999999999999989e-32 < x Initial program 99.9%
Taylor expanded in y around 0 99.0%
+-commutative99.0%
Simplified99.0%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* (sin y) z)))
double code(double x, double y, double z) {
return (x + cos(y)) - (sin(y) * z);
}
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)) - (sin(y) * z)
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (Math.sin(y) * z);
}
def code(x, y, z): return (x + math.cos(y)) - (math.sin(y) * z)
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(sin(y) * z)) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (sin(y) * z); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - \sin y \cdot z
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -4e+42) (not (<= z 1.02e-44))) (- (+ x 1.0) (* (sin y) z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4e+42) || !(z <= 1.02e-44)) {
tmp = (x + 1.0) - (sin(y) * z);
} else {
tmp = x + cos(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 <= (-4d+42)) .or. (.not. (z <= 1.02d-44))) then
tmp = (x + 1.0d0) - (sin(y) * z)
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4e+42) || !(z <= 1.02e-44)) {
tmp = (x + 1.0) - (Math.sin(y) * z);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4e+42) or not (z <= 1.02e-44): tmp = (x + 1.0) - (math.sin(y) * z) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4e+42) || !(z <= 1.02e-44)) tmp = Float64(Float64(x + 1.0) - Float64(sin(y) * z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4e+42) || ~((z <= 1.02e-44))) tmp = (x + 1.0) - (sin(y) * z); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4e+42], N[Not[LessEqual[z, 1.02e-44]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+42} \lor \neg \left(z \leq 1.02 \cdot 10^{-44}\right):\\
\;\;\;\;\left(x + 1\right) - \sin y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -4.00000000000000018e42 or 1.0199999999999999e-44 < z Initial program 99.9%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
Simplified99.8%
if -4.00000000000000018e42 < z < 1.0199999999999999e-44Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 99.4%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.3e+42) (not (<= z 0.55))) (- x (* (sin y) z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.3e+42) || !(z <= 0.55)) {
tmp = x - (sin(y) * z);
} else {
tmp = x + cos(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 <= (-4.3d+42)) .or. (.not. (z <= 0.55d0))) then
tmp = x - (sin(y) * z)
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -4.3e+42) || !(z <= 0.55)) {
tmp = x - (Math.sin(y) * z);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.3e+42) or not (z <= 0.55): tmp = x - (math.sin(y) * z) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.3e+42) || !(z <= 0.55)) tmp = Float64(x - Float64(sin(y) * z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.3e+42) || ~((z <= 0.55))) tmp = x - (sin(y) * z); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.3e+42], N[Not[LessEqual[z, 0.55]], $MachinePrecision]], N[(x - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{+42} \lor \neg \left(z \leq 0.55\right):\\
\;\;\;\;x - \sin y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -4.2999999999999998e42 or 0.55000000000000004 < z Initial program 99.9%
Taylor expanded in x around inf 88.7%
if -4.2999999999999998e42 < z < 0.55000000000000004Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 99.5%
Final simplification93.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -2e+172) (not (<= z 7e+191))) (* (sin y) (- z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2e+172) || !(z <= 7e+191)) {
tmp = sin(y) * -z;
} else {
tmp = x + cos(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 <= (-2d+172)) .or. (.not. (z <= 7d+191))) then
tmp = sin(y) * -z
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2e+172) || !(z <= 7e+191)) {
tmp = Math.sin(y) * -z;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2e+172) or not (z <= 7e+191): tmp = math.sin(y) * -z else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2e+172) || !(z <= 7e+191)) tmp = Float64(sin(y) * Float64(-z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2e+172) || ~((z <= 7e+191))) tmp = sin(y) * -z; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2e+172], N[Not[LessEqual[z, 7e+191]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+172} \lor \neg \left(z \leq 7 \cdot 10^{+191}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2.0000000000000002e172 or 6.9999999999999994e191 < z Initial program 99.8%
Taylor expanded in z around inf 75.0%
associate-*r*75.0%
neg-mul-175.0%
*-commutative75.0%
Simplified75.0%
if -2.0000000000000002e172 < z < 6.9999999999999994e191Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 88.4%
Final simplification85.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -1600000.0) (not (<= y 520000000.0))) (+ x (cos y)) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1600000.0) || !(y <= 520000000.0)) {
tmp = x + cos(y);
} 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 <= (-1600000.0d0)) .or. (.not. (y <= 520000000.0d0))) then
tmp = x + cos(y)
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 <= -1600000.0) || !(y <= 520000000.0)) {
tmp = x + Math.cos(y);
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1600000.0) or not (y <= 520000000.0): tmp = x + math.cos(y) else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1600000.0) || !(y <= 520000000.0)) tmp = Float64(x + cos(y)); else tmp = Float64(x + Float64(1.0 - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1600000.0) || ~((y <= 520000000.0))) tmp = x + cos(y); else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1600000.0], N[Not[LessEqual[y, 520000000.0]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1600000 \lor \neg \left(y \leq 520000000\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -1.6e6 or 5.2e8 < y Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 61.9%
if -1.6e6 < y < 5.2e8Initial program 100.0%
Taylor expanded in y around 0 97.1%
associate-+r+97.1%
+-commutative97.1%
mul-1-neg97.1%
unsub-neg97.1%
Simplified97.1%
Final simplification80.6%
(FPCore (x y z) :precision binary64 (if (<= x -5e-32) (+ x (- 1.0 (* y z))) (if (<= x 1.55e-24) (cos y) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5e-32) {
tmp = x + (1.0 - (y * z));
} else if (x <= 1.55e-24) {
tmp = cos(y);
} 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 <= (-5d-32)) then
tmp = x + (1.0d0 - (y * z))
else if (x <= 1.55d-24) then
tmp = cos(y)
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 <= -5e-32) {
tmp = x + (1.0 - (y * z));
} else if (x <= 1.55e-24) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5e-32: tmp = x + (1.0 - (y * z)) elif x <= 1.55e-24: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5e-32) tmp = Float64(x + Float64(1.0 - Float64(y * z))); elseif (x <= 1.55e-24) tmp = cos(y); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5e-32) tmp = x + (1.0 - (y * z)); elseif (x <= 1.55e-24) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5e-32], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.55e-24], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-32}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-24}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -5e-32Initial program 99.9%
Taylor expanded in y around 0 74.0%
associate-+r+74.0%
+-commutative74.0%
mul-1-neg74.0%
unsub-neg74.0%
Simplified74.0%
if -5e-32 < x < 1.55e-24Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 65.0%
if 1.55e-24 < x Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 84.3%
Final simplification72.6%
(FPCore (x y z) :precision binary64 (if (<= y -1.4e+37) (+ x 1.0) (if (<= y 7.4e+40) (+ x (- 1.0 (* y z))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.4e+37) {
tmp = x + 1.0;
} else if (y <= 7.4e+40) {
tmp = x + (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 (y <= (-1.4d+37)) then
tmp = x + 1.0d0
else if (y <= 7.4d+40) then
tmp = x + (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 (y <= -1.4e+37) {
tmp = x + 1.0;
} else if (y <= 7.4e+40) {
tmp = x + (1.0 - (y * z));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.4e+37: tmp = x + 1.0 elif y <= 7.4e+40: tmp = x + (1.0 - (y * z)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.4e+37) tmp = Float64(x + 1.0); elseif (y <= 7.4e+40) tmp = Float64(x + 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 (y <= -1.4e+37) tmp = x + 1.0; elseif (y <= 7.4e+40) tmp = x + (1.0 - (y * z)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.4e+37], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 7.4e+40], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+37}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{+40}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -1.3999999999999999e37 or 7.4e40 < y Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 37.8%
if -1.3999999999999999e37 < y < 7.4e40Initial program 100.0%
Taylor expanded in y around 0 90.2%
associate-+r+90.2%
+-commutative90.2%
mul-1-neg90.2%
unsub-neg90.2%
Simplified90.2%
Final simplification68.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.8e+211) (not (<= z 2.4e+194))) (- x (* y z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.8e+211) || !(z <= 2.4e+194)) {
tmp = x - (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 <= (-2.8d+211)) .or. (.not. (z <= 2.4d+194))) then
tmp = x - (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 <= -2.8e+211) || !(z <= 2.4e+194)) {
tmp = x - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.8e+211) or not (z <= 2.4e+194): tmp = x - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.8e+211) || !(z <= 2.4e+194)) tmp = Float64(x - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.8e+211) || ~((z <= 2.4e+194))) tmp = x - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.8e+211], N[Not[LessEqual[z, 2.4e+194]], $MachinePrecision]], N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+211} \lor \neg \left(z \leq 2.4 \cdot 10^{+194}\right):\\
\;\;\;\;x - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -2.8e211 or 2.4e194 < z Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 98.1%
Taylor expanded in y around 0 52.1%
+-commutative52.1%
mul-1-neg52.1%
unsub-neg52.1%
Simplified52.1%
if -2.8e211 < z < 2.4e194Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 70.0%
Final simplification66.4%
(FPCore (x y z) :precision binary64 (if (<= z 8.5e+194) (+ x 1.0) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 8.5e+194) {
tmp = x + 1.0;
} else {
tmp = 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 (z <= 8.5d+194) then
tmp = x + 1.0d0
else
tmp = y * -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 8.5e+194) {
tmp = x + 1.0;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 8.5e+194: tmp = x + 1.0 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 8.5e+194) tmp = Float64(x + 1.0); else tmp = Float64(y * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 8.5e+194) tmp = x + 1.0; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 8.5e+194], N[(x + 1.0), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 8.5 \cdot 10^{+194}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 8.50000000000000026e194Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 66.8%
if 8.50000000000000026e194 < z Initial program 99.8%
Taylor expanded in y around 0 47.7%
associate-+r+47.7%
+-commutative47.7%
mul-1-neg47.7%
unsub-neg47.7%
Simplified47.7%
Taylor expanded in y around inf 34.7%
mul-1-neg34.7%
distribute-rgt-neg-in34.7%
Simplified34.7%
Final simplification63.0%
(FPCore (x y z) :precision binary64 (if (<= x -4.5e-13) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.5e-13) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} 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 <= (-4.5d-13)) then
tmp = x
else if (x <= 1.0d0) then
tmp = 1.0d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4.5e-13) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.5e-13: tmp = x elif x <= 1.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.5e-13) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.5e-13) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.5e-13], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.5e-13 or 1 < x Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 80.6%
if -4.5e-13 < x < 1Initial program 99.9%
Taylor expanded in x around 0 99.3%
Taylor expanded in y around 0 40.9%
Final simplification60.5%
(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%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 60.9%
Final simplification60.9%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 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 = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 60.4%
Taylor expanded in y around 0 22.2%
Final simplification22.2%
herbie shell --seed 2023199
(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))))