
(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 13 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 (let* ((t_0 (* z (sin y)))) (if (or (<= x -0.95) (not (<= x 0.72))) (- x t_0) (- (cos y) t_0))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if ((x <= -0.95) || !(x <= 0.72)) {
tmp = x - 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 <= (-0.95d0)) .or. (.not. (x <= 0.72d0))) then
tmp = x - 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 <= -0.95) || !(x <= 0.72)) {
tmp = x - 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 <= -0.95) or not (x <= 0.72): tmp = x - 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 <= -0.95) || !(x <= 0.72)) tmp = Float64(x - 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 <= -0.95) || ~((x <= 0.72))) tmp = x - 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, -0.95], N[Not[LessEqual[x, 0.72]], $MachinePrecision]], N[(x - 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 -0.95 \lor \neg \left(x \leq 0.72\right):\\
\;\;\;\;x - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -0.94999999999999996 or 0.71999999999999997 < x Initial program 100.0%
Taylor expanded in x around inf 97.0%
if -0.94999999999999996 < x < 0.71999999999999997Initial program 99.9%
Taylor expanded in x around 0 98.6%
Final simplification97.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- x (* z (sin y)))))
(if (<= z -6600000000.0)
t_0
(if (<= z 1.35e-6)
(+ x (cos y))
(if (or (<= z 8.6e+94) (not (<= z 2.3e+145)))
t_0
(+
1.0
(+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z)))))))))
double code(double x, double y, double z) {
double t_0 = x - (z * sin(y));
double tmp;
if (z <= -6600000000.0) {
tmp = t_0;
} else if (z <= 1.35e-6) {
tmp = x + cos(y);
} else if ((z <= 8.6e+94) || !(z <= 2.3e+145)) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = x - (z * sin(y))
if (z <= (-6600000000.0d0)) then
tmp = t_0
else if (z <= 1.35d-6) then
tmp = x + cos(y)
else if ((z <= 8.6d+94) .or. (.not. (z <= 2.3d+145))) then
tmp = t_0
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 t_0 = x - (z * Math.sin(y));
double tmp;
if (z <= -6600000000.0) {
tmp = t_0;
} else if (z <= 1.35e-6) {
tmp = x + Math.cos(y);
} else if ((z <= 8.6e+94) || !(z <= 2.3e+145)) {
tmp = t_0;
} else {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): t_0 = x - (z * math.sin(y)) tmp = 0 if z <= -6600000000.0: tmp = t_0 elif z <= 1.35e-6: tmp = x + math.cos(y) elif (z <= 8.6e+94) or not (z <= 2.3e+145): tmp = t_0 else: tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))) return tmp
function code(x, y, z) t_0 = Float64(x - Float64(z * sin(y))) tmp = 0.0 if (z <= -6600000000.0) tmp = t_0; elseif (z <= 1.35e-6) tmp = Float64(x + cos(y)); elseif ((z <= 8.6e+94) || !(z <= 2.3e+145)) tmp = t_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) t_0 = x - (z * sin(y)); tmp = 0.0; if (z <= -6600000000.0) tmp = t_0; elseif (z <= 1.35e-6) tmp = x + cos(y); elseif ((z <= 8.6e+94) || ~((z <= 2.3e+145))) tmp = t_0; else tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6600000000.0], t$95$0, If[LessEqual[z, 1.35e-6], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 8.6e+94], N[Not[LessEqual[z, 2.3e+145]], $MachinePrecision]], t$95$0, 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}
t_0 := x - z \cdot \sin y\\
\mathbf{if}\;z \leq -6600000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-6}:\\
\;\;\;\;x + \cos y\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{+94} \lor \neg \left(z \leq 2.3 \cdot 10^{+145}\right):\\
\;\;\;\;t\_0\\
\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 z < -6.6e9 or 1.34999999999999999e-6 < z < 8.6e94 or 2.3e145 < z Initial program 99.8%
Taylor expanded in x around inf 90.4%
if -6.6e9 < z < 1.34999999999999999e-6Initial program 100.0%
Taylor expanded in z around 0 99.5%
+-commutative99.5%
Simplified99.5%
if 8.6e94 < z < 2.3e145Initial program 100.0%
Taylor expanded in y around 0 85.1%
Final simplification94.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.6e+127) (not (<= z 8e+131))) (* z (- (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.6e+127) || !(z <= 8e+131)) {
tmp = 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 ((z <= (-4.6d+127)) .or. (.not. (z <= 8d+131))) then
tmp = 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 ((z <= -4.6e+127) || !(z <= 8e+131)) {
tmp = z * -Math.sin(y);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.6e+127) or not (z <= 8e+131): tmp = z * -math.sin(y) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.6e+127) || !(z <= 8e+131)) tmp = Float64(z * Float64(-sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -4.6e+127) || ~((z <= 8e+131))) tmp = z * -sin(y); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.6e+127], N[Not[LessEqual[z, 8e+131]], $MachinePrecision]], N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{+127} \lor \neg \left(z \leq 8 \cdot 10^{+131}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -4.6000000000000003e127 or 7.9999999999999993e131 < z Initial program 99.7%
Taylor expanded in z around inf 69.6%
associate-*r*69.6%
neg-mul-169.6%
*-commutative69.6%
Simplified69.6%
if -4.6000000000000003e127 < z < 7.9999999999999993e131Initial program 100.0%
Taylor expanded in z around 0 90.0%
+-commutative90.0%
Simplified90.0%
Final simplification84.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.98) (not (<= y 3.6))) (+ x (cos y)) (+ 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.98) || !(y <= 3.6)) {
tmp = x + cos(y);
} 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.98d0)) .or. (.not. (y <= 3.6d0))) then
tmp = x + cos(y)
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.98) || !(y <= 3.6)) {
tmp = x + Math.cos(y);
} 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.98) or not (y <= 3.6): tmp = x + math.cos(y) 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.98) || !(y <= 3.6)) tmp = Float64(x + cos(y)); 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.98) || ~((y <= 3.6))) tmp = x + cos(y); 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.98], N[Not[LessEqual[y, 3.6]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $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.98 \lor \neg \left(y \leq 3.6\right):\\
\;\;\;\;x + \cos y\\
\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.97999999999999998 or 3.60000000000000009 < y Initial program 99.8%
Taylor expanded in z around 0 60.8%
+-commutative60.8%
Simplified60.8%
if -0.97999999999999998 < y < 3.60000000000000009Initial program 100.0%
Taylor expanded in y around 0 99.1%
Final simplification79.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.4e-10) (not (<= x 3.7e-12))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.4e-10) || !(x <= 3.7e-12)) {
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 <= (-4.4d-10)) .or. (.not. (x <= 3.7d-12))) 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 <= -4.4e-10) || !(x <= 3.7e-12)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.4e-10) or not (x <= 3.7e-12): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.4e-10) || !(x <= 3.7e-12)) 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 <= -4.4e-10) || ~((x <= 3.7e-12))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.4e-10], N[Not[LessEqual[x, 3.7e-12]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{-10} \lor \neg \left(x \leq 3.7 \cdot 10^{-12}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -4.3999999999999998e-10 or 3.69999999999999999e-12 < x Initial program 100.0%
Taylor expanded in z around 0 100.0%
associate-+r+100.0%
associate-*r*100.0%
neg-mul-1100.0%
*-commutative100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 83.6%
if -4.3999999999999998e-10 < x < 3.69999999999999999e-12Initial program 99.9%
Taylor expanded in x around 0 99.8%
Taylor expanded in z around 0 58.7%
Final simplification72.1%
(FPCore (x y z)
:precision binary64
(if (<= y -38.0)
(* x (+ 1.0 (/ 1.0 x)))
(if (<= y 55000.0)
(+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))
(+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -38.0) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 55000.0) {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - 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 <= (-38.0d0)) then
tmp = x * (1.0d0 + (1.0d0 / x))
else if (y <= 55000.0d0) then
tmp = 1.0d0 + (x + (y * ((y * ((0.16666666666666666d0 * (y * z)) - 0.5d0)) - 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 <= -38.0) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 55000.0) {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -38.0: tmp = x * (1.0 + (1.0 / x)) elif y <= 55000.0: tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -38.0) tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); elseif (y <= 55000.0) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(0.16666666666666666 * Float64(y * z)) - 0.5)) - z)))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -38.0) tmp = x * (1.0 + (1.0 / x)); elseif (y <= 55000.0) tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -38.0], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 55000.0], 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], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -38:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\mathbf{elif}\;y \leq 55000:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right) - 0.5\right) - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -38Initial program 99.8%
Taylor expanded in y around 0 21.2%
mul-1-neg21.2%
unsub-neg21.2%
Simplified21.2%
sub-neg21.2%
distribute-rgt-neg-in21.2%
add-sqr-sqrt12.5%
sqrt-unprod22.0%
sqr-neg22.0%
sqrt-unprod9.3%
add-sqr-sqrt22.2%
+-commutative22.2%
Applied egg-rr22.2%
Taylor expanded in x around inf 22.1%
Taylor expanded in y around 0 37.9%
if -38 < y < 55000Initial program 100.0%
Taylor expanded in y around 0 99.1%
if 55000 < y Initial program 99.9%
Taylor expanded in z around 0 99.9%
associate-+r+99.9%
associate-*r*99.9%
neg-mul-199.9%
*-commutative99.9%
+-commutative99.9%
fma-define99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 45.9%
Final simplification69.9%
(FPCore (x y z) :precision binary64 (if (<= y -72.0) (* x (+ 1.0 (/ 1.0 x))) (if (<= y 1120000.0) (+ 1.0 (+ x (* y (- (* y -0.5) z)))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -72.0) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 1120000.0) {
tmp = 1.0 + (x + (y * ((y * -0.5) - 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 <= (-72.0d0)) then
tmp = x * (1.0d0 + (1.0d0 / x))
else if (y <= 1120000.0d0) then
tmp = 1.0d0 + (x + (y * ((y * (-0.5d0)) - 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 <= -72.0) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 1120000.0) {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -72.0: tmp = x * (1.0 + (1.0 / x)) elif y <= 1120000.0: tmp = 1.0 + (x + (y * ((y * -0.5) - z))) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -72.0) tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); elseif (y <= 1120000.0) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * -0.5) - z)))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -72.0) tmp = x * (1.0 + (1.0 / x)); elseif (y <= 1120000.0) tmp = 1.0 + (x + (y * ((y * -0.5) - z))); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -72.0], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1120000.0], N[(1.0 + N[(x + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -72:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\mathbf{elif}\;y \leq 1120000:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -72Initial program 99.8%
Taylor expanded in y around 0 21.2%
mul-1-neg21.2%
unsub-neg21.2%
Simplified21.2%
sub-neg21.2%
distribute-rgt-neg-in21.2%
add-sqr-sqrt12.5%
sqrt-unprod22.0%
sqr-neg22.0%
sqrt-unprod9.3%
add-sqr-sqrt22.2%
+-commutative22.2%
Applied egg-rr22.2%
Taylor expanded in x around inf 22.1%
Taylor expanded in y around 0 37.9%
if -72 < y < 1.12e6Initial program 100.0%
Taylor expanded in y around 0 98.9%
if 1.12e6 < y Initial program 99.9%
Taylor expanded in z around 0 99.9%
associate-+r+99.9%
associate-*r*99.9%
neg-mul-199.9%
*-commutative99.9%
+-commutative99.9%
fma-define99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 45.9%
Final simplification69.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -1e+25) (not (<= y 3e+30))) (+ x 1.0) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1e+25) || !(y <= 3e+30)) {
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 <= (-1d+25)) .or. (.not. (y <= 3d+30))) 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 <= -1e+25) || !(y <= 3e+30)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1e+25) or not (y <= 3e+30): tmp = x + 1.0 else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1e+25) || !(y <= 3e+30)) 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 <= -1e+25) || ~((y <= 3e+30))) tmp = x + 1.0; else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1e+25], N[Not[LessEqual[y, 3e+30]], $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 -1 \cdot 10^{+25} \lor \neg \left(y \leq 3 \cdot 10^{+30}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -1.00000000000000009e25 or 2.99999999999999978e30 < y Initial program 99.8%
Taylor expanded in z around 0 99.8%
associate-+r+99.8%
associate-*r*99.8%
neg-mul-199.8%
*-commutative99.8%
+-commutative99.8%
fma-define99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 40.7%
if -1.00000000000000009e25 < y < 2.99999999999999978e30Initial program 100.0%
Taylor expanded in y around 0 94.9%
mul-1-neg94.9%
unsub-neg94.9%
Simplified94.9%
Final simplification69.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.8e-9) (not (<= x 1.42e-39))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.8e-9) || !(x <= 1.42e-39)) {
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 <= (-2.8d-9)) .or. (.not. (x <= 1.42d-39))) 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 <= -2.8e-9) || !(x <= 1.42e-39)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.8e-9) or not (x <= 1.42e-39): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.8e-9) || !(x <= 1.42e-39)) 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 <= -2.8e-9) || ~((x <= 1.42e-39))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.8e-9], N[Not[LessEqual[x, 1.42e-39]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{-9} \lor \neg \left(x \leq 1.42 \cdot 10^{-39}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -2.79999999999999984e-9 or 1.42000000000000005e-39 < x Initial program 99.9%
Taylor expanded in z around 0 99.9%
associate-+r+99.9%
associate-*r*99.9%
neg-mul-199.9%
*-commutative99.9%
+-commutative99.9%
fma-define99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 81.0%
if -2.79999999999999984e-9 < x < 1.42000000000000005e-39Initial program 99.9%
Taylor expanded in x around 0 99.8%
Taylor expanded in y around 0 51.6%
mul-1-neg51.6%
unsub-neg51.6%
Simplified51.6%
Final simplification68.2%
(FPCore (x y z) :precision binary64 (if (<= x -0.96) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.96) {
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 <= (-0.96d0)) 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 <= -0.96) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.96: tmp = x elif x <= 1.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.96) 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 <= -0.96) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.96], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.96:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.95999999999999996 or 1 < x Initial program 100.0%
Taylor expanded in z around 0 100.0%
associate-+r+100.0%
associate-*r*100.0%
neg-mul-1100.0%
*-commutative100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 83.0%
if -0.95999999999999996 < x < 1Initial program 99.9%
Taylor expanded in x around 0 98.6%
Taylor expanded in y around 0 38.3%
Final simplification61.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%
Taylor expanded in z around 0 99.9%
associate-+r+99.9%
associate-*r*99.9%
neg-mul-199.9%
*-commutative99.9%
+-commutative99.9%
fma-define99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 62.8%
Final simplification62.8%
(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 55.7%
Taylor expanded in y around 0 20.2%
Final simplification20.2%
herbie shell --seed 2024084
(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))))