
(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 (+ (cos y) (fma z (- (sin y)) x)))
double code(double x, double y, double z) {
return cos(y) + fma(z, -sin(y), x);
}
function code(x, y, z) return Float64(cos(y) + fma(z, Float64(-sin(y)), x)) end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] + N[(z * (-N[Sin[y], $MachinePrecision]) + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos y + \mathsf{fma}\left(z, -\sin y, x\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%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (or (<= x -1.58e-9) (not (<= x 2.25e-18)))
(- (+ x 1.0) t_0)
(- (cos y) t_0))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if ((x <= -1.58e-9) || !(x <= 2.25e-18)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = cos(y) - 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 * sin(y)
if ((x <= (-1.58d-9)) .or. (.not. (x <= 2.25d-18))) then
tmp = (x + 1.0d0) - t_0
else
tmp = cos(y) - t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double tmp;
if ((x <= -1.58e-9) || !(x <= 2.25e-18)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = Math.cos(y) - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) tmp = 0 if (x <= -1.58e-9) or not (x <= 2.25e-18): tmp = (x + 1.0) - t_0 else: tmp = math.cos(y) - t_0 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if ((x <= -1.58e-9) || !(x <= 2.25e-18)) tmp = Float64(Float64(x + 1.0) - t_0); else tmp = Float64(cos(y) - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); tmp = 0.0; if ((x <= -1.58e-9) || ~((x <= 2.25e-18))) tmp = (x + 1.0) - t_0; else tmp = cos(y) - t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -1.58e-9], N[Not[LessEqual[x, 2.25e-18]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -1.58 \cdot 10^{-9} \lor \neg \left(x \leq 2.25 \cdot 10^{-18}\right):\\
\;\;\;\;\left(x + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -1.5799999999999999e-9 or 2.24999999999999997e-18 < x Initial program 99.9%
Taylor expanded in y around 0 99.6%
if -1.5799999999999999e-9 < x < 2.24999999999999997e-18Initial 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 99.8%
neg-mul-199.8%
sub-neg99.8%
Simplified99.8%
Final simplification99.7%
(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(Float64(cos(y) + 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[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\cos y + x\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.45) (not (<= z 0.35))) (- (+ x 1.0) (* z (sin y))) (+ (cos y) x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.45) || !(z <= 0.35)) {
tmp = (x + 1.0) - (z * sin(y));
} 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 <= (-0.45d0)) .or. (.not. (z <= 0.35d0))) then
tmp = (x + 1.0d0) - (z * sin(y))
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 <= -0.45) || !(z <= 0.35)) {
tmp = (x + 1.0) - (z * Math.sin(y));
} else {
tmp = Math.cos(y) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.45) or not (z <= 0.35): tmp = (x + 1.0) - (z * math.sin(y)) else: tmp = math.cos(y) + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.45) || !(z <= 0.35)) tmp = Float64(Float64(x + 1.0) - Float64(z * sin(y))); else tmp = Float64(cos(y) + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.45) || ~((z <= 0.35))) tmp = (x + 1.0) - (z * sin(y)); else tmp = cos(y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.45], N[Not[LessEqual[z, 0.35]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.45 \lor \neg \left(z \leq 0.35\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;\cos y + x\\
\end{array}
\end{array}
if z < -0.450000000000000011 or 0.34999999999999998 < z Initial program 99.8%
Taylor expanded in y around 0 99.2%
if -0.450000000000000011 < z < 0.34999999999999998Initial 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 98.5%
Final simplification98.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -4e+141) (not (<= z 1.35e+239))) (* (sin y) (- z)) (+ (cos y) x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4e+141) || !(z <= 1.35e+239)) {
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 <= (-4d+141)) .or. (.not. (z <= 1.35d+239))) 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 <= -4e+141) || !(z <= 1.35e+239)) {
tmp = Math.sin(y) * -z;
} else {
tmp = Math.cos(y) + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4e+141) or not (z <= 1.35e+239): tmp = math.sin(y) * -z else: tmp = math.cos(y) + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4e+141) || !(z <= 1.35e+239)) 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 <= -4e+141) || ~((z <= 1.35e+239))) tmp = sin(y) * -z; else tmp = cos(y) + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4e+141], N[Not[LessEqual[z, 1.35e+239]], $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 -4 \cdot 10^{+141} \lor \neg \left(z \leq 1.35 \cdot 10^{+239}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y + x\\
\end{array}
\end{array}
if z < -4.00000000000000007e141 or 1.3499999999999999e239 < z Initial program 99.7%
cancel-sign-sub-inv99.7%
+-commutative99.7%
associate-+l+99.7%
+-commutative99.7%
distribute-lft-neg-out99.7%
distribute-rgt-neg-in99.7%
sin-neg99.7%
fma-define99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in z around inf 79.6%
neg-mul-179.6%
distribute-rgt-neg-in79.6%
Simplified79.6%
if -4.00000000000000007e141 < z < 1.3499999999999999e239Initial 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 85.0%
Final simplification83.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.5e+20) (not (<= y 9e+18))) (+ (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 <= -4.5e+20) || !(y <= 9e+18)) {
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 <= (-4.5d+20)) .or. (.not. (y <= 9d+18))) 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 <= -4.5e+20) || !(y <= 9e+18)) {
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 <= -4.5e+20) or not (y <= 9e+18): 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 <= -4.5e+20) || !(y <= 9e+18)) 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 <= -4.5e+20) || ~((y <= 9e+18))) 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, -4.5e+20], N[Not[LessEqual[y, 9e+18]], $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 -4.5 \cdot 10^{+20} \lor \neg \left(y \leq 9 \cdot 10^{+18}\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 < -4.5e20 or 9e18 < 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 z around 0 62.7%
if -4.5e20 < y < 9e18Initial program 100.0%
Taylor expanded in y around 0 96.8%
Final simplification78.5%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.2e-12) (not (<= x 2.25e-18))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.2e-12) || !(x <= 2.25e-18)) {
tmp = x + 1.0;
} else {
tmp = 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 ((x <= (-1.2d-12)) .or. (.not. (x <= 2.25d-18))) then
tmp = x + 1.0d0
else
tmp = cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.2e-12) || !(x <= 2.25e-18)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.2e-12) or not (x <= 2.25e-18): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.2e-12) || !(x <= 2.25e-18)) tmp = Float64(x + 1.0); else tmp = cos(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.2e-12) || ~((x <= 2.25e-18))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.2e-12], N[Not[LessEqual[x, 2.25e-18]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-12} \lor \neg \left(x \leq 2.25 \cdot 10^{-18}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -1.19999999999999994e-12 or 2.24999999999999997e-18 < 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 80.8%
if -1.19999999999999994e-12 < x < 2.24999999999999997e-18Initial 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 99.8%
neg-mul-199.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in z around 0 56.7%
Final simplification70.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.26e+33) (not (<= y 8.5e+33))) (+ 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 <= -1.26e+33) || !(y <= 8.5e+33)) {
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 <= (-1.26d+33)) .or. (.not. (y <= 8.5d+33))) 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 <= -1.26e+33) || !(y <= 8.5e+33)) {
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 <= -1.26e+33) or not (y <= 8.5e+33): 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 <= -1.26e+33) || !(y <= 8.5e+33)) 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 <= -1.26e+33) || ~((y <= 8.5e+33))) 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, -1.26e+33], N[Not[LessEqual[y, 8.5e+33]], $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 -1.26 \cdot 10^{+33} \lor \neg \left(y \leq 8.5 \cdot 10^{+33}\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 < -1.26e33 or 8.4999999999999998e33 < 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 40.5%
if -1.26e33 < y < 8.4999999999999998e33Initial program 100.0%
Taylor expanded in y around 0 92.7%
Final simplification66.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.45e+33) (not (<= y 1.35e+54))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y (* 0.16666666666666666 (* y z))) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.45e+33) || !(y <= 1.35e+54)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - 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 <= (-1.45d+33)) .or. (.not. (y <= 1.35d+54))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * (0.16666666666666666d0 * (y * z))) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.45e+33) || !(y <= 1.35e+54)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.45e+33) or not (y <= 1.35e+54): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.45e+33) || !(y <= 1.35e+54)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(0.16666666666666666 * Float64(y * z))) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.45e+33) || ~((y <= 1.35e+54))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.45e+33], N[Not[LessEqual[y, 1.35e+54]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{+33} \lor \neg \left(y \leq 1.35 \cdot 10^{+54}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right)\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -1.45000000000000012e33 or 1.35000000000000005e54 < 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 42.5%
if -1.45000000000000012e33 < y < 1.35000000000000005e54Initial program 99.9%
Taylor expanded in y around 0 87.4%
Taylor expanded in y around inf 87.9%
*-commutative87.9%
Simplified87.9%
Final simplification66.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -7e+119) (not (<= y 9e+63))) (+ x 1.0) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7e+119) || !(y <= 9e+63)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (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 <= (-7d+119)) .or. (.not. (y <= 9d+63))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -7e+119) || !(y <= 9e+63)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7e+119) or not (y <= 9e+63): tmp = x + 1.0 else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7e+119) || !(y <= 9e+63)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -7e+119) || ~((y <= 9e+63))) tmp = x + 1.0; else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7e+119], N[Not[LessEqual[y, 9e+63]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+119} \lor \neg \left(y \leq 9 \cdot 10^{+63}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -7.0000000000000001e119 or 9.00000000000000034e63 < 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 40.7%
if -7.0000000000000001e119 < y < 9.00000000000000034e63Initial 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 84.5%
mul-1-neg84.5%
unsub-neg84.5%
Simplified84.5%
Final simplification66.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.2e-5) (not (<= x 5.2e-19))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.2e-5) || !(x <= 5.2e-19)) {
tmp = x + 1.0;
} else {
tmp = 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 ((x <= (-3.2d-5)) .or. (.not. (x <= 5.2d-19))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.2e-5) || !(x <= 5.2e-19)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.2e-5) or not (x <= 5.2e-19): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.2e-5) || !(x <= 5.2e-19)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.2e-5) || ~((x <= 5.2e-19))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.2e-5], N[Not[LessEqual[x, 5.2e-19]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-5} \lor \neg \left(x \leq 5.2 \cdot 10^{-19}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -3.19999999999999986e-5 or 5.20000000000000026e-19 < 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 81.5%
if -3.19999999999999986e-5 < x < 5.20000000000000026e-19Initial 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 inf 76.2%
metadata-eval76.2%
mul-1-neg76.2%
distribute-neg-in76.2%
+-commutative76.2%
metadata-eval76.2%
sub-neg76.2%
distribute-rgt-neg-in76.2%
distribute-lft-neg-in76.2%
*-commutative76.2%
*-commutative76.2%
associate-/l*68.7%
fmm-def68.7%
metadata-eval68.7%
Simplified68.7%
Taylor expanded in z around inf 76.0%
associate-/l*76.0%
Simplified76.0%
Taylor expanded in y around 0 42.4%
mul-1-neg42.4%
unsub-neg42.4%
*-commutative42.4%
Simplified42.4%
Final simplification63.9%
(FPCore (x y z) :precision binary64 (if (<= x -0.83) x (if (<= x 1.45) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.83) {
tmp = x;
} else if (x <= 1.45) {
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 <= (-0.83d0)) then
tmp = x
else if (x <= 1.45d0) 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 <= -0.83) {
tmp = x;
} else if (x <= 1.45) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.83: tmp = x elif x <= 1.45: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.83) tmp = x; elseif (x <= 1.45) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.83) tmp = x; elseif (x <= 1.45) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.83], x, If[LessEqual[x, 1.45], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.83:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.45:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.82999999999999996 or 1.44999999999999996 < 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 80.8%
if -0.82999999999999996 < x < 1.44999999999999996Initial 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 99.2%
neg-mul-199.2%
sub-neg99.2%
Simplified99.2%
Taylor expanded in y around 0 30.1%
(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 58.1%
Final simplification58.1%
(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%
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 55.7%
neg-mul-155.7%
sub-neg55.7%
Simplified55.7%
Taylor expanded in y around 0 15.5%
herbie shell --seed 2024181
(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))))