コード例 #1
0
ファイル: IterationTest.cs プロジェクト: ewxrjk/mandy
 public void IterateTest()
 {
     Fixed128 zx = 0, zy = 0;
       Fixed128 cx = new Fixed128(0, 0xa6aaaaaau, 0xaaaaaaaau, 0xaaaaaaabu);
       Fixed128 cy = new Fixed128(-1, 0xfd555555u, 0x55555555u, 0x55555555u);
       Assert.AreEqual("0.651041666666666666666666666670873924827845396295529219014841526558257100987248122692108154296875",
               (string)cx);
       Assert.AreEqual("-0.010416666666666666666666666670873924827845396295529219014841526558257100987248122692108154296875",
               (string)cy);
       double count = Fixed128.iterate(zx, zy, cx, cy, 255, Precision.Double);
       double expected = 1 + 5 - Math.Log(Math.Log(255.08471462316811, 2), 2);
       Assert.AreEqual(count, expected);
       count = Fixed128.iterate(zx, zy, cx, cy, 255, Precision.LongDouble);
       Assert.AreEqual(count, expected);
       count = Fixed128.iterate(zx, zy, cx, cy, 255, Precision.Fixed64);
       Assert.AreEqual(count, expected);
       count = Fixed128.iterate(zx, zy, cx, cy, 255, Precision.Fixed128);
       Assert.AreEqual(count, expected);
 }
コード例 #2
0
ファイル: Fixed128.cs プロジェクト: ewxrjk/mandy
 private static extern double iterate_cs(ref Fixed128 zx, ref Fixed128 zy,
                                     ref Fixed128 cx, ref Fixed128 cy,
                                     int maxiters, int arith);
コード例 #3
0
ファイル: Fixed128.cs プロジェクト: ewxrjk/mandy
 private static extern void Fixed128_sub(ref Fixed128 r,
                                     ref Fixed128 a,
                                     ref Fixed128 b);
コード例 #4
0
ファイル: Fixed128.cs プロジェクト: ewxrjk/mandy
 private static extern int Fixed128_str2_cs(ref Fixed128 r, string s);
コード例 #5
0
ファイル: Fixed128.cs プロジェクト: ewxrjk/mandy
 private static extern void Fixed128_sqrt(ref Fixed128 r,
                                      ref Fixed128 a);
コード例 #6
0
ファイル: Fixed128.cs プロジェクト: ewxrjk/mandy
 private static extern void Fixed128_neg(ref Fixed128 r,
                                     ref Fixed128 a);
コード例 #7
0
ファイル: Fixed128.cs プロジェクト: ewxrjk/mandy
 private static extern int Fixed128_lt(ref Fixed128 r,
                                   ref Fixed128 a);
コード例 #8
0
ファイル: Fixed128.cs プロジェクト: ewxrjk/mandy
 private static extern void Fixed128_double2(ref Fixed128 r, double n);
コード例 #9
0
ファイル: Fixed128.cs プロジェクト: ewxrjk/mandy
 private static unsafe extern IntPtr Fixed128_2str(byte* buffer, IntPtr bufsize,
                                               ref Fixed128 a, int radix);
コード例 #10
0
ファイル: Fixed128.cs プロジェクト: ewxrjk/mandy
 private static extern double Fixed128_2double(ref Fixed128 a);
コード例 #11
0
ファイル: Fixed128.cs プロジェクト: ewxrjk/mandy
 /// <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)
 {
     return iterate_cs(ref zx, ref zy, ref cx, ref cy, maxiters, (int)precision);
 }
コード例 #12
0
ファイル: Fixed128Test.cs プロジェクト: ewxrjk/mandy
 public void ToDoubleTest()
 {
     Fixed128 a = new Fixed128(1, 0x80000000u, 0u, 0u);
       double n = a;
       Assert.AreEqual(1.5, n);
       a = new Fixed128(-101, 0xE0000000u, 0u, 0u);
       n = a;
       Assert.AreEqual(-100.125, n);
 }