本文介绍了如何在C#中求解平方计算值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
十进制半径= 0 ;十进制长度= 0 ;
public void SmallRadiusDepthcal( string 半径,字符串长度)
{
if (!decimal.TryParse(半径, out radius))
{
radius = 0 ;
}
if (!decimal.TryParse(Length, out length))
{
length = 0 ;
}
如果(长度!= 0 && ; radius!= 0 )
{
decimal FEED;
decimal Squre;
decimal Dep;
decimal Div = 4 ;
Double Ans;
//
FEED =((长*长) - (半径*) 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;
}
}
但我有运行时错误(对于十进制,值太大或太小。)我可以解决这个问题吗?请帮我 !!!
解决方案
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 !!!
解决方案
这篇关于如何在C#中求解平方计算值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!