
(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 12 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%
(FPCore (x y z) :precision binary64 (if (or (<= z -9e+36) (not (<= z 5.8e-18))) (- (+ x 1.0) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -9e+36) || !(z <= 5.8e-18)) {
tmp = (x + 1.0) - (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 <= (-9d+36)) .or. (.not. (z <= 5.8d-18))) then
tmp = (x + 1.0d0) - (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 <= -9e+36) || !(z <= 5.8e-18)) {
tmp = (x + 1.0) - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -9e+36) or not (z <= 5.8e-18): tmp = (x + 1.0) - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -9e+36) || !(z <= 5.8e-18)) tmp = Float64(Float64(x + 1.0) - 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 ((z <= -9e+36) || ~((z <= 5.8e-18))) tmp = (x + 1.0) - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -9e+36], N[Not[LessEqual[z, 5.8e-18]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+36} \lor \neg \left(z \leq 5.8 \cdot 10^{-18}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -8.99999999999999994e36 or 5.8e-18 < z Initial program 99.8%
Taylor expanded in y around 0 99.3%
if -8.99999999999999994e36 < z < 5.8e-18Initial program 100.0%
Taylor expanded in z around 0 99.8%
+-commutative99.8%
Simplified99.8%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -7e+103) (not (<= z 5.8e+165))) (- 1.0 (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7e+103) || !(z <= 5.8e+165)) {
tmp = 1.0 - (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 <= (-7d+103)) .or. (.not. (z <= 5.8d+165))) then
tmp = 1.0d0 - (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 <= -7e+103) || !(z <= 5.8e+165)) {
tmp = 1.0 - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7e+103) or not (z <= 5.8e+165): tmp = 1.0 - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7e+103) || !(z <= 5.8e+165)) tmp = Float64(1.0 - 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 ((z <= -7e+103) || ~((z <= 5.8e+165))) tmp = 1.0 - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7e+103], N[Not[LessEqual[z, 5.8e+165]], $MachinePrecision]], N[(1.0 - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+103} \lor \neg \left(z \leq 5.8 \cdot 10^{+165}\right):\\
\;\;\;\;1 - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -7e103 or 5.80000000000000011e165 < z Initial program 99.8%
Taylor expanded in x around 0 78.6%
Taylor expanded in y around 0 78.6%
if -7e103 < z < 5.80000000000000011e165Initial program 100.0%
Taylor expanded in z around 0 91.9%
+-commutative91.9%
Simplified91.9%
Final simplification88.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.1e+103) (not (<= z 3e+256))) (* z (- (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.1e+103) || !(z <= 3e+256)) {
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 <= (-3.1d+103)) .or. (.not. (z <= 3d+256))) 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 <= -3.1e+103) || !(z <= 3e+256)) {
tmp = z * -Math.sin(y);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.1e+103) or not (z <= 3e+256): tmp = z * -math.sin(y) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.1e+103) || !(z <= 3e+256)) 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 <= -3.1e+103) || ~((z <= 3e+256))) tmp = z * -sin(y); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.1e+103], N[Not[LessEqual[z, 3e+256]], $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 -3.1 \cdot 10^{+103} \lor \neg \left(z \leq 3 \cdot 10^{+256}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -3.1000000000000002e103 or 3.0000000000000001e256 < z Initial program 99.9%
Taylor expanded in z around inf 75.9%
associate-*r*75.9%
neg-mul-175.9%
*-commutative75.9%
Simplified75.9%
if -3.1000000000000002e103 < z < 3.0000000000000001e256Initial program 99.9%
Taylor expanded in z around 0 89.5%
+-commutative89.5%
Simplified89.5%
Final simplification86.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -62000000000.0) (not (<= y 0.118))) (+ x (cos y)) (+ 1.0 (+ x (* y (- (* y (* 0.16666666666666666 (* y z))) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -62000000000.0) || !(y <= 0.118)) {
tmp = x + cos(y);
} 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 <= (-62000000000.0d0)) .or. (.not. (y <= 0.118d0))) then
tmp = x + cos(y)
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 <= -62000000000.0) || !(y <= 0.118)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -62000000000.0) or not (y <= 0.118): tmp = x + math.cos(y) else: tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -62000000000.0) || !(y <= 0.118)) tmp = Float64(x + cos(y)); 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 <= -62000000000.0) || ~((y <= 0.118))) tmp = x + cos(y); 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, -62000000000.0], N[Not[LessEqual[y, 0.118]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $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 -62000000000 \lor \neg \left(y \leq 0.118\right):\\
\;\;\;\;x + \cos y\\
\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 < -6.2e10 or 0.11799999999999999 < y Initial program 99.9%
Taylor expanded in z around 0 67.5%
+-commutative67.5%
Simplified67.5%
if -6.2e10 < y < 0.11799999999999999Initial program 100.0%
Taylor expanded in y around 0 99.6%
Taylor expanded in y around inf 99.6%
Final simplification83.8%
(FPCore (x y z) :precision binary64 (if (<= x -1.85e-7) (+ x 1.0) (if (<= x 4e-75) (cos y) (+ 1.0 (- x (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.85e-7) {
tmp = x + 1.0;
} else if (x <= 4e-75) {
tmp = cos(y);
} 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 (x <= (-1.85d-7)) then
tmp = x + 1.0d0
else if (x <= 4d-75) then
tmp = cos(y)
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 (x <= -1.85e-7) {
tmp = x + 1.0;
} else if (x <= 4e-75) {
tmp = Math.cos(y);
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.85e-7: tmp = x + 1.0 elif x <= 4e-75: tmp = math.cos(y) else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.85e-7) tmp = Float64(x + 1.0); elseif (x <= 4e-75) tmp = cos(y); 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 (x <= -1.85e-7) tmp = x + 1.0; elseif (x <= 4e-75) tmp = cos(y); else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.85e-7], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 4e-75], N[Cos[y], $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{-7}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-75}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if x < -1.85000000000000002e-7Initial program 99.9%
Taylor expanded in y around 0 84.0%
+-commutative84.0%
Simplified84.0%
if -1.85000000000000002e-7 < x < 3.9999999999999998e-75Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 66.7%
if 3.9999999999999998e-75 < x Initial program 100.0%
Taylor expanded in y around 0 78.6%
mul-1-neg78.6%
unsub-neg78.6%
Simplified78.6%
(FPCore (x y z)
:precision binary64
(if (<= y -4.4e+17)
(* x (+ 1.0 (/ 1.0 x)))
(if (<= y 5.0)
(+ 1.0 (+ x (* y (- (* y (* 0.16666666666666666 (* y z))) z))))
(+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e+17) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 5.0) {
tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - 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 <= (-4.4d+17)) then
tmp = x * (1.0d0 + (1.0d0 / x))
else if (y <= 5.0d0) then
tmp = 1.0d0 + (x + (y * ((y * (0.16666666666666666d0 * (y * z))) - 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 <= -4.4e+17) {
tmp = x * (1.0 + (1.0 / x));
} else if (y <= 5.0) {
tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z)));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.4e+17: tmp = x * (1.0 + (1.0 / x)) elif y <= 5.0: tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z))) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.4e+17) tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); elseif (y <= 5.0) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(0.16666666666666666 * Float64(y * z))) - z)))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.4e+17) tmp = x * (1.0 + (1.0 / x)); elseif (y <= 5.0) tmp = 1.0 + (x + (y * ((y * (0.16666666666666666 * (y * z))) - z))); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.4e+17], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.0], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(0.16666666666666666 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+17}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\mathbf{elif}\;y \leq 5:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(0.16666666666666666 \cdot \left(y \cdot z\right)\right) - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -4.4e17Initial program 99.8%
log1p-expm1-u99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 82.1%
associate--l+82.1%
div-sub82.1%
*-commutative82.1%
Simplified82.1%
Taylor expanded in y around 0 43.3%
if -4.4e17 < y < 5Initial program 100.0%
Taylor expanded in y around 0 98.2%
Taylor expanded in y around inf 98.3%
if 5 < y Initial program 99.9%
Taylor expanded in y around 0 41.3%
+-commutative41.3%
Simplified41.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.6e+53) (not (<= y 290000000000.0))) (+ x 1.0) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.6e+53) || !(y <= 290000000000.0)) {
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 <= (-1.6d+53)) .or. (.not. (y <= 290000000000.0d0))) 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 <= -1.6e+53) || !(y <= 290000000000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.6e+53) or not (y <= 290000000000.0): tmp = x + 1.0 else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.6e+53) || !(y <= 290000000000.0)) 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 <= -1.6e+53) || ~((y <= 290000000000.0))) tmp = x + 1.0; else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.6e+53], N[Not[LessEqual[y, 290000000000.0]], $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.6 \cdot 10^{+53} \lor \neg \left(y \leq 290000000000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -1.6e53 or 2.9e11 < y Initial program 99.9%
Taylor expanded in y around 0 41.6%
+-commutative41.6%
Simplified41.6%
if -1.6e53 < y < 2.9e11Initial program 100.0%
Taylor expanded in y around 0 95.4%
mul-1-neg95.4%
unsub-neg95.4%
Simplified95.4%
Final simplification71.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.8e-117) (not (<= x 1.45e-24))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.8e-117) || !(x <= 1.45e-24)) {
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.8d-117)) .or. (.not. (x <= 1.45d-24))) 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.8e-117) || !(x <= 1.45e-24)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.8e-117) or not (x <= 1.45e-24): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.8e-117) || !(x <= 1.45e-24)) 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.8e-117) || ~((x <= 1.45e-24))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.8e-117], N[Not[LessEqual[x, 1.45e-24]], $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.8 \cdot 10^{-117} \lor \neg \left(x \leq 1.45 \cdot 10^{-24}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -3.79999999999999972e-117 or 1.4499999999999999e-24 < x Initial program 100.0%
Taylor expanded in y around 0 79.5%
+-commutative79.5%
Simplified79.5%
if -3.79999999999999972e-117 < x < 1.4499999999999999e-24Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 54.2%
mul-1-neg54.2%
unsub-neg54.2%
Simplified54.2%
Final simplification68.9%
(FPCore (x y z) :precision binary64 (if (<= x -0.98) x (if (<= x 1200000000.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.98) {
tmp = x;
} else if (x <= 1200000000.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.98d0)) then
tmp = x
else if (x <= 1200000000.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.98) {
tmp = x;
} else if (x <= 1200000000.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.98: tmp = x elif x <= 1200000000.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.98) tmp = x; elseif (x <= 1200000000.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.98) tmp = x; elseif (x <= 1200000000.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.98], x, If[LessEqual[x, 1200000000.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.98:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1200000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.97999999999999998 or 1.2e9 < x Initial program 100.0%
Taylor expanded in x around inf 83.2%
if -0.97999999999999998 < x < 1.2e9Initial program 99.9%
Taylor expanded in x around 0 99.0%
Taylor expanded in y around 0 41.9%
(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 62.2%
+-commutative62.2%
Simplified62.2%
(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.0%
Taylor expanded in y around 0 23.3%
herbie shell --seed 2024118
(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))))