ALL,
I am trying to convert Borland C++ code to C#.
In the old code I see the following:
double a = RoundTo( b, -2 );
Looking at Borland documentation I see that RoundTo() accept both positive and negative parameters for precision. Positive means round to 10^n, negative - to 10^-n.
Looking at the C# documentation of Math.RoundTo() I can't find a reference whether it will accept negative numbers for precision. And all samples are presented with the positive numbers.
What is the proper way of converting the code in this case? Should I just forget about the sign and write:
double a = Math.Round( b, 2 );
Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…