C#计算连分数

using System;
using System.Collections.Generic;

namespace fraction
{
    class Program
    {
        // 计算连分数
        static Int32[] GetFraction(double f, int n)
        {
            var d = new List();
            if(f <= 0)
            {
                d.Add((int)Math.Floor(f));
                return d.ToArray();
            }

            for(int i=0; i {1}", Math.PI, string.Join(',', a_p));
            Console.WriteLine("E ={0} ==> {1}", Math.E, string.Join(',', a_e));
        }
    }
}

/*
PI=3.14159265358979 ==> 3,7,16
E =2.71828182845905 ==> 2,1,2,2 
*/

 

你可能感兴趣的:(算法,知识库,连分数,c#,Math.PI,Math.E)