363 {
364 if (digits < 0 || digits > 6)
365 {
366 throw new ArgumentOutOfRangeException("digits", SR.ArgumentOutOfRange_RoundingDigits_MathF);
367 }
368 if (mode < MidpointRounding.ToEven || mode >
MidpointRounding.ToPositiveInfinity)
369 {
370 throw new ArgumentException(SR.Format(SR.Argument_InvalidEnumValue, mode,
"MidpointRounding"),
"mode");
371 }
372 if (
Abs(x) < 100000000f)
373 {
375 x *= num;
376 switch (mode)
377 {
380 break;
382 {
383 float x2 =
ModF(x, &x);
385 {
386 x += (float)
Sign(x2);
387 }
388 break;
389 }
392 break;
395 break;
398 break;
399 default:
400 throw new ArgumentException(SR.Format(SR.Argument_InvalidEnumValue, mode,
"MidpointRounding"),
"mode");
401 }
402 x /= num;
403 }
404 return x;
405 }
static float Abs(float x)
static unsafe float Truncate(float x)
static unsafe float ModF(float x, float *intptr)
static float Ceiling(float x)
static float Floor(float x)
static readonly float[] roundPower10Single
static float Round(float x)