chiark / gitweb /
windows: update xml docs for C#
authorRichard Kettlewell <rjk@terraraq.org.uk>
Sat, 22 Dec 2012 17:14:36 +0000 (17:14 +0000)
committerRichard Kettlewell <rjk@terraraq.org.uk>
Sat, 22 Dec 2012 17:14:36 +0000 (17:14 +0000)
windows/mandycs/Fixed128.cs
windows/mandycs/mandycs.csproj

index 251e075..83b27ec 100644 (file)
@@ -27,9 +27,24 @@ namespace uk.org.greenend.mandy
   /// </summary>
   public enum Precision
   {
+    /// <summary>
+    /// Perform calculations using C "double" type
+    /// </summary>
     Double,
+
+    /// <summary>
+    /// Perform calculations using C "long double" type
+    /// </summary>
     LongDouble,
+
+    /// <summary>
+    /// Perform calculations using 64-bit fixed point
+    /// </summary>
     Fixed64,
+
+    /// <summary>
+    /// Perform calculations using 128-bit fixed point
+    /// </summary>
     Fixed128,
   };
 
@@ -73,6 +88,12 @@ namespace uk.org.greenend.mandy
       return new Fixed128(n, 0, 0, 0);
     }
 
+    /// <summary>
+    /// Convert string to fixed-point
+    /// </summary>
+    /// <param name="s">String containing decimal value to convert</param>
+    /// <returns>Value</returns>
+    /// <exception cref="FormatException">Thrown if the value is out of range or malformed.</exception>
     public static implicit operator Fixed128(string s)
     {
       Fixed128 r = 0;
@@ -89,6 +110,11 @@ namespace uk.org.greenend.mandy
       return r;
     }
 
+    /// <summary>
+    /// Convert fixed-point to string
+    /// </summary>
+    /// <param name="n">Value to convert</param>
+    /// <returns>String containing decimal equivalent of value</returns>
     public unsafe static implicit operator string(Fixed128 n)
     {
       const int BUFSIZE = 256;
@@ -97,11 +123,21 @@ namespace uk.org.greenend.mandy
       return Marshal.PtrToStringAnsi((IntPtr)buffer);
     }
 
+    /// <summary>
+    /// Convert fixed-point to double
+    /// </summary>
+    /// <param name="n">Value to convert</param>
+    /// <returns>Converted value</returns>
     public static implicit operator double(Fixed128 n)
     {
       return Fixed128_2double(ref n);
     }
 
