コード例 #1
0
        //! implements the conversion between swap dates and swap (time) length
        public double swapLength(Date start, Date end)
        {
            Utils.QL_REQUIRE(end > start, () => "swap end date (" + end + ") must be greater than start (" + start + ")");
            double result = (end - start) / 365.25 * 12.0; // month unit

            result  = new ClosestRounding(0).Round(result);
            result /= 12.0; // year unit
            return(result);
        }
コード例 #2
0
ファイル: T_Rounding.cs プロジェクト: igitur/qlnet
 public void testClosest()
 {
     for (int i = 0; i < testData.Length; i++)
     {
         int             precision  = testData[i].precision;
         ClosestRounding closest    = new ClosestRounding(precision);
         double          calculated = closest.Round(testData[i].x);
         double          expected   = testData[i].closest;
         if (!Utils.close(calculated, expected, 1))
         {
             QAssert.Fail("Original number: " + testData[i].x + "Expected: " + expected + "Calculated: " + calculated);
         }
     }
 }
コード例 #3
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ClosestRounding obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
コード例 #4
0
ファイル: ClosestRounding.cs プロジェクト: minikie/test
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ClosestRounding obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }