Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
Decimal radius=0;Decimal length=0;
        public void SmallRadiusDepthcal(string Radius, string Length)
        {
            if (!decimal.TryParse(Radius, out radius))
            {
                radius = 0;
            }
            if (!decimal.TryParse(Length, out length))
            {
                length = 0;
            }

            if (length != 0 && radius != 0)
            {
                decimal FEED;
                decimal Squre;
                decimal Dep;
                decimal Div = 4;
                Double Ans;
                // 
                FEED = ((length * length) - (radius * radius) / Div);
                Ans = Math.Sqrt((double)FEED);
                Squre = (decimal)Ans;
                Dep = radius - Squre;
                FPM = Math.Round(Dep, 2).ToString();
                //=I26-SQRT((I26*I26)-(G27*G27/4))//
            }
            else
            {
                FPM = "0.0000";
            }

        }
But I have Run Time Error (Value was either too large or too small for a Decimal.) How Can I solve This Problem. Please Help Me !!!
Posted
Comments
Sergey Alexandrovich Kryukov 19-Sep-14 12:25pm    
That was exception. Do you see the difference? In what line?
—SA

1 solution

Use double instead:

decimal[^]
double[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900