+    /// <summary>
+    /// Convert double to fixed-point
+    /// </summary>
+    /// <param name="n">Value to convert</param>
+    /// <returns>Converted value</returns>
     public static implicit operator Fixed128(double n)
     {
       Fixed128 r = 0;
@@ -112,7 +148,13 @@ namespace uk.org.greenend.mandy
     #endregion
 
     #region Arithmetic Operations
-
+    
+    /// <summary>
+    /// Add fixed-point values
+    /// </summary>
+    /// <param name="a">First value</param>
+    /// <param name="b">Second value</param>
+    /// <returns><code>a+b</code></returns>
     public static Fixed128 operator +(Fixed128 a, Fixed128 b)
     {
       Fixed128 r = 0;
@@ -120,6 +162,12 @@ namespace uk.org.greenend.mandy
       return r;
     }
 
+    /// <summary>
+    /// Subtract fixed-point values
+    /// </summary>
+    /// <param name="a">First value</param>
+    /// <param name="b">Second value</param>
+    /// <returns><code>a-b</code></returns>
     public static Fixed128 operator -(Fixed128 a, Fixed128 b)
     {
       Fixed128 r = 0;
@@ -127,6 +175,12 @@ namespace uk.org.greenend.mandy
       return r;
     }
 
+    /// <summary>
+    /// Multiply fixed-point values
+    /// </summary>
+    /// <param name="a">First value</param>
+    /// <param name="b">Second value</param>
+    /// <returns><code>a*b</code></returns>
     public static Fixed128 operator *(Fixed128 a, Fixed128 b)
     {
       Fixed128 r = 0;
@@ -134,52 +188,105 @@ namespace uk.org.greenend.mandy
       return r;
     }
 
+    /// <summary>
+    /// Divide fixed-point values
+    /// </summary>
+    /// <param name="a">First value</param>
+    /// <param name="b">Second value</param>
+    /// <returns><code>a/b</code></returns>
     public static Fixed128 operator /(Fixed128 a, Fixed128 b)
     {
+      // TODO division by 0?
       Fixed128 r = 0;
       Fixed128_div(ref r, ref a, ref b);
       return r;
     }
 
-    public static Fixed128 operator-(Fixed128 a)
+    /// <summary>
+    /// Negate fixed-point value
+    /// </summary>
+    /// <param name="a">Value</param>
+    /// <returns><code>-a</code></returns>
+    public static Fixed128 operator -(Fixed128 a)
     {
       Fixed128 r = 0;
       Fixed128_neg(ref r, ref a);
       return r;
     }
 
+    /// <summary>
+    /// Square root fixed-point value
+    /// </summary>
+    /// <returns>Square root of this</returns>
     public Fixed128 sqrt()
     {
+      // TODO negative values
       Fixed128 r = 0;
       Fixed128_sqrt(ref r, ref this);
       return r;
     }
 
+    /// <summary>
+    /// Compare fixed-point values for equality
+    /// </summary>
+    /// <param name="a">First value</param>
+    /// <param name="b">Second value</param>
+    /// <returns>true if <code>a==b</code>, else false</returns>
     public static bool operator ==(Fixed128 a, Fixed128 b)
     {
       return Fixed128_eq(ref a, ref b) != 0;
     }
 
+    /// <summary>
+    /// Compare fixed-point values for inequality
+    /// </summary>
+    /// <param name="a">First value</param>
+    /// <param name="b">Second value</param>
+    /// <returns>true if <code>a!=b</code>, else false</returns>
     public static bool operator !=(Fixed128 a, Fixed128 b)
     {
       return Fixed128_eq(ref a, ref b) == 0;
     }
 
+    /// <summary>
+    /// Compare fixed-point values for order
+    /// </summary>
+    /// <param name="a">First value</param>
+    /// <param name="b">Second value</param>
+    /// <returns>true if <code>a&lt;b</code>, else false</returns>
     public static bool operator <(Fixed128 a, Fixed128 b)
     {
       return Fixed128_lt(ref a, ref b) != 0;
     }
 
+    /// <summary>
+    /// Compare fixed-point values for order
+    /// </summary>
+    /// <param name="a">First value</param>
+    /// <param name="b">Second value</param>
+    /// <returns>true if <code>a&gt;=b</code>, else false</returns>
     public static bool operator >=(Fixed128 a, Fixed128 b)
     {
       return Fixed128_lt(ref a, ref b) == 0;
     }
 
+    /// <summary>
+    /// Compare fixed-point values for order
+    /// </summary>
+    /// <param name="a">First value</param>
+    /// <param name="b">Second value</param>
+    /// <returns>true if <code>a&gt;b</code>, else false</returns>
     public static bool operator >(Fixed128 a, Fixed128 b)
     {
       return Fixed128_lt(ref b, ref a) != 0;
     }
 
+    /// <summary>
+    /// Compare fixed-point values for order
+    /// </summary>
+    /// <param name="a">First value</param>
+    /// <param name="b">Second value</param>
+    /// <returns>true if <code>a&lt;=b</code>, else false</returns>
     public static bool operator <=(Fixed128 a, Fixed128 b)
     {
       return Fixed128_lt(ref b, ref a) == 0;
@@ -189,6 +296,16 @@ namespace uk.org.greenend.mandy
 
     #region Algorithms
 
+    /// <summary>
+    /// Calculate Mandelbrot set iteration
+    /// </summary>
+    /// <param name="zx">Starting real part</param>
+    /// <param name="zy">Starting imaginary part</param>
+    /// <param name="cx">Offset constant real part</param>
+    /// <param name="cy">Offset constant imaginary part</param>
+    /// <param name="maxiters">Maximum number of iterations</param>
+    /// <param name="precision">Precision to use</param>
+    /// <returns>Adjusted iteration count</returns>
     public static double iterate(Fixed128 zx, Fixed128 zy,
                                  Fixed128 cx, Fixed128 cy,
                                  int maxiters, Precision precision)
index 08988ee..f431884 100644 (file)
@@ -22,6 +22,7 @@
     <WarningLevel>4</WarningLevel>
     <PlatformTarget>x64</PlatformTarget>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <DocumentationFile>bin\Debug\mandycs.XML</DocumentationFile>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
@@ -32,6 +33,8 @@
     <WarningLevel>4</WarningLevel>
     <PlatformTarget>x64</PlatformTarget>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+    <DocumentationFile>
+    </DocumentationFile>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />