
(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 (- (+ 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}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= x -3700000000000.0) (+ x 1.0) (if (<= x 7e-12) (- (cos y) (* z (sin y))) (+ x (cos y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3700000000000.0) {
tmp = x + 1.0;
} else if (x <= 7e-12) {
tmp = cos(y) - (z * sin(y));
} 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 (x <= (-3700000000000.0d0)) then
tmp = x + 1.0d0
else if (x <= 7d-12) then
tmp = cos(y) - (z * sin(y))
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3700000000000.0) {
tmp = x + 1.0;
} else if (x <= 7e-12) {
tmp = Math.cos(y) - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3700000000000.0: tmp = x + 1.0 elif x <= 7e-12: tmp = math.cos(y) - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3700000000000.0) tmp = Float64(x + 1.0); elseif (x <= 7e-12) tmp = Float64(cos(y) - Float64(z * sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3700000000000.0) tmp = x + 1.0; elseif (x <= 7e-12) tmp = cos(y) - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3700000000000.0], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 7e-12], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3700000000000:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-12}:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if x < -3.7e12Initial program 100.0%
Taylor expanded in y around 0 82.2%
+-commutative82.2%
Simplified82.2%
if -3.7e12 < x < 7.0000000000000001e-12Initial program 99.9%
Taylor expanded in x around 0 98.7%
if 7.0000000000000001e-12 < x Initial program 100.0%
Taylor expanded in z around 0 85.9%
+-commutative85.9%
Simplified85.9%
Final simplification91.1%
(FPCore (x y z)
:precision binary64
(if (<= x -1.85e+69)
x
(if (<= x -1.35e-11)
(+ x (- 1.0 (* y z)))
(if (<= x 9.2e-10) (cos y) (+ x 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.85e+69) {
tmp = x;
} else if (x <= -1.35e-11) {
tmp = x + (1.0 - (y * z));
} else if (x <= 9.2e-10) {
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 <= (-1.85d+69)) then
tmp = x
else if (x <= (-1.35d-11)) then
tmp = x + (1.0d0 - (y * z))
else if (x <= 9.2d-10) 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 <= -1.85e+69) {
tmp = x;
} else if (x <= -1.35e-11) {
tmp = x + (1.0 - (y * z));
} else if (x <= 9.2e-10) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.85e+69: tmp = x elif x <= -1.35e-11: tmp = x + (1.0 - (y * z)) elif x <= 9.2e-10: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.85e+69) tmp = x; elseif (x <= -1.35e-11) tmp = Float64(x + Float64(1.0 - Float64(y * z))); elseif (x <= 9.2e-10) 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 <= -1.85e+69) tmp = x; elseif (x <= -1.35e-11) tmp = x + (1.0 - (y * z)); elseif (x <= 9.2e-10) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.85e+69], x, If[LessEqual[x, -1.35e-11], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.2e-10], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{+69}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.35 \cdot 10^{-11}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{-10}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1.8499999999999999e69Initial program 100.0%
Taylor expanded in x around inf 83.0%
if -1.8499999999999999e69 < x < -1.35000000000000002e-11Initial program 100.0%
Taylor expanded in y around 0 82.9%
associate-+r+82.9%
+-commutative82.9%
associate-+l+82.9%
mul-1-neg82.9%
unsub-neg82.9%
Simplified82.9%
if -1.35000000000000002e-11 < x < 9.20000000000000028e-10Initial program 99.9%
Taylor expanded in x around 0 99.4%
Taylor expanded in z around 0 65.4%
if 9.20000000000000028e-10 < x Initial program 100.0%
Taylor expanded in y around 0 84.7%
+-commutative84.7%
Simplified84.7%
Final simplification75.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.1e+127) (not (<= z 1.25e+130))) (* (sin y) (- z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.1e+127) || !(z <= 1.25e+130)) {
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 <= (-2.1d+127)) .or. (.not. (z <= 1.25d+130))) 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 <= -2.1e+127) || !(z <= 1.25e+130)) {
tmp = Math.sin(y) * -z;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.1e+127) or not (z <= 1.25e+130): tmp = math.sin(y) * -z else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.1e+127) || !(z <= 1.25e+130)) 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 <= -2.1e+127) || ~((z <= 1.25e+130))) tmp = sin(y) * -z; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.1e+127], N[Not[LessEqual[z, 1.25e+130]], $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.1 \cdot 10^{+127} \lor \neg \left(z \leq 1.25 \cdot 10^{+130}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2.09999999999999992e127 or 1.2499999999999999e130 < z Initial program 99.8%
Taylor expanded in z around inf 79.0%
associate-*r*79.0%
neg-mul-179.0%
*-commutative79.0%
Simplified79.0%
if -2.09999999999999992e127 < z < 1.2499999999999999e130Initial program 100.0%
Taylor expanded in z around 0 93.1%
+-commutative93.1%
Simplified93.1%
Final simplification89.2%
(FPCore (x y z)
:precision binary64
(if (or (<= y -0.029) (not (<= y 75000000000.0)))
(+ x (cos y))
(+
1.0
(+
x
(*
y
(-
(*
y
(-
(*
y
(-
(* y (+ 0.041666666666666664 (* -0.008333333333333333 (* y z))))
(* z -0.16666666666666666)))
0.5))
z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.029) || !(y <= 75000000000.0)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664 + (-0.008333333333333333 * (y * z)))) - (z * -0.16666666666666666))) - 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.029d0)) .or. (.not. (y <= 75000000000.0d0))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664d0 + ((-0.008333333333333333d0) * (y * z)))) - (z * (-0.16666666666666666d0)))) - 0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.029) || !(y <= 75000000000.0)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664 + (-0.008333333333333333 * (y * z)))) - (z * -0.16666666666666666))) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.029) or not (y <= 75000000000.0): tmp = x + math.cos(y) else: tmp = 1.0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664 + (-0.008333333333333333 * (y * z)))) - (z * -0.16666666666666666))) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.029) || !(y <= 75000000000.0)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(y * Float64(Float64(y * Float64(0.041666666666666664 + Float64(-0.008333333333333333 * Float64(y * z)))) - Float64(z * -0.16666666666666666))) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.029) || ~((y <= 75000000000.0))) tmp = x + cos(y); else tmp = 1.0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664 + (-0.008333333333333333 * (y * z)))) - (z * -0.16666666666666666))) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.029], N[Not[LessEqual[y, 75000000000.0]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(y * N[(N[(y * N[(0.041666666666666664 + N[(-0.008333333333333333 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.029 \lor \neg \left(y \leq 75000000000\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(y \cdot \left(y \cdot \left(0.041666666666666664 + -0.008333333333333333 \cdot \left(y \cdot z\right)\right) - z \cdot -0.16666666666666666\right) - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -0.0290000000000000015 or 7.5e10 < y Initial program 99.9%
Taylor expanded in z around 0 65.5%
+-commutative65.5%
Simplified65.5%
if -0.0290000000000000015 < y < 7.5e10Initial program 100.0%
Taylor expanded in y around 0 99.3%
Final simplification83.1%
(FPCore (x y z)
:precision binary64
(if (or (<= y -6600000000.0) (not (<= y 5.8e+31)))
(+ x 1.0)
(+
1.0
(+
x
(*
y
(-
(*
y
(-
(*
y
(-
(* y (+ 0.041666666666666664 (* -0.008333333333333333 (* y z))))
(* z -0.16666666666666666)))
0.5))
z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6600000000.0) || !(y <= 5.8e+31)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664 + (-0.008333333333333333 * (y * z)))) - (z * -0.16666666666666666))) - 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 <= (-6600000000.0d0)) .or. (.not. (y <= 5.8d+31))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664d0 + ((-0.008333333333333333d0) * (y * z)))) - (z * (-0.16666666666666666d0)))) - 0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6600000000.0) || !(y <= 5.8e+31)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664 + (-0.008333333333333333 * (y * z)))) - (z * -0.16666666666666666))) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6600000000.0) or not (y <= 5.8e+31): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664 + (-0.008333333333333333 * (y * z)))) - (z * -0.16666666666666666))) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6600000000.0) || !(y <= 5.8e+31)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(y * Float64(Float64(y * Float64(0.041666666666666664 + Float64(-0.008333333333333333 * Float64(y * z)))) - Float64(z * -0.16666666666666666))) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6600000000.0) || ~((y <= 5.8e+31))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * ((y * ((y * (0.041666666666666664 + (-0.008333333333333333 * (y * z)))) - (z * -0.16666666666666666))) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6600000000.0], N[Not[LessEqual[y, 5.8e+31]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(y * N[(N[(y * N[(0.041666666666666664 + N[(-0.008333333333333333 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6600000000 \lor \neg \left(y \leq 5.8 \cdot 10^{+31}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(y \cdot \left(y \cdot \left(0.041666666666666664 + -0.008333333333333333 \cdot \left(y \cdot z\right)\right) - z \cdot -0.16666666666666666\right) - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -6.6e9 or 5.8000000000000001e31 < y Initial program 99.9%
Taylor expanded in y around 0 44.2%
+-commutative44.2%
Simplified44.2%
if -6.6e9 < y < 5.8000000000000001e31Initial program 100.0%
Taylor expanded in y around 0 95.1%
Final simplification72.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.8e+43) (not (<= y 3.75e+31))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y (- (* (* y z) 0.16666666666666666) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.8e+43) || !(y <= 3.75e+31)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 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 <= (-3.8d+43)) .or. (.not. (y <= 3.75d+31))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * (((y * z) * 0.16666666666666666d0) - 0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.8e+43) || !(y <= 3.75e+31)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.8e+43) or not (y <= 3.75e+31): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.8e+43) || !(y <= 3.75e+31)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(Float64(y * z) * 0.16666666666666666) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.8e+43) || ~((y <= 3.75e+31))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.8e+43], N[Not[LessEqual[y, 3.75e+31]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(N[(y * z), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+43} \lor \neg \left(y \leq 3.75 \cdot 10^{+31}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(\left(y \cdot z\right) \cdot 0.16666666666666666 - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -3.80000000000000008e43 or 3.75e31 < y Initial program 99.9%
Taylor expanded in y around 0 44.8%
+-commutative44.8%
Simplified44.8%
if -3.80000000000000008e43 < y < 3.75e31Initial program 100.0%
Taylor expanded in y around 0 93.2%
Final simplification72.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -9.5e+21) (not (<= y 5.8e+31))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -9.5e+21) || !(y <= 5.8e+31)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * -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 <= (-9.5d+21)) .or. (.not. (y <= 5.8d+31))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (y * ((y * (-0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -9.5e+21) || !(y <= 5.8e+31)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -9.5e+21) or not (y <= 5.8e+31): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * -0.5) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -9.5e+21) || !(y <= 5.8e+31)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * -0.5) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -9.5e+21) || ~((y <= 5.8e+31))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * -0.5) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -9.5e+21], N[Not[LessEqual[y, 5.8e+31]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+21} \lor \neg \left(y \leq 5.8 \cdot 10^{+31}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\end{array}
\end{array}
if y < -9.500000000000001e21 or 5.8000000000000001e31 < y Initial program 99.9%
Taylor expanded in y around 0 44.1%
+-commutative44.1%
Simplified44.1%
if -9.500000000000001e21 < y < 5.8000000000000001e31Initial program 100.0%
Taylor expanded in y around 0 94.2%
Final simplification72.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.6e+24) (not (<= y 7.3e+31))) (+ x 1.0) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.6e+24) || !(y <= 7.3e+31)) {
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.6d+24)) .or. (.not. (y <= 7.3d+31))) 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.6e+24) || !(y <= 7.3e+31)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.6e+24) or not (y <= 7.3e+31): tmp = x + 1.0 else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.6e+24) || !(y <= 7.3e+31)) tmp = Float64(x + 1.0); 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 <= -4.6e+24) || ~((y <= 7.3e+31))) 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.6e+24], N[Not[LessEqual[y, 7.3e+31]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{+24} \lor \neg \left(y \leq 7.3 \cdot 10^{+31}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -4.5999999999999998e24 or 7.30000000000000023e31 < y Initial program 99.9%
Taylor expanded in y around 0 44.1%
+-commutative44.1%
Simplified44.1%
if -4.5999999999999998e24 < y < 7.30000000000000023e31Initial program 100.0%
Taylor expanded in y around 0 93.7%
associate-+r+93.7%
+-commutative93.7%
associate-+l+93.7%
mul-1-neg93.7%
unsub-neg93.7%
Simplified93.7%
Final simplification72.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -3400000000000.0) (not (<= x 4200000.0))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3400000000000.0) || !(x <= 4200000.0)) {
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 <= (-3400000000000.0d0)) .or. (.not. (x <= 4200000.0d0))) 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 <= -3400000000000.0) || !(x <= 4200000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3400000000000.0) or not (x <= 4200000.0): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3400000000000.0) || !(x <= 4200000.0)) 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 <= -3400000000000.0) || ~((x <= 4200000.0))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3400000000000.0], N[Not[LessEqual[x, 4200000.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3400000000000 \lor \neg \left(x \leq 4200000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -3.4e12 or 4.2e6 < x Initial program 100.0%
Taylor expanded in y around 0 83.9%
+-commutative83.9%
Simplified83.9%
if -3.4e12 < x < 4.2e6Initial program 99.9%
Taylor expanded in x around 0 97.6%
Taylor expanded in y around 0 54.3%
mul-1-neg54.3%
unsub-neg54.3%
Simplified54.3%
Final simplification69.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -3e+256) (not (<= z 7.5e+133))) (* y (- z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3e+256) || !(z <= 7.5e+133)) {
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 <= (-3d+256)) .or. (.not. (z <= 7.5d+133))) 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 <= -3e+256) || !(z <= 7.5e+133)) {
tmp = y * -z;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3e+256) or not (z <= 7.5e+133): tmp = y * -z else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3e+256) || !(z <= 7.5e+133)) 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 <= -3e+256) || ~((z <= 7.5e+133))) tmp = y * -z; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3e+256], N[Not[LessEqual[z, 7.5e+133]], $MachinePrecision]], N[(y * (-z)), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+256} \lor \neg \left(z \leq 7.5 \cdot 10^{+133}\right):\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -3.0000000000000001e256 or 7.49999999999999992e133 < z Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
distribute-lft-neg-in99.8%
add-cube-cbrt98.0%
associate-*r*98.2%
fma-define98.2%
pow298.2%
Applied egg-rr98.2%
Taylor expanded in x around inf 68.5%
associate-+r+68.5%
mul-1-neg68.5%
unsub-neg68.5%
associate-/l*68.4%
Simplified68.4%
Taylor expanded in y around 0 36.7%
+-commutative36.7%
mul-1-neg36.7%
unsub-neg36.7%
associate-/l*29.6%
Simplified29.6%
Taylor expanded in y around inf 43.0%
neg-mul-143.0%
distribute-rgt-neg-in43.0%
Simplified43.0%
if -3.0000000000000001e256 < z < 7.49999999999999992e133Initial program 100.0%
Taylor expanded in y around 0 72.9%
+-commutative72.9%
Simplified72.9%
Final simplification68.0%
(FPCore (x y z) :precision binary64 (if (<= x -1.0) x (if (<= x 1.3e-15) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
tmp = x;
} else if (x <= 1.3e-15) {
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 <= (-1.0d0)) then
tmp = x
else if (x <= 1.3d-15) 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 <= -1.0) {
tmp = x;
} else if (x <= 1.3e-15) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.0: tmp = x elif x <= 1.3e-15: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.0) tmp = x; elseif (x <= 1.3e-15) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.0) tmp = x; elseif (x <= 1.3e-15) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.0], x, If[LessEqual[x, 1.3e-15], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-15}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1 or 1.30000000000000002e-15 < x Initial program 100.0%
Taylor expanded in x around inf 78.9%
if -1 < x < 1.30000000000000002e-15Initial program 99.9%
Taylor expanded in x around 0 99.4%
Taylor expanded in y around 0 43.1%
Final simplification62.2%
(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%
Taylor expanded in y around 0 63.0%
+-commutative63.0%
Simplified63.0%
Final simplification63.0%
(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 57.7%
Taylor expanded in y around 0 21.6%
Final simplification21.6%
herbie shell --seed 2024055
(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))))