
(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 11 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 -340000.0) (not (<= z 5.5e-32))) (- (+ x 1.0) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -340000.0) || !(z <= 5.5e-32)) {
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 <= (-340000.0d0)) .or. (.not. (z <= 5.5d-32))) 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 <= -340000.0) || !(z <= 5.5e-32)) {
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 <= -340000.0) or not (z <= 5.5e-32): 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 <= -340000.0) || !(z <= 5.5e-32)) 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 <= -340000.0) || ~((z <= 5.5e-32))) 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, -340000.0], N[Not[LessEqual[z, 5.5e-32]], $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 -340000 \lor \neg \left(z \leq 5.5 \cdot 10^{-32}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -3.4e5 or 5.50000000000000024e-32 < z Initial program 99.9%
Taylor expanded in y around 0 99.7%
if -3.4e5 < z < 5.50000000000000024e-32Initial program 100.0%
Taylor expanded in z around 0 99.4%
+-commutative99.4%
Simplified99.4%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.6e+38) (not (<= z 1.3e+33))) (- x (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.6e+38) || !(z <= 1.3e+33)) {
tmp = x - (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 <= (-2.6d+38)) .or. (.not. (z <= 1.3d+33))) then
tmp = x - (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 <= -2.6e+38) || !(z <= 1.3e+33)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.6e+38) or not (z <= 1.3e+33): tmp = x - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.6e+38) || !(z <= 1.3e+33)) tmp = Float64(x - 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 <= -2.6e+38) || ~((z <= 1.3e+33))) tmp = x - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.6e+38], N[Not[LessEqual[z, 1.3e+33]], $MachinePrecision]], N[(x - 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 -2.6 \cdot 10^{+38} \lor \neg \left(z \leq 1.3 \cdot 10^{+33}\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2.5999999999999999e38 or 1.2999999999999999e33 < z Initial program 99.9%
Taylor expanded in x around inf 85.7%
Taylor expanded in x around inf 79.2%
Taylor expanded in x around 0 93.4%
neg-mul-193.4%
unsub-neg93.4%
Simplified93.4%
if -2.5999999999999999e38 < z < 1.2999999999999999e33Initial program 100.0%
Taylor expanded in z around 0 97.5%
+-commutative97.5%
Simplified97.5%
Final simplification95.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -5e+88) (not (<= z 1.4e+104))) (* (sin y) (- z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5e+88) || !(z <= 1.4e+104)) {
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 <= (-5d+88)) .or. (.not. (z <= 1.4d+104))) 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 <= -5e+88) || !(z <= 1.4e+104)) {
tmp = Math.sin(y) * -z;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5e+88) or not (z <= 1.4e+104): tmp = math.sin(y) * -z else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5e+88) || !(z <= 1.4e+104)) 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 <= -5e+88) || ~((z <= 1.4e+104))) tmp = sin(y) * -z; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5e+88], N[Not[LessEqual[z, 1.4e+104]], $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 -5 \cdot 10^{+88} \lor \neg \left(z \leq 1.4 \cdot 10^{+104}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -4.99999999999999997e88 or 1.4e104 < z Initial program 99.9%
Taylor expanded in z around inf 64.6%
associate-*r*64.6%
neg-mul-164.6%
*-commutative64.6%
Simplified64.6%
if -4.99999999999999997e88 < z < 1.4e104Initial program 100.0%
Taylor expanded in z around 0 89.6%
+-commutative89.6%
Simplified89.6%
Final simplification81.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.235) (not (<= y 3.9))) (+ 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.235) || !(y <= 3.9)) {
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.235d0)) .or. (.not. (y <= 3.9d0))) 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.235) || !(y <= 3.9)) {
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.235) or not (y <= 3.9): 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.235) || !(y <= 3.9)) 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.235) || ~((y <= 3.9))) 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.235], N[Not[LessEqual[y, 3.9]], $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.235 \lor \neg \left(y \leq 3.9\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.23499999999999999 or 3.89999999999999991 < y Initial program 99.9%
Taylor expanded in z around 0 61.4%
+-commutative61.4%
Simplified61.4%
if -0.23499999999999999 < y < 3.89999999999999991Initial program 100.0%
Taylor expanded in y around 0 99.3%
Final simplification79.3%
(FPCore (x y z)
:precision binary64
(if (<= y -5.5e+41)
(+ x 1.0)
(if (<= y 14000.0)
(+ 1.0 (+ x (* y (- (* y (- (* 0.16666666666666666 (* y z)) 0.5)) z))))
(* x (+ 1.0 (/ 1.0 x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.5e+41) {
tmp = x + 1.0;
} else if (y <= 14000.0) {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
} else {
tmp = x * (1.0 + (1.0 / 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 (y <= (-5.5d+41)) then
tmp = x + 1.0d0
else if (y <= 14000.0d0) then
tmp = 1.0d0 + (x + (y * ((y * ((0.16666666666666666d0 * (y * z)) - 0.5d0)) - z)))
else
tmp = x * (1.0d0 + (1.0d0 / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.5e+41) {
tmp = x + 1.0;
} else if (y <= 14000.0) {
tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z)));
} else {
tmp = x * (1.0 + (1.0 / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.5e+41: tmp = x + 1.0 elif y <= 14000.0: tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))) else: tmp = x * (1.0 + (1.0 / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.5e+41) tmp = Float64(x + 1.0); elseif (y <= 14000.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 * Float64(1.0 + Float64(1.0 / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.5e+41) tmp = x + 1.0; elseif (y <= 14000.0) tmp = 1.0 + (x + (y * ((y * ((0.16666666666666666 * (y * z)) - 0.5)) - z))); else tmp = x * (1.0 + (1.0 / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.5e+41], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 14000.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 * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+41}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 14000:\\
\;\;\;\;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 \cdot \left(1 + \frac{1}{x}\right)\\
\end{array}
\end{array}
if y < -5.5000000000000003e41Initial program 99.8%
Taylor expanded in y around 0 44.9%
+-commutative44.9%
Simplified44.9%
if -5.5000000000000003e41 < y < 14000Initial program 100.0%
Taylor expanded in y around 0 96.5%
if 14000 < y Initial program 99.9%
Taylor expanded in x around inf 84.7%
Taylor expanded in y around 0 37.5%
(FPCore (x y z)
:precision binary64
(if (<= y -2.8e+27)
(+ x 1.0)
(if (<= y 0.96)
(+ 1.0 (+ x (* y (- (* y -0.5) z))))
(* x (+ 1.0 (/ 1.0 x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.8e+27) {
tmp = x + 1.0;
} else if (y <= 0.96) {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
} else {
tmp = x * (1.0 + (1.0 / 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 (y <= (-2.8d+27)) then
tmp = x + 1.0d0
else if (y <= 0.96d0) then
tmp = 1.0d0 + (x + (y * ((y * (-0.5d0)) - z)))
else
tmp = x * (1.0d0 + (1.0d0 / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.8e+27) {
tmp = x + 1.0;
} else if (y <= 0.96) {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
} else {
tmp = x * (1.0 + (1.0 / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.8e+27: tmp = x + 1.0 elif y <= 0.96: tmp = 1.0 + (x + (y * ((y * -0.5) - z))) else: tmp = x * (1.0 + (1.0 / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.8e+27) tmp = Float64(x + 1.0); elseif (y <= 0.96) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * -0.5) - z)))); else tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.8e+27) tmp = x + 1.0; elseif (y <= 0.96) tmp = 1.0 + (x + (y * ((y * -0.5) - z))); else tmp = x * (1.0 + (1.0 / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.8e+27], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 0.96], N[(1.0 + N[(x + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+27}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 0.96:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\end{array}
\end{array}
if y < -2.7999999999999999e27Initial program 99.8%
Taylor expanded in y around 0 45.1%
+-commutative45.1%
Simplified45.1%
if -2.7999999999999999e27 < y < 0.95999999999999996Initial program 100.0%
Taylor expanded in y around 0 97.6%
if 0.95999999999999996 < y Initial program 99.9%
Taylor expanded in x around inf 85.1%
Taylor expanded in y around 0 37.8%
Final simplification68.5%
(FPCore (x y z) :precision binary64 (if (<= y -4e+27) (+ x 1.0) (if (<= y 0.96) (- (+ x 1.0) (* y z)) (* x (+ 1.0 (/ 1.0 x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4e+27) {
tmp = x + 1.0;
} else if (y <= 0.96) {
tmp = (x + 1.0) - (y * z);
} else {
tmp = x * (1.0 + (1.0 / 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 (y <= (-4d+27)) then
tmp = x + 1.0d0
else if (y <= 0.96d0) then
tmp = (x + 1.0d0) - (y * z)
else
tmp = x * (1.0d0 + (1.0d0 / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4e+27) {
tmp = x + 1.0;
} else if (y <= 0.96) {
tmp = (x + 1.0) - (y * z);
} else {
tmp = x * (1.0 + (1.0 / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4e+27: tmp = x + 1.0 elif y <= 0.96: tmp = (x + 1.0) - (y * z) else: tmp = x * (1.0 + (1.0 / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4e+27) tmp = Float64(x + 1.0); elseif (y <= 0.96) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); else tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4e+27) tmp = x + 1.0; elseif (y <= 0.96) tmp = (x + 1.0) - (y * z); else tmp = x * (1.0 + (1.0 / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4e+27], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 0.96], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+27}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 0.96:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\end{array}
\end{array}
if y < -4.0000000000000001e27Initial program 99.8%
Taylor expanded in y around 0 45.1%
+-commutative45.1%
Simplified45.1%
if -4.0000000000000001e27 < y < 0.95999999999999996Initial program 100.0%
Taylor expanded in y around 0 97.4%
associate-+r+97.4%
mul-1-neg97.4%
unsub-neg97.4%
+-commutative97.4%
Simplified97.4%
if 0.95999999999999996 < y Initial program 99.9%
Taylor expanded in x around inf 85.1%
Taylor expanded in y around 0 37.8%
(FPCore (x y z) :precision binary64 (if (<= x -1.1e-17) x (if (<= x 0.035) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.1e-17) {
tmp = x;
} else if (x <= 0.035) {
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.1d-17)) then
tmp = x
else if (x <= 0.035d0) 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.1e-17) {
tmp = x;
} else if (x <= 0.035) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.1e-17: tmp = x elif x <= 0.035: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.1e-17) tmp = x; elseif (x <= 0.035) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.1e-17) tmp = x; elseif (x <= 0.035) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.1e-17], x, If[LessEqual[x, 0.035], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-17}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.035:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.1e-17 or 0.035000000000000003 < x Initial program 99.9%
Taylor expanded in x around inf 73.8%
if -1.1e-17 < x < 0.035000000000000003Initial program 99.9%
Taylor expanded in z around -inf 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
distribute-lft-out--99.7%
mul-1-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 41.8%
+-commutative41.8%
Simplified41.8%
Taylor expanded in x 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 60.5%
+-commutative60.5%
Simplified60.5%
(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 z around -inf 89.9%
mul-1-neg89.9%
distribute-rgt-neg-in89.9%
distribute-lft-out--89.9%
mul-1-neg89.9%
remove-double-neg89.9%
+-commutative89.9%
Simplified89.9%
Taylor expanded in y around 0 50.6%
+-commutative50.6%
Simplified50.6%
Taylor expanded in x around 0 20.4%
herbie shell --seed 2024111
(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))))