200 references to Round
Aspire.Dashboard (1)
Utils\ValueExtensions.cs (1)
23i = (int)Math.Round(value.NumberValue);
dotnet-svcutil-lib (1)
FrameworkFork\Microsoft.Xml\Xml\XmlConvert.cs (1)
1271double temp = Math.Round(value);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (1)
HeartbeatTests.cs (1)
87var roundedActualMs = Math.Round(actualMs / 50.0) * 50.0;
Microsoft.CodeAnalysis.Workspaces (1)
Shared\Utilities\BloomFilter.cs (1)
94return unchecked((int)Math.Round(temp));
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (9)
Linux\AcceptanceTest.cs (6)
354Assert.Equal(roundedCpuUsedPercentage, Math.Round(cpuRequestFromGauge * 100)); 356Assert.Equal(roundedCpuUsedPercentage, Math.Round(cpuFromGauge * 100)); 432Assert.Equal(0, Math.Round(cpuLimitFromGauge * 100)); 433Assert.Equal(0, Math.Round(cpuRequestFromGauge * 100)); 512Assert.Equal(42, Math.Round(cpuLimitFromGauge * 100)); 513Assert.Equal(83, Math.Round(cpuRequestFromGauge * 100));
Linux\LinuxUtilizationParserCgroupV2Tests.cs (2)
315var r = Math.Round(p.GetCgroupRequestCpuV2()); 534var r = Math.Round(p.GetCgroupRequestCpu());
Windows\WindowsSnapshotProviderTests.cs (1)
162Assert.Equal(1 * multiplier, Math.Round(metricCollector.LastMeasurement.Value)); // Consuming 100% of the memory
Microsoft.Maui.Controls (4)
DisplayInfoExtensions.cs (1)
19 Math.Round(value);
Internals\ProfilePage.cs (1)
83 var percentage = (int)Math.Round(ticksMs / (double)profiledMs * 100);
LegacyLayouts\AbsoluteLayout.cs (2)
285 result.X = Math.Round((region.Width - result.Width) * bounds.X); 294 result.Y = Math.Round((region.Height - result.Height) * bounds.Y);
Microsoft.Maui.Graphics (6)
Point.cs (2)
80 return new Point((double)Math.Round(X), (double)Math.Round(Y));
Rect.cs (4)
209 return new Rect(Math.Round(X), Math.Round(Y), Math.Round(Width), Math.Round(Height));
Microsoft.Maui.Resizetizer (2)
SkiaSharpTools.cs (2)
266 (int)Math.Round(scaledWidth), 267 (int)Math.Round(scaledHeight));
Microsoft.ML.Data (1)
Utilities\TimerScope.cs (1)
45elapsedSeconds = Math.Round(elapsedSeconds);
Microsoft.ML.ImageAnalytics (4)
VectorToImageTransform.cs (4)
410imageData[ix++] = (byte)Math.Round(blue * scale - offset); 411imageData[ix++] = (byte)Math.Round(green * scale - offset); 412imageData[ix++] = (byte)Math.Round(red * scale - offset); 413imageData[ix++] = (byte)(ex.Alpha ? Math.Round(alpha * scale - offset) : 0);
Microsoft.ML.Transforms (2)
Expression\BuiltinFunctions.cs (2)
277FunctionProviderUtils.Fn<R8, R8>(Math.Round)); 703return (R4)Math.Round(a);
PresentationCore (54)
MS\Internal\Shaping\CompositeFontFamily.cs (2)
117return Math.Round(_fontInfo.Baseline * emSize); 148return Math.Round(_fontInfo.LineSpacing * emSize);
MS\Internal\TextFormatting\LineServicesCallbacks.cs (8)
425lstTextMetrics.dvAscent = (int)Math.Round(typeface.Baseline(store.Pap.EmSize, Constants.DefaultIdealToReal, store.Settings.TextSource.PixelsPerDip, fullText.TextFormattingMode)); 426lstTextMetrics.dvMultiLineHeight = (int)Math.Round(typeface.LineSpacing(store.Pap.EmSize, Constants.DefaultIdealToReal, store.Settings.TextSource.PixelsPerDip, fullText.TextFormattingMode)); 686ulInfo.dvpFirstUnderlineOffset = (int)Math.Round(lsrun.EmSize * -underlinePositionInEm); 687ulInfo.dvpFirstUnderlineSize = (int)Math.Round(lsrun.EmSize * underlineThicknessInEm); 740stInfo.dvpLowerStrikethroughOffset = (int)Math.Round(lsrun.EmSize * strikeThroughPositionInEm); 741stInfo.dvpLowerStrikethroughSize = (int)Math.Round(lsrun.EmSize * strikeThroughThicknessInEm); 935int baselineTop = ptOrigin.y + (int)Math.Round(lsrun.EmSize * strikeThroughPositionInEm); 936int overlineTop = baselineTop - (lsrun.BaselineOffset - (int)Math.Round(lsrun.EmSize * strikeThroughThicknessInEm));
MS\Internal\TextFormatting\LineServicesRun.cs (2)
57(shapeable != null ? (int)Math.Round(shapeable.Baseline * realToIdeal) : 0), 58(shapeable != null ? (int)Math.Round(shapeable.Height * realToIdeal) : 0),
MS\Internal\TextFormatting\SimpleTextLine.cs (3)
325_height = formatter.IdealToReal((int)Math.Round(pap.DefaultTypeface.LineSpacing(pap.EmSize, Constants.DefaultIdealToReal, PixelsPerDip, _settings.TextFormattingMode)), PixelsPerDip); 326_baselineOffset = formatter.IdealToReal((int)Math.Round(pap.DefaultTypeface.Baseline(pap.EmSize, Constants.DefaultIdealToReal, PixelsPerDip, _settings.TextFormattingMode)), PixelsPerDip); 360_idealOffsetUnRounded = (int)Math.Round((paragraphWidth - idealWidthAtTrailing) * 0.5);
MS\Internal\TextFormatting\TextFormatterImp.cs (1)
702int value = (int)Math.Round(i * ToIdeal);
MS\Internal\TextFormatting\TextMetrics.cs (4)
189_baselineOffset = (int)Math.Round( 200_textAscent = (int)Math.Round(pap.DefaultTypeface.Baseline(pap.EmSize, Constants.DefaultIdealToReal, _pixelsPerDip, fullText.TextFormattingMode)); 201_textHeight = (int)Math.Round(pap.DefaultTypeface.LineSpacing(pap.EmSize, Constants.DefaultIdealToReal, _pixelsPerDip, fullText.TextFormattingMode)); 252_paragraphToText = (int)Math.Round((paragraphWidth + _textStart - _textWidthAtTrailing) * 0.5);
MS\Internal\TextFormatting\TextProperties.cs (1)
387return (int)Math.Round(properties.FontRenderingEmSize * 0.75 * _textRunLength * realToIdeal);
MS\Internal\TextFormatting\TextRunCacheImp.cs (1)
188looseCharLength = (int)Math.Round(TextStore.TypicalCharactersPerLine * 0.25);
MS\Internal\TextFormatting\TextStore.cs (2)
1563(int)Math.Round(realToIdeal * runInfo.TextRun.Properties.FontRenderingEmSize), 1718(int)Math.Round(realToIdeal * runInfo.TextRun.Properties.FontRenderingEmSize),
MS\Internal\TextFormatting\ThousandthOfEmRealDoubles.cs (1)
271thousandthOfEm = (short) Math.Round(scaled);
System\Windows\Input\Stylus\Common\StylusPointCollection.cs (4)
524output[x] = (int)Math.Round(stylusPoint.X * StrokeCollectionSerializer.AvalonToHimetricMultiplier); 525output[x + 1] = (int)Math.Round(stylusPoint.Y * StrokeCollectionSerializer.AvalonToHimetricMultiplier); 593output[0][b] = (int)Math.Round(stylusPoint.X * StrokeCollectionSerializer.AvalonToHimetricMultiplier); 594output[1][b] = (int)Math.Round(stylusPoint.Y * StrokeCollectionSerializer.AvalonToHimetricMultiplier);
System\Windows\Input\Stylus\Pointer\PointerLogic.cs (4)
478return new Point(Math.Round(pt.X), Math.Round(pt.Y)); 494return new Point(Math.Round(pt.X), Math.Round(pt.Y));
System\Windows\Input\Stylus\Pointer\PointerStylusPlugInManager.cs (2)
163ptTablet.X = (int)Math.Round(ptTablet.X); // Make sure we snap to whole window pixels. 164ptTablet.Y = (int)Math.Round(ptTablet.Y);
System\Windows\Input\Stylus\Pointer\PointerTabletDevice.cs (2)
133_doubleTapSize = new Size((int)Math.Round((ScreenSize.Width * DoubleTapDelta) / dwXValue), 134(int)Math.Round((ScreenSize.Height *DoubleTapDelta) / dwYValue));
System\Windows\Input\Stylus\Wisp\PenContexts.cs (2)
489ptTablet.X = (int)Math.Round(ptTablet.X); // Make sure we snap to whole window pixels. 490ptTablet.Y = (int)Math.Round(ptTablet.Y);
System\Windows\Input\Stylus\Wisp\WispLogic.cs (2)
3606pt.X = (int)Math.Round(pt.X); // Make sure we return whole numbers (pixels are whole numbers) 3607pt.Y = (int)Math.Round(pt.Y);
System\Windows\Input\Stylus\Wisp\WispTabletDevice.cs (4)
284_cancelSize = new Size((int)Math.Round((ScreenSize.Width * stylusLogic.CancelDelta) / dwXValue), 285(int)Math.Round((ScreenSize.Height * stylusLogic.CancelDelta) / dwYValue)); 292_doubleTapSize = new Size((int)Math.Round((ScreenSize.Width * stylusLogic.DoubleTapDelta) / dwXValue), 293(int)Math.Round((ScreenSize.Height * stylusLogic.DoubleTapDelta) / dwYValue));
System\Windows\InterOp\HwndPointerInputProvider.cs (2)
326originOffsetX = (int)Math.Round(originTabletCoord.X); 327originOffsetY = (int)Math.Round(originTabletCoord.Y);
System\Windows\Media\GlyphsSerializer.cs (4)
178int roundedShapingAdvance = (int)Math.Round(_idealAdvanceTotal + shapingAdvance - _currentAdvanceTotal); 179int roundedFontAdvance = (int)Math.Round(fontAdvance); 200int offset = (int)Math.Round(_offsets[glyph].X * _milToEm); 208offset = (int)Math.Round(_offsets[glyph].Y * _milToEm);
System\Windows\Media\GlyphTypeface.cs (1)
1359int missingGlyphWidth = (int)Math.Round(TextFormatterImp.RoundDip(emSize * GetAdvanceWidth(0, pixelsPerDip, textFormattingMode, isSideways), pixelsPerDip, textFormattingMode) * scalingFactor);
System\Windows\UIElement.cs (2)
1086newValue = Math.Round(value * dpiScale) / dpiScale; 1097newValue = Math.Round(value);
PresentationFramework (16)
Microsoft\Win32\CommonDialog.cs (2)
294(int)Math.Round(x), 295(int)Math.Round(y), // new X and Y positions
MS\Internal\Ink\PenCursorManager.cs (2)
214int xHotspot = (int)Math.Round(hotspot.X - drawingBounds.Left); 215int yHotspot = (int)Math.Round(hotspot.Y - drawingBounds.Top);
MS\Internal\Text\TextDpi.cs (1)
50return (int)Math.Round(d * _scale);
System\Windows\Controls\GridSplitter.cs (2)
655horizontalChange = Math.Round(horizontalChange / dragIncrement) * dragIncrement; 656verticalChange = Math.Round(verticalChange / dragIncrement) * dragIncrement;
System\Windows\Controls\PopupControlService.cs (2)
1611Debug.Assert(((int)pt.X == (int)Math.Round(pt2.X)) && ((int)pt.Y == (int)Math.Round(pt2.Y)), "got incorrect mouse point");
System\Windows\Controls\ScrollViewer.cs (2)
1818Math.Round(PanningRatio * cumulativeTranslation / _panningInfo.DeltaPerHorizontalOffet)); 1828Math.Round(PanningRatio * cumulativeTranslation / _panningInfo.DeltaPerVerticalOffset));
System\Windows\Controls\Slider.cs (2)
1184previous = Minimum + (Math.Round(((value - Minimum) / TickFrequency)) * TickFrequency); 1243double tickNumber = Math.Round((value - Minimum) / TickFrequency);
System\Windows\Controls\VirtualizingStackPanel.cs (2)
7559uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes); 7795uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes);
System\Windows\Documents\XamlToRtfWriter.cs (1)
2891formatState.FontSize = (long)Math.Round(fs);
ReachFramework (5)
AlphaFlattener\DrawingContext.cs (2)
603int width = (int) Math.Round(bounds.Width * Configuration.RasterizationDPI / 96); 604int height = (int) Math.Round(bounds.Height * Configuration.RasterizationDPI / 96);
AlphaFlattener\Optimizer.cs (2)
46int width = (int)Math.Round(m_bounds.Width * Configuration.RasterizationDPI / 96); 47int height = (int)Math.Round(m_bounds.Height * Configuration.RasterizationDPI / 96);
AlphaFlattener\Utility.cs (1)
149double s = Math.Round(scale);
System.Data.Common (1)
System\Data\Common\TimeSpanStorage.cs (1)
129ulong stDev = (ulong)Math.Round(Math.Sqrt(varSum / (count - 1)));
System.Drawing.Primitives (8)
System\Drawing\Point.cs (2)
133public static Point Round(PointF value) => new Point(unchecked((int)Math.Round(value.X)), unchecked((int)Math.Round(value.Y)));
System\Drawing\Rectangle.cs (4)
212(int)Math.Round(value.X), 213(int)Math.Round(value.Y), 214(int)Math.Round(value.Width), 215(int)Math.Round(value.Height));
System\Drawing\Size.cs (2)
174new Size(unchecked((int)Math.Round(value.Width)), unchecked((int)Math.Round(value.Height)));
System.Net.Ping (1)
src\libraries\Common\src\System\Net\NetworkInformation\UnixCommandLinePing.cs (1)
217return (long)Math.Round(parsedRtt);
System.Net.Sockets (1)
System\Net\Sockets\SocketAsyncEngine.Unix.cs (1)
58return Math.Max(1, (int)Math.Round(Environment.ProcessorCount / (double)coresPerEngine));
System.Private.CoreLib (14)
src\libraries\System.Private.CoreLib\src\System\Convert.cs (2)
1305return checked((long)Math.Round(value)); 1422return checked((ulong)Math.Round(value));
src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (2)
1626mant = (uint)(int)Math.Round(dbl); 1786mant = (ulong)(long)Math.Round(dbl);
src\libraries\System.Private.CoreLib\src\System\Double.cs (1)
683public static double Round(double x) => Math.Round(x);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeParse.cs (4)
2697if (!time.TryAddTicks((long)Math.Round(raw.fraction * TimeSpan.TicksPerSecond), out time)) 3058if (!time.TryAddTicks((long)Math.Round(partSecond * TimeSpan.TicksPerSecond), out time)) 4761if (!result.parsedDate.TryAddTicks((long)Math.Round(result.fraction * TimeSpan.TicksPerSecond), out result.parsedDate)) 5106if (!dateTime.TryAddTicks((long)Math.Round(fraction * TimeSpan.TicksPerSecond), out result.parsedDate))
src\libraries\System.Private.CoreLib\src\System\Math.cs (2)
865double roundedResult = Round(divisionResult); 1385return Round(value);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Scalar.cs (1)
1267return (T)(object)Math.Round((double)(object)value);
src\libraries\System.Private.CoreLib\src\System\TimeSpan.cs (2)
923double ticks = Math.Round(timeSpan.Ticks * factor); 938double ticks = Math.Round(timeSpan.Ticks / divisor);
System.Private.Xml (3)
System\Xml\XmlConvert.cs (1)
1105double temp = Math.Round(value);
System\Xml\Xsl\Runtime\XslNumber.cs (1)
308Debug.Assert(val >= 0 && val == Math.Round(val), "ConvertToArabic operates on non-negative integer numbers only");
System\Xml\Xsl\Runtime\XsltFunctions.cs (1)
209double temp = Math.Round(value);
System.Windows.Forms (43)
System\Windows\Forms\Control.cs (18)
5293sx = (int)Math.Round(bounds.X * dx); 5298sy = (int)Math.Round(bounds.Y * dy); 5328sw = (int)Math.Round(localWidth * dx) + adornmentsAfterDpiChange.Width; 5334sh = (int)Math.Round(localHeight * dy) + adornmentsAfterDpiChange.Height; 9719padding.Left = (int)Math.Round(padding.Left * dx); 9720padding.Right = (int)Math.Round(padding.Right * dx); 9721margins.Left = (int)Math.Round(margins.Left * dx); 9722margins.Right = (int)Math.Round(margins.Right * dx); 9727padding.Top = (int)Math.Round(padding.Top * dy); 9728padding.Bottom = (int)Math.Round(padding.Bottom * dy); 9729margins.Top = (int)Math.Round(margins.Top * dy); 9730margins.Bottom = (int)Math.Round(margins.Bottom * dy); 9792int sx = (int)Math.Round(_x * dx); 9793int sy = (int)Math.Round(_y * dy); 9798sw = (int)(Math.Round((_x + _width) * dx)) - sx; 9804sh = (int)(Math.Round((_y + _height) * dy)) - sy; 9828size.Width = (int)Math.Round(size.Width * x); 9833size.Height = (int)Math.Round(size.Height * y);
System\Windows\Forms\Controls\TrackBar\TrackBarRenderer.cs (2)
130t_visualStyleRenderer.DrawEdge(g, new Rectangle((int)Math.Round(x), bounds.Y, LineWidth, bounds.Height), Edges.Left, edgeStyle, EdgeEffects.None); 160t_visualStyleRenderer.DrawEdge(g, new Rectangle(bounds.X, (int)Math.Round(y), bounds.Width, LineWidth), Edges.Top, edgeStyle, EdgeEffects.None);
System\Windows\Forms\Dialogs\ThreadExceptionDialog.cs (1)
349_scaledHeightPadding = (int)Math.Round(HEIGHTPADDING * ((float)e.DeviceDpiNew / e.DeviceDpiOld));
System\Windows\Forms\Form.cs (4)
449return new Size((int)Math.Round(real.Width), (int)Math.Round(real.Height)); 2981Size newVar = new((int)Math.Round(newVarF.Width), (int)Math.Round(newVarF.Height));
System\Windows\Forms\Layout\Containers\ContainerControl.cs (1)
736retval.Width = (int)Math.Round(size.Width / ((float)FontMeasureString.Length));
System\Windows\Forms\Layout\Containers\SplitContainer.cs (3)
1768SplitterWidth = (int)Math.Round(SplitterWidth * scale); 1769_splitterDistance = (int)Math.Round(_splitterDistance * scale); 1775_panelSize = (int)Math.Round(_panelSize * scale);
System\Windows\Forms\Layout\DefaultLayout.cs (4)
993anchorInfo.Left = (int)Math.Round(anchorInfo.Left * widthFactor); 994anchorInfo.Top = (int)Math.Round(anchorInfo.Top * heightFactor); 995anchorInfo.Right = (int)Math.Round(anchorInfo.Right * widthFactor); 996anchorInfo.Bottom = (int)Math.Round(anchorInfo.Bottom * heightFactor);
System\Windows\Forms\Layout\TableLayout.cs (2)
661strip.MinSize = (int)Math.Round((double)styles[i].Size); 1133int totalWidth = (int)Math.Round(((strip.MinSize * totalPercent) / style.Size));
System\Windows\Forms\MDI\MDIClient.cs (4)
195int sx = (int)Math.Round(bounds.X * dx); 196int sy = (int)Math.Round(bounds.Y * dy); 197int sw = (int)Math.Round((bounds.X + bounds.Width) * dx - sx); 198int sh = (int)Math.Round((bounds.Y + bounds.Height) * dy - sy);
System\Windows\Forms\Panels\TableLayoutPanel\TableLayoutPanel.cs (4)
529cs.Width = (float)Math.Round(lastColumnHeight * factor.Width); 533cs.Width = (float)Math.Round(cs.Width * factor.Width); 550rs.Height = (float)Math.Round(lastRowHeight * factor.Height); 554rs.Height = (float)Math.Round(rs.Height * factor.Height);
System.Windows.Forms.Design (4)
System\Windows\Forms\Design\FormDocumentDesigner.cs (4)
66return new Size((int)Math.Round(real.Width), (int)Math.Round(real.Height)); 269Size newVar = new((int)Math.Round(newVarF.Width), (int)Math.Round(newVarF.Height));
System.Windows.Forms.Primitives (2)
System\Windows\Forms\Internals\ScaleHelper.cs (2)
261internal static int ScaleToPercent(int value, double percent) => Math.Max(1, (int)Math.Round(value * percent)); 276return (int)Math.Round(scalingFactor * logicalValue);
System.Windows.Forms.UI.IntegrationTests (8)
ButtonTests.cs (6)
263Point virtualPoint = new((int)Math.Round(65535.0 / horizontalResolution * centerOnScreen.X), 264(int)Math.Round(65535.0 / verticalResolution * centerOnScreen.Y)); 299Point virtualPoint = new((int)Math.Round(65535.0 / horizontalResolution * centerOnScreen.X), (int)Math.Round(65535.0 / verticalResolution * centerOnScreen.Y)); 300Point virtualPoint1 = new((int)Math.Round(65535.0 / horizontalResolution * centerOnScreen1.X), (int)Math.Round(65535.0 / verticalResolution * centerOnScreen1.Y));
Dpi\DpiMessageHelper.cs (2)
25(int)Math.Round(control.Width * factor), 26(int)Math.Round(control.Height * factor));
System.Windows.Input.Manipulations (1)
System\Windows\Input\Manipulations\ManipulationSequence.cs (1)
1342int newHistoryLength = (int)Math.Round(smoothingLevel * MaxHistoryLength);
UIAutomationClientSideProviders (4)
MS\Internal\AutomationProxies\WindowsEditBoxRange.cs (1)
776return Math.Round((double)(-logfont.lfHeight) * 72 / lpy);
MS\Internal\AutomationProxies\WindowsListView.cs (1)
1689int future = (int) Math.Round (((si.nMax - deltaPage) - si.nMin) * fScrollPos / 100.0 + si.nMin);
MS\Internal\AutomationProxies\WindowsScroll.cs (1)
305int newPos = (int) Math.Round (((si.nMax - delta) - si.nMin) * fScrollPos / 100.0 + si.nMin);
MS\Internal\AutomationProxies\WindowsTab.cs (1)
509int newPos = (int) Math.Round ((maxPos - minPos) * horizontalPercent / 100) + minPos;
WinFormsControlsTest (3)
CurrentDPILabel.cs (1)
34Text = $"Current scaling is {(int)Math.Round((DeviceDpi / 96.0) * 100)}%";
MenuStripAndCheckedListBox.cs (2)
18currentDpiLabel.Text = $"Current scaling = {(int)Math.Round((DeviceDpi / 96.0) * 100)}%"; 23currentDpiLabel.Text = $"Current scaling = {(int)Math.Round((DeviceDpi / 96.0) * 100)}%";