3830 references to Math
CodeGenerator (8)
dotnet-user-jwts (1)
http2cat (10)
IIS.FunctionalTests (10)
IIS.LongTests (10)
IIS.NewHandler.FunctionalTests (10)
IIS.NewShim.FunctionalTests (10)
IIS.ShadowCopy.Tests (3)
IISExpress.FunctionalTests (10)
ILCompiler.DependencyAnalysisFramework (1)
InMemory.FunctionalTests (2)
KeyManagementSimulator (2)
LocalizationSample (4)
Microsoft.Arcade.Common (1)
Microsoft.Arcade.Test.Common (3)
Microsoft.AspNetCore.App.Analyzers (2)
Microsoft.AspNetCore.Authentication.Cookies (2)
Microsoft.AspNetCore.Authentication.OpenIdConnect (1)
Microsoft.AspNetCore.Components (4)
Microsoft.AspNetCore.Components.Forms (2)
Microsoft.AspNetCore.Components.QuickGrid (1)
Microsoft.AspNetCore.Components.Server (11)
Microsoft.AspNetCore.Components.Web (12)
Microsoft.AspNetCore.Components.WebAssembly (1)
Microsoft.AspNetCore.Components.WebView (3)
Microsoft.AspNetCore.CookiePolicy.Test (2)
Microsoft.AspNetCore.Cryptography.KeyDerivation (1)
Microsoft.AspNetCore.DataProtection (2)
Microsoft.AspNetCore.DataProtection.Tests (1)
Microsoft.AspNetCore.Diagnostics (1)
Microsoft.AspNetCore.Grpc.JsonTranscoding (1)
Microsoft.AspNetCore.Grpc.Swagger (1)
Microsoft.AspNetCore.Hosting (1)
Microsoft.AspNetCore.Http (3)
Microsoft.AspNetCore.Http.Abstractions (5)
Microsoft.AspNetCore.Http.Connections (1)
Microsoft.AspNetCore.Http.Connections.Tests (1)
Microsoft.AspNetCore.Http.Extensions (5)
Microsoft.AspNetCore.Http.Results (2)
Microsoft.AspNetCore.Http.Tests (1)
Microsoft.AspNetCore.HttpLogging (8)
Microsoft.AspNetCore.HttpOverrides (4)
Microsoft.AspNetCore.HttpsPolicy (1)
Microsoft.AspNetCore.Identity.FunctionalTests (1)
Microsoft.AspNetCore.InternalTesting (1)
Microsoft.AspNetCore.Mvc.Core (3)
Microsoft.AspNetCore.Mvc.Core.TestCommon (2)
Microsoft.AspNetCore.Mvc.TagHelpers (3)
Microsoft.AspNetCore.Mvc.ViewFeatures (5)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (2)
Microsoft.AspNetCore.OpenApi (1)
Microsoft.AspNetCore.OutputCaching (4)
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (4)
Microsoft.AspNetCore.ResponseCaching (1)
Microsoft.AspNetCore.Routing (9)
Microsoft.AspNetCore.Routing.Microbenchmarks (2)
Microsoft.AspNetCore.Server.HttpSys (1)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (10)
Microsoft.AspNetCore.Server.IIS (5)
Microsoft.AspNetCore.Server.Kestrel.Core (29)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (6)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (1)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (1)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (2)
Microsoft.AspNetCore.Shared.Tests (18)
Microsoft.AspNetCore.SignalR.Client.Core (2)
Microsoft.AspNetCore.SignalR.Client.Tests (1)
Microsoft.AspNetCore.SignalR.Common (1)
Microsoft.AspNetCore.SignalR.Common.Tests (1)
Microsoft.AspNetCore.SignalR.Core (2)
Microsoft.AspNetCore.SignalR.Microbenchmarks (1)
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (2)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (1)
Microsoft.AspNetCore.SignalR.Specification.Tests (1)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (1)
Microsoft.AspNetCore.StaticAssets (1)
Microsoft.AspNetCore.StaticFiles (1)
Microsoft.AspNetCore.StaticFiles.FunctionalTests (1)
Microsoft.AspNetCore.TestHost (2)
Microsoft.AspNetCore.WebSockets (5)
Microsoft.AspNetCore.WebSockets.Tests (2)
Microsoft.AspNetCore.WebUtilities (18)
MultipartReaderStream.cs (9)
177var slice = buffer.AsSpan(0, Math.Min(buffer.Length, index));
197read = _innerStream.Read(buffer, offset, Math.Min(count, matchOffset - bufferedData.Offset));
208read = _innerStream.Read(buffer, offset, Math.Min(count, bufferedData.Count));
257var slice = buffer[..Math.Min(buffer.Length, index)];
280var slice = buffer[..Math.Min(buffer.Length, matchOffset - bufferedData.Offset)];
294read = _innerStream.Read(buffer.Span[..Math.Min(buffer.Length, bufferedData.Count)]);
325matchOffset = Math.Max(segment1.Offset, segment1.Offset + segment1.Count - matchBytes.Length);
352bufferSize = Math.Max(4096, bufferSize);
361bufferSize = Math.Max(4096, bufferSize);
Microsoft.AspNetCore.WebUtilities.Tests (4)
Microsoft.Build (49)
Microsoft.Build.Engine (5)
Microsoft.Build.Engine.OM.UnitTests (1)
Microsoft.Build.Engine.UnitTests (1)
Microsoft.Build.Framework (12)
SegmentedArray.cs (10)
488var currentSegmentLength = Math.Min(remainingInSegment, _length);
497var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
592var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
640var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
730_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
737_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
779_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
786_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Microsoft.Build.Tasks.Core (8)
Microsoft.Build.Tasks.UnitTests (6)
Microsoft.Build.UnitTests.Shared (2)
Microsoft.Build.Utilities.Core (4)
Microsoft.DotNet.Build.Tasks.Feed (2)
Microsoft.DotNet.Build.Tasks.Installers (1)
Microsoft.DotNet.Helix.Sdk (2)
Microsoft.DotNet.NuGetRepack.Tests (3)
Microsoft.DotNet.SignTool (2)
Microsoft.DotNet.VersionTools (1)
Microsoft.Extensions.Caching.Hybrid (2)
Microsoft.Extensions.Caching.MicroBenchmarks (2)
Microsoft.Extensions.Caching.StackExchangeRedis (1)
Microsoft.Extensions.DependencyInjection (3)
Microsoft.Extensions.DependencyModel (1)
Microsoft.Extensions.FileProviders.Physical (1)
Microsoft.Extensions.Identity.Core (2)
Microsoft.Extensions.Logging.Abstractions (2)
Microsoft.Extensions.Logging.Console (2)
Microsoft.Extensions.Logging.Generators (4)
Microsoft.Extensions.Options.SourceGeneration (1)
Microsoft.Interop.JavaScript.JSImportGenerator (1)
Microsoft.Interop.SourceGeneration (4)
Microsoft.JSInterop (2)
Microsoft.NET.WebAssembly.Webcil (1)
Microsoft.VisualBasic.Core (9)
MonoAOTCompiler (1)
MonoTargetsTasks (4)
MSBuild (6)
MSBuildTaskHost (3)
mscorlib (1)
netstandard (1)
PresentationBuildTasks (4)
PresentationCore (524)
MS\Internal\Ink\StrokeRenderer.cs (27)
93double delta = Math.Abs(GetAngleDeltaFromLast(strokeNode.PreviousPosition, strokeNode.Position, ref lastAngle));
113if ((Math.Min(prevArea, currArea) / Math.Max(prevArea, currArea)) <= 0.70d)
254double maxExtent = Math.Max(drawingAttributes.Height, drawingAttributes.Width);
255percentIntersect += Math.Min(4.99999d, ((maxExtent / 20d) * 5d));
523bool directionChangedOverAbsoluteThreshold = Math.Abs(delta) > 90d && Math.Abs(delta) < (360d - 90d);
524bool directionChangedOverOverlapThreshold = overlap && !(ignorePressure || strokeNode.PressureFactor == 1f) && Math.Abs(delta) > 30d && Math.Abs(delta) < (360d - 30d);
533if ((Math.Min(prevArea, currArea) / Math.Max(prevArea, currArea)) <= 0.90d)
838double intersectLeft = Math.Max(rect1.Left, rect2.Left);
839double intersectTop = Math.Max(rect1.Top, rect2.Top);
840double intersectWidth = Math.Max((double)(Math.Min(rect1.Right, rect2.Right) - intersectLeft), (double)0);
841double intersectHeight = Math.Max((double)(Math.Min(rect1.Bottom, rect2.Bottom) - intersectTop), (double)0);
851double minArea = Math.Min(rect1Area, rect2Area);
1054angle = Math.PI / 2.0;
1058angle = Math.PI * 3.0 / 2.0;
1069angle = Math.PI;
1076angle = Math.Atan(dy / dx) + Math.PI;
1080angle = Math.Atan(dy / dx) + (2 * Math.PI);
1084angle = Math.Atan(dy / dx);
1089angle = angle * 180 / Math.PI;
MS\Internal\Media3D\GeneralTransform2DTo3DTo2D.cs (19)
517if (!((Math.Max(visEdgeStart.X, visEdgeEnd.X) < Math.Min(uv1.X, uv2.X)) ||
518(Math.Min(visEdgeStart.X, visEdgeEnd.X) > Math.Max(uv1.X, uv2.X)) ||
519(Math.Max(visEdgeStart.Y, visEdgeEnd.Y) < Math.Min(uv1.Y, uv2.Y)) ||
520(Math.Min(visEdgeStart.Y, visEdgeEnd.Y) > Math.Max(uv1.Y, uv2.Y))))
621if (Math.Abs(visUV1.X - visUV2.X) > Math.Abs(visUV1.Y - visUV2.Y))
935if (!((Math.Max(visEdgeStart.X, visEdgeEnd.X) < Math.Min(uv1.X, uv2.X)) ||
936(Math.Min(visEdgeStart.X, visEdgeEnd.X) > Math.Max(uv1.X, uv2.X)) ||
937(Math.Max(visEdgeStart.Y, visEdgeEnd.Y) < Math.Min(uv1.Y, uv2.Y)) ||
938(Math.Min(visEdgeStart.Y, visEdgeEnd.Y) > Math.Max(uv1.Y, uv2.Y))))
1105closestIntersection = ((currClosest - edges[i]._p1Transformed).Length / Math.Sqrt(denom) *
MS\Internal\TextFormatting\LineServicesCallbacks.cs (14)
456lstTextMetrics.dvAscent = (int)Math.Round(typeface.Baseline(store.Pap.EmSize, Constants.DefaultIdealToReal, store.Settings.TextSource.PixelsPerDip, fullText.TextFormattingMode));
457lstTextMetrics.dvMultiLineHeight = (int)Math.Round(typeface.LineSpacing(store.Pap.EmSize, Constants.DefaultIdealToReal, store.Settings.TextSource.PixelsPerDip, fullText.TextFormattingMode));
715ulInfo.dvpFirstUnderlineOffset = (int)Math.Round(lsrun.EmSize * -underlinePositionInEm);
716ulInfo.dvpFirstUnderlineSize = (int)Math.Round(lsrun.EmSize * underlineThicknessInEm);
769stInfo.dvpLowerStrikethroughOffset = (int)Math.Round(lsrun.EmSize * strikeThroughPositionInEm);
770stInfo.dvpLowerStrikethroughSize = (int)Math.Round(lsrun.EmSize * strikeThroughThicknessInEm);
964int baselineTop = ptOrigin.y + (int)Math.Round(lsrun.EmSize * strikeThroughPositionInEm);
965int overlineTop = baselineTop - (lsrun.BaselineOffset - (int)Math.Round(lsrun.EmSize * strikeThroughThicknessInEm));
1271penThickness = Math.Abs(penThickness);
1347drawingPenThickness = drawingPenThickness / Math.Abs(unitValue);
2016int expandedBy = Math.Max(0, interWordAdjustTo - adjustedCharWidth);
2023pplsAdjustRight[0][i] = Math.Max(0, adjustedCharWidth - interWordAdjustTo);
2149pplsCompressionRight[0][igi + i] = Math.Max(0, glyphAdvance - interWordCompressTo);
2282int expandedBy = Math.Max(0, interWordExpandTo - glyphAdvance);
MS\Internal\TextFormatting\SimpleTextLine.cs (10)
298realHeight = Math.Max(realHeight, run.Height);
299realAscent = Math.Max(realAscent, run.Baseline);
300realDescent = Math.Max(realDescent, run.Height - run.Baseline);
335_height = formatter.IdealToReal((int)Math.Round(pap.DefaultTypeface.LineSpacing(pap.EmSize, Constants.DefaultIdealToReal, PixelsPerDip, _settings.TextFormattingMode)), PixelsPerDip);
336_baselineOffset = formatter.IdealToReal((int)Math.Round(pap.DefaultTypeface.Baseline(pap.EmSize, Constants.DefaultIdealToReal, PixelsPerDip, _settings.TextFormattingMode)), PixelsPerDip);
370_idealOffsetUnRounded = (int)Math.Round((paragraphWidth - idealWidthAtTrailing) * 0.5);
853int first = Math.Max(ich, dcp) + _cpFirst;
854int afterLast = Math.Min(ich + run.Length, dcp + textLength) + _cpFirst;
1221cpVisible = Math.Max(cpRunStart, cp);
1253cpVisible = Math.Min(cpRunEnd, cp);
MS\Internal\TextFormatting\TextStore.cs (16)
524int effectedRangeStart = Math.Max(cpFetched - offset, bounds[0].Position);
525int effectedRangeEnd = Math.Min(cpFetched - offset + runInfo.Length, bounds[bounds.Length - 1].Position);
535int currentRangeEnd = Math.Min(bounds[i].Position, effectedRangeEnd);
569currentPosition = Math.Max(currentPosition, bounds[i + 1].Position);
1137int runLength = Math.Min(span.length, cchToAdd - ichRun);
1225int first = limit - Math.Min(charRange.Length, limitCp - firstCp);
1308int spanLength = Math.Min(runInfoSpanRider.Length, textEffectsSpanRider.Length);
1309int ichEnd = Math.Min(ichRun + spanLength, cchUniform);
1579(int)Math.Round(realToIdeal * runInfo.TextRun.Properties.FontRenderingEmSize),
1734(int)Math.Round(realToIdeal * runInfo.TextRun.Properties.FontRenderingEmSize),
1973textTop = Math.Max(textTop, lsrun.BaselineOffset);
1974textBottom = Math.Max(textBottom, lsrun.Descent);
1994textBottom = Math.Max(textBottom, lsrun.Height + top);
1998textBottom = Math.Max(textBottom, lsrun.Height + textTop);
2062cellAscent = Math.Max(cellAscent, lsrun.BaselineOffset - move);
2063cellDescent = Math.Max(cellDescent, lsrun.Descent + move);
System\Windows\Input\Stylus\Wisp\WispTabletDevice.cs (12)
281Size mouseDragDefault = new Size(Math.Max(1, SafeSystemMetrics.DragDeltaX / 2),
282Math.Max(1, SafeSystemMetrics.DragDeltaY / 2));
283Size mouseDoubleTapDefault = new Size(Math.Max(1, SafeSystemMetrics.DoubleClickDeltaX / 2),
284Math.Max(1, SafeSystemMetrics.DoubleClickDeltaY / 2));
294_cancelSize = new Size((int)Math.Round((ScreenSize.Width * stylusLogic.CancelDelta) / dwXValue),
295(int)Math.Round((ScreenSize.Height * stylusLogic.CancelDelta) / dwYValue));
299_cancelSize.Width = Math.Max(mouseDragDefault.Width, _cancelSize.Width);
300_cancelSize.Height = Math.Max(mouseDragDefault.Height, _cancelSize.Height);
302_doubleTapSize = new Size((int)Math.Round((ScreenSize.Width * stylusLogic.DoubleTapDelta) / dwXValue),
303(int)Math.Round((ScreenSize.Height * stylusLogic.DoubleTapDelta) / dwYValue));
307_doubleTapSize.Width = Math.Max(mouseDoubleTapDefault.Width, _doubleTapSize.Width);
308_doubleTapSize.Height = Math.Max(mouseDoubleTapDefault.Height, _doubleTapSize.Height);
System\Windows\Media\FormattedText.cs (21)
344i = Math.Min(limit, i + formatRider.Length);
418i = Math.Min(limit, i + formatRider.Length);
473i = Math.Min(limit, i + formatRider.Length);
526i = Math.Min(limit, i + formatRider.Length);
585i = Math.Min(limit, i + formatRider.Length);
644i = Math.Min(limit, i + formatRider.Length);
696i = Math.Min(limit, i + formatRider.Length);
749i = Math.Min(limit, i + formatRider.Length);
802i = Math.Min(limit, i + formatRider.Length);
854i = Math.Min(limit, i + formatRider.Length);
995return _that._maxTextWidths[Math.Min(line, _that._maxTextWidths.Length - 1)];
1139Math.Min(textSourcePosition + line.Length - 1, _that._text.Length - 1)
1650int x0 = Math.Max(enumerator.Position, startIndex);
1651int x1 = Math.Min(enumerator.Position + enumerator.Length, startIndex + count);
1802accBlackBoxLeft = Math.Min(accBlackBoxLeft, blackBoxLeft);
1803accBlackBoxRight = Math.Max(accBlackBoxRight, blackBoxRight);
1804accBlackBoxBottom = Math.Max(accBlackBoxBottom, blackBoxBottom);
1805accBlackBoxTop = Math.Min(accBlackBoxTop, blackBoxTop);
1811metrics.Width = Math.Max(metrics.Width, currentLine.Width);
1812metrics.WidthIncludingTrailingWhitespace = Math.Max(metrics.WidthIncludingTrailingWhitespace, currentLine.WidthIncludingTrailingWhitespace);
1813lineStartOfLongestLine = Math.Min(lineStartOfLongestLine, currentLine.Start);
System\Windows\Media3D\Quaternion.cs (34)
89double angleInRadians = angleInDegrees * (Math.PI / 180.0);
93Vector3D v = (axisOfRotation / length) * Math.Sin(0.5 * angleInRadians);
97_w = Math.Cos(0.5 * angleInRadians);
161double msin = Math.Sqrt(_x*_x + _y*_y + _z*_z);
170double maxcoeff = Math.Max(Math.Abs(_x),Math.Max(Math.Abs(_y),Math.Abs(_z)));
174msin = Math.Sqrt(x*x + y*y + z*z);
180return Math.Atan2(msin,mcos) * (360.0 / Math.PI);
260double rmax = 1.0/Max(Math.Abs(_x),
261Math.Abs(_y),
262Math.Abs(_z),
263Math.Abs(_w));
271double normInverse = 1.0 / Math.Sqrt(norm2);
445double max = Math.Max(Math.Max(Math.Abs(_x),Math.Abs(_y)),
446Math.Max(Math.Abs(_z),Math.Abs(_w)));
453double smallLength = Math.Sqrt(x*x+y*y+z*z+w*w);
457return Math.Sqrt(norm2);
561double theta = t * Math.PI;
563scaleFrom = Math.Cos(theta);
564scaleTo = Math.Sin(theta);
569double omega = Math.Acos(cosOmega);
570double sinOmega = Math.Sqrt(1.0 - cosOmega*cosOmega);
571scaleFrom = Math.Sin((1.0 - t) * omega) / sinOmega;
572scaleTo = Math.Sin(t * omega) / sinOmega;
580double lengthOut = lengthFrom * Math.Pow(lengthTo/lengthFrom, t);
System\Windows\Media3D\Rect3D.cs (18)
97_x = Math.Min(point1._x, point2._x);
98_y = Math.Min(point1._y, point2._y);
99_z = Math.Min(point1._z, point2._z);
100_sizeX = Math.Max(point1._x, point2._x) - _x;
101_sizeY = Math.Max(point1._y, point2._y) - _y;
102_sizeZ = Math.Max(point1._z, point2._z) - _z;
438double x = Math.Max(_x, rect._x);
439double y = Math.Max(_y, rect._y);
440double z = Math.Max(_z, rect._z);
441_sizeX = Math.Min(_x + _sizeX, rect._x + rect._sizeX) - x;
442_sizeY = Math.Min(_y + _sizeY, rect._y + rect._sizeY) - y;
443_sizeZ = Math.Min(_z + _sizeZ, rect._z + rect._sizeZ) - z;
476double x = Math.Min(_x, rect._x);
477double y = Math.Min(_y, rect._y);
478double z = Math.Min(_z, rect._z);
479_sizeX = Math.Max(_x + _sizeX, rect._x + rect._sizeX) - x;
480_sizeY = Math.Max(_y + _sizeY, rect._y + rect._sizeY) - y;
481_sizeZ = Math.Max(_z + _sizeZ, rect._z + rect._sizeZ) - z;
PresentationFramework (1130)
MS\Internal\Documents\DocumentGrid.cs (18)
323if (Math.Abs(pageNumber - _firstVisiblePageNumber) > 1)
584double clippedHorizontalOffset = Math.Min(_horizontalOffset, ExtentWidth - ViewportWidth);
585clippedHorizontalOffset = Math.Max(clippedHorizontalOffset, 0.0);
627double clippedVerticalOffset = Math.Min(_verticalOffset, ExtentHeight - ViewportHeight);
628clippedVerticalOffset = Math.Max(clippedVerticalOffset, 0.0);
1224pageOffset = new Point(Math.Max(ViewportWidth, ExtentWidth) - (xOffset + pageSize.Width), yOffset);
1452visiblePages.Add(_childrenCollection[_firstPageVisualIndex + j - Math.Max(0, firstPage)]);
1606double centerWidth = Math.Max(ViewportWidth, ExtentWidth);
2229(int)Math.Floor(ViewportWidth /
2234maxColumns = Math.Min(maxColumns, _pageCache.PageCount);
2235maxColumns = Math.Min(maxColumns, DocumentViewerConstants.MaximumMaxPagesAcross);
2246int rows = (int)Math.Floor((double)(_pageCache.PageCount / columns));
2258double aspectDiff = Math.Abs(layoutAspect - viewportAspect);
2370newScale = Math.Max(newScale, CurrentMinimumScale);
2371newScale = Math.Min(newScale, DocumentViewerConstants.MaximumScale);
2440scaleFactor = Math.Min(compensatedViewportWidth / rowWidth, compensatedViewportHeight / rowHeight);
2469scaleFactor = Math.Min(compensatedViewportWidth / rowWidth,
2699Math.Max(0.0, (ExtentWidth - row.RowSize.Width) / 2.0) : 0.0;
MS\Internal\Documents\RowCache.cs (13)
316double roundedOffset = Math.Round(offset, _findOffsetPrecision);
324double rowOffset = Math.Round(_rowCache[i].VerticalOffset, _findOffsetPrecision);
325double rowHeight = Math.Round(_rowCache[i].RowSize.Height, _findOffsetPrecision);
416startOffset = Math.Round(startOffset, _findOffsetPrecision);
417endOffset = Math.Round(endOffset, _findOffsetPrecision);
423double rowOffset = Math.Round(_rowCache[i].VerticalOffset, _findOffsetPrecision);
475_extentWidth = Math.Max(currentRow.RowSize.Width, _extentWidth);
542_layoutColumns = Math.Min(_layoutColumns, PageCache.PageCount);
543_layoutColumns = Math.Max(1, _layoutColumns);
657pivotPage = Math.Max(0, PageCache.PageCount - columns);
981_extentWidth = Math.Max(newRow.RowSize.Width, _extentWidth);
1109_extentWidth = Math.Max(row.RowSize.Width, _extentWidth);
1377_rowSize.Height = Math.Max(pageSize.Height, _rowSize.Height);
MS\Internal\Documents\TextBoxView.cs (32)
503desiredSize.Width = Math.Min(constraint.Width, desiredSize.Width);
504desiredSize.Height = Math.Min(constraint.Height, desiredSize.Height);
697int startOffset = Math.Min(_lineMetrics[_lineMetrics.Count - 1].EndOffset, startPosition.Offset);
698int endOffset = Math.Min(_lineMetrics[_lineMetrics.Count - 1].EndOffset, endPosition.Offset);
705firstLineIndex = Math.Max(firstLineIndex, GetLineIndexFromOffset(startOffset, LogicalDirection.Forward));
706lastLineIndex = Math.Min(lastLineIndex, GetLineIndexFromOffset(endOffset, LogicalDirection.Backward));
775int nextLineIndex = Math.Max(0, Math.Min(_lineMetrics.Count - 1, lineIndex + count));
1791Math.Max(0, Math.Min(_scrollData.ExtentWidth - _scrollData.ViewportWidth, _scrollData.HorizontalOffset)),
1792Math.Max(0, Math.Min(_scrollData.ExtentHeight - _scrollData.ViewportHeight, _scrollData.VerticalOffset)));
1938int endOffset = Math.Min(range.StartIndex + range.PositionsAdded, _host.TextContainer.SymbolCount);
2049int startOffset = Math.Max(_lineMetrics[lineIndex].Offset, unclippedStartOffset);
2050int endOffset = Math.Min(_lineMetrics[lineIndex].EndOffset, unclippedEndOffset);
2145int startOffset = Math.Max(lineStartOffset, unclippedStartOffset);
2146int endOffset = Math.Min(lineEndOffset, unclippedEndOffset);
2205lastLineIndex = (int)Math.Ceiling((viewport.Y + viewport.Height) / _lineHeight) - 1;
2208firstLineIndex = Math.Max(0, Math.Min(firstLineIndex, _lineMetrics.Count - 1));
2209lastLineIndex = Math.Max(0, Math.Min(lastLineIndex, _lineMetrics.Count - 1));
2281desiredSize.Width = Math.Max(desiredSize.Width, line.Width);
2555int lastCoveredCharOffset = range.StartIndex + Math.Max(range.PositionsAdded, range.PositionsRemoved);
2651desiredSize.Width = Math.Max(desiredSize.Width, _lineMetrics[i].Width);
2714int lineIndex = Math.Max(oldLineVisualsIndex, firstLineIndex);
2715int lineCount = Math.Min(oldLastLineIndex, firstLineIndex + count - 1) - lineIndex + 1;
2809count = Math.Max(0, count);
2815count = Math.Min(count, _viewportLineVisuals.Count - start);
2993int rangeStart = Math.Max(viewportStart, selectionStart);
2994int rangeSize = Math.Min(viewportEnd, selectionEnd) - rangeStart;
3130padding = Math.Max(0, viewport.Height - _contentSize.Height);
MS\Internal\Ink\LassoHelper.cs (6)
113double step = Math.Sqrt(MinDistanceSquared / distanceSquared);
237&& DoubleUtil.GreaterThanOrClose(point.X, Math.Min(prevLassoPoint.X, lassoPoint.X))
238&& DoubleUtil.LessThanOrClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
247if (DoubleUtil.GreaterThanOrClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
253if ((0 == i) && DoubleUtil.AreClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
258else if (DoubleUtil.GreaterThanOrClose(point.X, Math.Min(prevLassoPoint.X, lassoPoint.X)))
MS\Internal\PtsHost\ContainerParagraph.cs (13)
528fsrcToFillSubtrack.u = Math.Max(Math.Min(fsrcToFillSubtrack.u, fsrcToFill.u + fsrcToFill.du - 1), fsrcToFill.u);
529fsrcToFillSubtrack.du = Math.Max(fsrcToFillSubtrack.du, 0);
542fsrcToFillSubtrack.v = Math.Max(Math.Min(fsrcToFillSubtrack.v, fsrcToFill.v + fsrcToFill.dv - 1), fsrcToFill.v);
543fsrcToFillSubtrack.dv = Math.Max(fsrcToFillSubtrack.dv, 0);
603dvrUsed = Math.Min(fsrcToFill.dv, dvrUsed);
686urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack);
687durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
816urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack);
817durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
MS\Internal\PtsHost\SubpageParagraph.cs (16)
182subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
191subpageHeight = Math.Max(1, subpageHeight - (marginTop + mbp.BPTop));
245dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
246fsrcToFill.du = Math.Max(fsrcToFill.du, fsbbox.fsrc.du + fsbbox.fsrc.u);
289fsbbox.fsrc.du = Math.Max(fsrcToFill.du - (mbp.MarginLeft + mbp.MarginRight), 0);
290fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
369subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
441dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
442durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u);
452fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0);
453fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
529subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
600dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
601durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u);
611fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0);
612fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
MS\Internal\PtsHost\TextParaClient.cs (19)
745int dcpStart = Math.Max(cpStartTextPointer, cpParagraphStart) - cpParagraphStart;
749int dcpEnd = Math.Min(cpEndTextPointer, cpParagraphEnd) - cpParagraphStart;
1414int countVisualsShiftBeforeChange = Math.Min(Math.Max(lineIndexToBeginRemoval - _lineIndexFirstVisual, 0), lineVisuals.Count);
1431int actualLinesToRemove = Math.Min(Math.Max(lineIndexToBeginRemoval - _lineIndexFirstVisual + cLinesToRemove, 0), lineVisuals.Count);
1459int actualLinesToRemove = Math.Min(cLinesToRemove, lineVisuals.Count - (lineIndexToBeginRemoval - _lineIndexFirstVisual));
1879int dcpRangeStartForThisLine = Math.Max(lineDesc.dcpFirst, dcpStart);
1882int cchRangeForThisLine = Math.Max(Math.Min(lineDesc.dcpLim, dcpEnd) - dcpRangeStartForThisLine, 1);
1989int dcpRangeStartForThisElem = Math.Max(elemDesc.dcpFirst, dcpStart);
1992int cchRangeForThisElem = Math.Max(Math.Min(elemDesc.dcpLim, dcpEnd) - dcpRangeStartForThisElem, 1);
2084lineRect.Width = Math.Max(lineVisual.WidthIncludingTrailingWhitespace, 0);
2195elementRect.Width = Math.Max(lineVisual.WidthIncludingTrailingWhitespace, 0);
3133line.GetGlyphRuns(glyphRuns, Math.Max(dcpStart, lineDesc.dcpFirst), Math.Min(dcpEnd, lineDesc.dcpLim));
3195line.GetGlyphRuns(glyphRuns, Math.Max(dcpStart, element.dcpFirst), Math.Min(dcpEnd, element.dcpLim));
System\Windows\Controls\Border.cs (12)
234Size childConstraint = new Size(Math.Max(0.0, constraint.Width - combined.Width),
235Math.Max(0.0, constraint.Height - combined.Height));
639Math.Max(0.0, rt.Width - thick.Left - thick.Right),
640Math.Max(0.0, rt.Height - thick.Top - thick.Bottom));
983LeftTop = Math.Max(0.0, radii.TopLeft - left);
984TopLeft = Math.Max(0.0, radii.TopLeft - top);
985TopRight = Math.Max(0.0, radii.TopRight - top);
986RightTop = Math.Max(0.0, radii.TopRight - right);
987RightBottom = Math.Max(0.0, radii.BottomRight - right);
988BottomRight = Math.Max(0.0, radii.BottomRight - bottom);
989BottomLeft = Math.Max(0.0, radii.BottomLeft - bottom);
990LeftBottom = Math.Max(0.0, radii.BottomLeft - left);
System\Windows\Controls\DataGrid.cs (18)
2650indexToSelect = Math.Min(Items.Count - numSelected - 1, indexToSelect);
5073int newRowCount = Math.Abs(endIndex - startIndex) + 1;
5074int newColumnCount = Math.Abs(endColumnIndex - startColumnIndex) + 1;
5092int previousStartIndex = Math.Min(startIndex, currentCellIndex);
5093int previousRowCount = Math.Abs(currentCellIndex - startIndex) + 1;
5094int previousStartColumnIndex = Math.Min(startColumnIndex, currentCellColumnIndex);
5095int previousColumnCount = Math.Abs(currentCellColumnIndex - startColumnIndex) + 1;
5135_selectedCells.AddRegion(Math.Min(startIndex, endIndex), Math.Min(startColumnIndex, endColumnIndex), newRowCount, newColumnCount);
5733nextDisplayIndex = Math.Max(0, InternalColumns.LastVisibleDisplayIndex);
5814nextRowIndex = Math.Max(0, Items.Count - 1);
5999index = Math.Max(0, Math.Min(numItems - 1, index + (shiftModifier ? -1 : 1)));
6142int jumpDistance = Math.Max(1, (int)scrollHost.ViewportHeight - 1);
6144targetIndex = Math.Max(0, Math.Min(targetIndex, Items.Count - 1));
6587distance = Math.Abs(pt.Y - cellBounds.Top);
6595distance = Math.Abs(pt.X - cellBounds.Left);
System\Windows\Controls\DataGridColumnCollection.cs (24)
754int columnCount = Math.Min(newFrozenCount, Count);
762int columnCount = Math.Min(oldFrozenCount, Count);
952availableStarSpace = Math.Max(0.0, availableStarSpace - columnMinWidth);
1236double displayValue = Math.Max(width.DesiredValue, minWidth);
1276double displayValue = Math.Min(width.DesiredValue, maxWidth);
1344TakeAwayWidthFromColumns(null, Math.Abs(availableSpaceChange), false, newTotalAvailableSpace);
1368column.SetWidthInternal(new DataGridLength(width.Value, width.UnitType, width.DesiredValue, Math.Min(width.DesiredValue, maxWidth)));
1390Math.Max(width.DisplayValue - nonRetrievableSpace, changedColumn.MinWidth)));
1462return Math.Max(availableSpace - requiredSpace, 0.0);
1673column.UpdateWidthForStarColumn(Math.Max(columnDesiredWidth, column.MinWidth), columnDesiredWidth, columnDesiredWidth / perStarWidth);
1702double columnExcessWidth = onlyShrinkToDesiredWidth ? width.DisplayValue - Math.Max(width.DesiredValue, column.MinWidth) : width.DisplayValue - column.MinWidth;
1787double maxColumnResizeWidth = expandBeyondDesiredWidth ? column.MaxWidth : Math.Min(width.DesiredValue, column.MaxWidth);
1922column.UpdateWidthForStarColumn(Math.Min(columnDesiredWidth, column.MaxWidth), columnDesiredWidth, columnDesiredWidth / perStarWidth);
2009double usedStarSpace = ComputeStarColumnWidths(Math.Min(expectedStarSpace, sumOfStarMaxWidths));
2010giveAwayWidth = Math.Max(usedStarSpace - expectedStarSpace, 0.0);
2080double lagWidth = Math.Min(width.DesiredValue, columnMaxWidth) - width.DisplayValue;
2111if (DoubleUtil.LessThan(width.DisplayValue, Math.Min(width.DesiredValue, column.MaxWidth)))
2139giveAwayWidth -= Math.Min(contributingSpace, giveAwayWidth);
2146giveAwayWidth = Math.Min(giveAwayWidth, Math.Max(0d, totalSpace - usedSpace));
2193return Math.Min(usedSpace - totalAvailableWidth, takeAwayWidth);
2201takeAwayWidth = Math.Max(0.0, takeAwayWidth - unusedSpace);
2272double usedStarSpace = ComputeStarColumnWidths(Math.Max(expectedStarSpace, sumOfStarMinWidths));
2273takeAwayWidth = Math.Max(usedStarSpace - expectedStarSpace, 0.0);
System\Windows\Controls\DockPanel.cs (10)
226childConstraint = new Size(Math.Max(0.0, constraint.Width - accumulatedWidth),
227Math.Max(0.0, constraint.Height - accumulatedHeight));
247parentHeight = Math.Max(parentHeight, accumulatedHeight + childDesiredSize.Height);
253parentWidth = Math.Max(parentWidth, accumulatedWidth + childDesiredSize.Width);
260parentWidth = Math.Max(parentWidth, accumulatedWidth);
261parentHeight = Math.Max(parentHeight, accumulatedHeight);
291Math.Max(0.0, arrangeSize.Width - (accumulatedLeft + accumulatedRight)),
292Math.Max(0.0, arrangeSize.Height - (accumulatedTop + accumulatedBottom)) );
305rcChild.X = Math.Max(0.0, arrangeSize.Width - accumulatedRight);
316rcChild.Y = Math.Max(0.0, arrangeSize.Height - accumulatedBottom);
System\Windows\Controls\FlowDocumentScrollViewer.cs (8)
592Math.Max(ia.OriginWidth, pagePadding.Left),
593Math.Max(ia.OriginHeight, pagePadding.Top),
594Math.Max(ia.MediaSizeWidth - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right),
595Math.Max(ia.MediaSizeHeight - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom));
634Zoom = Math.Min(Zoom + ZoomIncrement, MaxZoom);
646Zoom = Math.Max(Zoom - ZoomIncrement, MinZoom);
712SetCurrentValueInternal(ZoomProperty, Math.Min(Zoom + ZoomIncrement, MaxZoom));
716SetCurrentValueInternal(ZoomProperty, Math.Max(Zoom - ZoomIncrement, MinZoom));
System\Windows\Controls\Grid.cs (69)
380gridDesiredSize.Width = Math.Max(gridDesiredSize.Width, child.DesiredSize.Width);
381gridDesiredSize.Height = Math.Max(gridDesiredSize.Height, child.DesiredSize.Height);
917cell.ColumnIndex = Math.Min(GetColumn(child), DefinitionsU.Length - 1);
920cell.RowIndex = Math.Min(GetRow(child), DefinitionsV.Length - 1);
925cell.ColumnSpan = Math.Min(GetColumnSpan(child), DefinitionsU.Length - cell.ColumnIndex);
929cell.RowSpan = Math.Min(GetRowSpan(child), DefinitionsV.Length - cell.RowIndex);
1106userMinSize = Math.Max(userMinSize, Math.Min(userSize, userMaxSize));
1130definitions[i].MeasureSize = Math.Max(userMinSize, Math.Min(userSize, userMaxSize));
1230DefinitionsU[PrivateCells[i].ColumnIndex].UpdateMinSize(Math.Min(children[i].DesiredSize.Width, DefinitionsU[PrivateCells[i].ColumnIndex].UserMaxSize));
1247DefinitionsV[PrivateCells[i].RowIndex].UpdateMinSize(Math.Min(children[i].DesiredSize.Height, DefinitionsV[PrivateCells[i].RowIndex].UserMaxSize));
1468double maxSize = Math.Max(definitions[i].UserMaxSize, minSize);
1520double newMinSize = Math.Min(sizeToDistribute / (count - i), tempDefinitions[i].PreferredSize);
1550tempDefinitions[i].UpdateMinSize(Math.Min(newMinSize, tempDefinitions[i].SizeCache));
1561tempDefinitions[i].UpdateMinSize(Math.Min(newMinSize, tempDefinitions[i].SizeCache));
1672starValue = Math.Min(starValue, c_starClip);
1676double maxSize = Math.Max(definitions[i].MinSize, definitions[i].UserMaxSize);
1677maxSize = Math.Min(maxSize, c_starClip);
1715double userSize = Math.Max(availableSize - takenSize, 0.0) * (starValue / tempDefinitions[i].SizeCache);
1716resolvedSize = Math.Min(userSize, tempDefinitions[i].UserMaxSize);
1717resolvedSize = Math.Max(tempDefinitions[i].MinSize, resolvedSize);
1778double power = Math.Floor(Math.Log(Double.MaxValue / maxStar / starCount, 2.0));
1781scale = Math.Pow(2.0, power - 4.0); // -4 is just for paranoia
1829double effectiveMaxSize = Math.Max(def.MinSize, def.UserMaxSize);
1901resolvedSize = Math.Max(resolvedDef.MinSize, resolvedDef.UserMaxSize);
2019double resolvedSize = (def.MeasureSize > 0.0) ? Math.Max(availableSize - takenSize, 0.0) * (def.MeasureSize / def.SizeCache) : 0.0;
2022resolvedSize = Math.Min(resolvedSize, def.UserMaxSize);
2023resolvedSize = Math.Max(def.MinSize, resolvedSize);
2112starValue = Math.Min(starValue, c_starClip);
2116double maxSize = Math.Max(definitions[i].MinSizeForArrange, definitions[i].UserMaxSize);
2117maxSize = Math.Min(maxSize, c_starClip);
2157definitions[i].SizeCache = Math.Max(definitions[i].MinSizeForArrange, Math.Min(userSize, userMaxSize));
2202double userSize = Math.Max(finalSize - allPreferredArrangeSize, 0.0) * (starValue / definitions[definitionIndices[i]].SizeCache);
2203resolvedSize = Math.Min(userSize, definitions[definitionIndices[i]].UserMaxSize);
2204resolvedSize = Math.Max(definitions[definitionIndices[i]].MinSizeForArrange, resolvedSize);
2229final = Math.Max(final, definitions[definitionIndex].MinSizeForArrange);
2230final = Math.Min(final, definitions[definitionIndex].SizeCache);
2236final = Math.Max(final, definitions[definitionIndex].MinSizeForArrange);
2237final = Math.Min(final, definitions[definitionIndex].SizeCache);
2270final = Math.Max(final, definition.MinSizeForArrange);
2286final = Math.Max(final, definition.MinSizeForArrange);
2357double power = Math.Floor(Math.Log(Double.MaxValue / maxStar / starCount, 2.0));
2360scale = Math.Pow(2.0, power - 4.0); // -4 is just for paranoia
2404double effectiveMaxSize = Math.Max(def.MinSizeForArrange, def.UserMaxSize);
2443def.SizeCache = Math.Max(def.MinSizeForArrange, Math.Min(userSize, userMaxSize));
2512resolvedSize = Math.Max(resolvedDef.MinSizeForArrange, resolvedDef.UserMaxSize);
2644double resolvedSize = (def.MeasureSize > 0.0) ? Math.Max(finalSize - takenSize, 0.0) * (def.MeasureSize / def.SizeCache) : 0.0;
2647resolvedSize = Math.Min(resolvedSize, def.UserMaxSize);
2648resolvedSize = Math.Max(def.MinSizeForArrange, resolvedSize);
2739final = Math.Max(final, definition.MinSizeForArrange);
2755final = Math.Max(final, definition.MinSizeForArrange);
2797double minPower = Math.Floor(Math.Log(minRatio, 2.0));
2798double maxPower = Math.Floor(Math.Log(maxRatio, 2.0));
2799double f = Math.Pow(2.0, Math.Floor((minPower + maxPower) / 2.0));
2878Array.Clear(extData.TempDefinitions, 0, Math.Max(DefinitionsU.Length, DefinitionsV.Length));
3083int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length) * 2;
3116int requiredLength = Math.Max(Math.Max(DefinitionsU.Length, DefinitionsV.Length), 1) * 2;
3134int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length);
3226return (Math.Abs(d) < c_epsilon);
3237return (Math.Abs(d1 - d2) < c_epsilon);
System\Windows\Controls\GridSplitter.cs (13)
504_resizeData.SplitterLength = Math.Min(ActualWidth, ActualHeight);
656horizontalChange = Math.Round(horizontalChange / dragIncrement) * dragIncrement;
657verticalChange = Math.Round(verticalChange / dragIncrement) * dragIncrement;
664_resizeData.Adorner.OffsetX = Math.Min(Math.Max(horizontalChange, _resizeData.MinChange), _resizeData.MaxChange);
668_resizeData.Adorner.OffsetY = Math.Min(Math.Max(verticalChange, _resizeData.MinChange), _resizeData.MaxChange);
802definition1Min = Math.Max(definition1Min, _resizeData.SplitterLength);
806definition2Min = Math.Max(definition2Min, _resizeData.SplitterLength);
812minDelta = -Math.Min(definition1Len - definition1Min, definition2Max - definition2Len);
813maxDelta = Math.Min(definition1Max - definition1Len, definition2Len - definition2Min);
921delta = Math.Min(Math.Max(delta, min), max);
System\Windows\Controls\GridViewHeaderRowPresenter.cs (8)
262double childConstraintWidth = Math.Max(0.0, constraint.Width - accumulatedWidth);
284childConstraintWidth = Math.Min(childConstraintWidth, column.DesiredWidth);
292childConstraintWidth = Math.Min(childConstraintWidth, column.Width);
299maxHeight = Math.Max(maxHeight, child.DesiredSize.Height);
306maxHeight = Math.Max(maxHeight, _paddingHeader.DesiredSize.Height);
355double childArrangeWidth = Math.Min(remainingWidth, ((column.State == ColumnMeasureState.SpecificWidth) ? column.Width : column.DesiredWidth));
389rect = new Rect(accumulatedWidth, 0.0, Math.Max(remainingWidth, 0.0), arrangeSize.Height);
1247return (DoubleUtil.GreaterThan(Math.Abs(currentPos.X - originalPos.X), c_thresholdX));
System\Windows\Controls\Primitives\DataGridColumnHeadersPresenter.cs (10)
122desiredSize.Width = Math.Max(desiredSize.Width, indicatorSize.Width);
123desiredSize.Height = Math.Max(desiredSize.Height, indicatorSize.Height);
130desiredSize.Width = Math.Max(desiredSize.Width, indicatorSize.Width);
131desiredSize.Height = Math.Max(desiredSize.Height, indicatorSize.Height);
134desiredSize.Width = Math.Min(availableSize.Width, desiredSize.Width);
154childRect.Width = Math.Max(finalSize.Width, dataGrid.CellsPanelActualWidth);
649return DoubleUtil.GreaterThan(Math.Abs(currentPos.X - originalPos.X), SystemParameters.MinimumHorizontalDragDistance);
698height = Math.Max(_draggingSrcColumnHeader.RenderSize.Height, _columnHeaderDragIndicator.Height);
922columnEstimatedWidth = Math.Max(averageColumnWidth, column.MinWidth);
923columnEstimatedWidth = Math.Min(columnEstimatedWidth, column.MaxWidth);
System\Windows\Controls\Primitives\Popup.cs (26)
2109if (Math.Abs(score - childArea) < Tolerance)
2135if (Math.Abs(intersection.Width - childBounds.Width) > Tolerance ||
2136Math.Abs(intersection.Height - childBounds.Height) > Tolerance)
2150if (!IsTransparent || double.IsNaN(horizontalAxis.Y) || Math.Abs(horizontalAxis.Y) < Tolerance)
2162else if (IsTransparent && Math.Abs(horizontalAxis.X) < Tolerance)
2185if (!IsTransparent || double.IsNaN(verticalAxis.X) || Math.Abs(verticalAxis.X) < Tolerance)
2196else if (IsTransparent && Math.Abs(verticalAxis.Y) < Tolerance)
2251if (!IsTransparent || double.IsNaN(verticalAxis.X) || Math.Abs(verticalAxis.X) < Tolerance)
2253limitSize.Height = Math.Max(0.0, Math.Max(screenBounds.Bottom - targetBounds.Bottom, targetBounds.Top - screenBounds.Top));
2255else if (IsTransparent && Math.Abs(verticalAxis.Y) < Tolerance)
2257limitSize.Width = Math.Max(0.0, Math.Max(screenBounds.Right - targetBounds.Right, targetBounds.Left - screenBounds.Left));
2273if (!IsTransparent || double.IsNaN(horizontalAxis.X) || Math.Abs(horizontalAxis.Y) < Tolerance)
2275limitSize.Width = Math.Max(0.0, Math.Max(screenBounds.Right - targetBounds.Right, targetBounds.Left - screenBounds.Left));
2277else if (IsTransparent && Math.Abs(horizontalAxis.X) < Tolerance)
2279limitSize.Height = Math.Max(0.0, Math.Max(screenBounds.Bottom - targetBounds.Bottom, targetBounds.Top - screenBounds.Top));
2629desiredSize.Width = Math.Min(desiredSize.Width, screenBounds.Width);
2630desiredSize.Width = Math.Min(desiredSize.Width, limitSize.Width);
2634desiredSize.Height = Math.Min(desiredSize.Height, screenBounds.Height);
2635desiredSize.Height = Math.Min(desiredSize.Height, maxHeight);
2636desiredSize.Height = Math.Min(desiredSize.Height, limitSize.Height);
2708return new Rect(mousePoint.x, mousePoint.y - 1, Math.Max(0, cursorWidth - hotX), Math.Max(0, cursorHeight - hotY + 2));
System\Windows\Controls\ScrollViewer.cs (17)
409get { return Math.Max(0.0, ExtentWidth - ViewportWidth); }
417get { return Math.Max(0.0, ExtentHeight - ViewportHeight); }
1757DoubleUtil.LessThan(Math.Abs(unusedX), PanningInfo.PreFeedbackTranslationX))
1765DoubleUtil.LessThan(Math.Abs(unusedY), PanningInfo.PreFeedbackTranslationY))
1810double newUnused = Math.Max(unused + delta, 0);
1819double newUnused = Math.Min(unused + delta, 0);
1830Math.Round(PanningRatio * cumulativeTranslation / _panningInfo.DeltaPerHorizontalOffet));
1840Math.Round(PanningRatio * cumulativeTranslation / _panningInfo.DeltaPerVerticalOffset));
1853if (Math.Abs(Environment.TickCount - _panningInfo.InertiaBoundaryBeginTimestamp) < PanningInfo.InertiaBoundryMinimumTicks)
1858return (DoubleUtil.GreaterThanOrClose(Math.Abs(_panningInfo.UnusedTranslation.X), PanningInfo.MaxInertiaBoundaryTranslation) ||
1859DoubleUtil.GreaterThanOrClose(Math.Abs(_panningInfo.UnusedTranslation.Y), PanningInfo.MaxInertiaBoundaryTranslation));
1878bool validX = (DoubleUtil.GreaterThan(Math.Abs(translation.X), PanningInfo.PrePanTranslation));
1879bool validY = (DoubleUtil.GreaterThan(Math.Abs(translation.Y), PanningInfo.PrePanTranslation));
1889bool biggerX = (DoubleUtil.GreaterThanOrClose(Math.Abs(translation.X), Math.Abs(translation.Y)));
1902bool biggerY = (DoubleUtil.GreaterThanOrClose(Math.Abs(translation.Y), Math.Abs(translation.X)));
System\Windows\Controls\SinglePageViewer.cs (6)
704Math.Max(ia.OriginWidth, pagePadding.Left),
705Math.Max(ia.OriginHeight, pagePadding.Top),
706Math.Max(ia.MediaSizeWidth - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right),
707Math.Max(ia.MediaSizeHeight - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom));
745SetCurrentValueInternal(ZoomProperty, Math.Min(Zoom + ZoomIncrement, MaxZoom));
757SetCurrentValueInternal(ZoomProperty, Math.Max(Zoom - ZoomIncrement, MinZoom));
System\Windows\Controls\Slider.cs (15)
1018valueToSize = Math.Max(0.0, (trackSize.Width - thumbSize.Width) / range);
1024Canvas.SetLeft(rangeElement, (thumbSize.Width * 0.5) + Math.Max(Maximum - SelectionEnd, 0) * valueToSize);
1028Canvas.SetLeft(rangeElement, (thumbSize.Width * 0.5) + Math.Max(SelectionStart - Minimum, 0) * valueToSize);
1040valueToSize = Math.Max(0.0, (trackSize.Height - thumbSize.Height) / range);
1046Canvas.SetTop(rangeElement, (thumbSize.Height * 0.5) + Math.Max(SelectionStart - Minimum, 0) * valueToSize);
1050Canvas.SetTop(rangeElement, (thumbSize.Height * 0.5) + Math.Max(Maximum - SelectionEnd,0) * valueToSize);
1083valueToSize = Math.Max(0.0, (trackSize.Width - thumbSize.Width) / range);
1107valueToSize = Math.Max(0.0, (trackSize.Height - thumbSize.Height) / range);
1215previous = Minimum + (Math.Round(((value - Minimum) / TickFrequency)) * TickFrequency);
1216next = Math.Min(Maximum, previous + TickFrequency);
1236double next = SnapToTick(Math.Max(this.Minimum, Math.Min(this.Maximum, value + direction)));
1274double tickNumber = Math.Round((value - Minimum) / TickFrequency);
1435this.SetCurrentValueInternal(ValueProperty, Math.Max(this.Minimum, Math.Min(this.Maximum, snappedValue)));
System\Windows\Controls\Stack.cs (15)
604stackDesiredSize.Height = Math.Max(stackDesiredSize.Height, childDesiredSize.Height);
609stackDesiredSize.Width = Math.Max(stackDesiredSize.Width, childDesiredSize.Width);
669offset.Y = Math.Max(0, Math.Min(offset.Y, extent.Height - viewport.Height));
677offset.X = Math.Max(0, Math.Min(offset.X, extent.Width - viewport.Width));
682stackDesiredSize.Width = Math.Min(stackDesiredSize.Width, constraint.Width);
683stackDesiredSize.Height = Math.Min(stackDesiredSize.Height, constraint.Height);
761rcChild.Height = Math.Max(arrangeSize.Height, child.DesiredSize.Height);
768rcChild.Width = Math.Max(arrangeSize.Width, child.DesiredSize.Width);
902double left = Math.Max(targetRectOffset, minPhysicalOffset);
903targetRectSize = Math.Max(Math.Min(targetRectSize + targetRectOffset, minPhysicalOffset + viewportSize) - left, 0);
1001iNewOffset = Math.Max(Math.Min(numberOfItems - 1, iNewOffset), 0);
System\Windows\Controls\TextBlock.cs (12)
1275Size contentSize = new Size(Math.Max(0.0, constraint.Width - (padding.Left + padding.Right)),
1276Math.Max(0.0, constraint.Height - (padding.Top + padding.Bottom)));
1315desiredSize.Width = Math.Max(desiredSize.Width, line.GetCollapsedWidth());
1541double contentBottom = Math.Max(0.0, RenderSize.Height - Padding.Bottom);
1978Size contentSize = new Size(Math.Max(0.0, _referenceSize.Width - (padding.Left + padding.Right)),
1979Math.Max(0.0, _referenceSize.Height - (padding.Top + padding.Bottom)));
2331int dcpStart = Math.Max(dcpLineStart, dcpPositionStart);
2332int dcpEnd = Math.Min(dcpLineEnd, dcpPositionEnd);
3116Size contentSize = new Size(Math.Max(0.0, computedSize.Width - (padding.Left + padding.Right)),
3117Math.Max(0.0, computedSize.Height - (padding.Top + padding.Bottom)));
3166double contentBottom = Math.Max(0.0, RenderSize.Height - Padding.Bottom);
3196width = Math.Max(0.0, width - paddingWidth);
System\Windows\Controls\VirtualizedCellInfoCollection.cs (12)
613int left = Math.Max(Left, region.Left);
614int top = Math.Max(Top, region.Top);
615int right = Math.Min(Right, region.Right);
616int bottom = Math.Min(Bottom, region.Bottom);
686Left = Math.Min(Left, region.Left);
687Top = Math.Min(Top, region.Top);
688Right = Math.Max(prevRight, region.Right);
689Bottom = Math.Max(prevBottom, region.Bottom);
729int top = Math.Max(Top, region.Top);
730int bottom = Math.Min(Bottom, region.Bottom);
737int top = Math.Max(Top, region.Top);
738int bottom = Math.Min(Bottom, region.Bottom);
System\Windows\Controls\VirtualizingStackPanel.cs (185)
516double delta = Math.Abs(scrollX - oldViewportOffset.X);
529_scrollData._offset.X = Math.Floor(_scrollData._offset.X);
530_scrollData._computedOffset.X = Math.Floor(_scrollData._computedOffset.X);
644double delta = Math.Abs(scrollY - oldViewportOffset.Y);
657_scrollData._offset.Y = Math.Floor(_scrollData._offset.Y);
658_scrollData._computedOffset.Y = Math.Floor(_scrollData._computedOffset.Y);
2336double factor = Math.Min(1.0, isHorizontal ? viewport.Width / extendedViewport.Width : viewport.Height / extendedViewport.Height);
2337int calcItemsInViewportCount = (int)Math.Ceiling(factor * _itemsInExtendedViewportCount);
2338excludeCount = Math.Max(excludeCount,
2632double spanBeforeViewport = Math.Max(isHorizontal ? viewport.X : viewport.Y, 0.0);
2689_firstItemInExtendedViewportIndex = Math.Max(_firstItemInExtendedViewportIndex - 1, 0);
2691_firstItemInExtendedViewportChildIndex = Math.Max(_firstItemInExtendedViewportChildIndex, 0);
3389arrangeLength = Math.Max(isHorizontal ? arrangeSize.Height : arrangeSize.Width, arrangeLength);
4767pixelSizeBeforeViewport = Math.Max(pixelSizeBeforeViewport, Math.Abs(_viewport.X - _extendedViewport.X));
4771logicalSizeBeforeViewport = Math.Max(logicalSizeBeforeViewport, Math.Abs(_viewport.X - _extendedViewport.X));
4803extendedViewport.Width = Math.Max(extendedViewport.Width + extendedViewport.X, 0.0);
4814extendedViewport.Width = Math.Max(_scrollData._extent.Width - extendedViewport.X, 0.0);
4843extendedViewport.Width = Math.Max(extendedViewport.Width / approxSizeOfLogicalUnit + extendedViewport.X, 0.0) * approxSizeOfLogicalUnit;
4854extendedViewport.Width = Math.Max(_scrollData._extent.Width - extendedViewport.X, 0.0) * approxSizeOfLogicalUnit;
4883pixelSizeBeforeViewport = Math.Max(pixelSizeBeforeViewport, Math.Abs(_viewport.Y - _extendedViewport.Y));
4887logicalSizeBeforeViewport = Math.Max(logicalSizeBeforeViewport, Math.Abs(_viewport.Y - _extendedViewport.Y));
4919extendedViewport.Height = Math.Max(extendedViewport.Height + extendedViewport.Y, 0.0);
4930extendedViewport.Height = Math.Max(_scrollData._extent.Height - extendedViewport.Y, 0.0);
4959extendedViewport.Height = Math.Max(extendedViewport.Height / approxSizeOfLogicalUnit + extendedViewport.Y, 0.0) * approxSizeOfLogicalUnit;
4970extendedViewport.Height = Math.Max(_scrollData._extent.Height - extendedViewport.Y, 0.0) * approxSizeOfLogicalUnit;
4982double factor = Math.Max(1.0, isHorizontal ? extendedViewport.Width / viewport.Width : extendedViewport.Height / viewport.Height);
4983int calcItemsInExtendedViewportCount = (int)Math.Ceiling(factor * _actualItemsInExtendedViewportCount);
4984itemsInExtendedViewportCount = Math.Max(calcItemsInExtendedViewportCount, itemsInExtendedViewportCount);
5095viewport.Width = Math.Max(viewport.Width - sizeAfterStartViewportEdge, 0);
5099cacheBeforeSize = Math.Max(cacheBeforeSize - sizeBeforeStartViewportEdge, 0);
5103cacheBeforeSize = Math.Max(cacheBeforeSize - Math.Floor(logicalSize.Width * sizeBeforeStartViewportEdge / pixelSize.Width), 0);
5130viewport.Width = Math.Max(0, parentViewport.Width - pixelSize.Width);
5145cacheAfterSize = Math.Max(cacheAfterSize - sizeAfterEndViewportEdge, 0);
5149cacheAfterSize = Math.Max(cacheAfterSize - Math.Floor(logicalSize.Width * sizeAfterEndViewportEdge / pixelSize.Width), 0);
5161cacheAfterSize = Math.Max(cacheAfterSize - pixelSize.Width, 0);
5165cacheAfterSize = Math.Max(cacheAfterSize - logicalSize.Width, 0);
5194viewport.Height = Math.Max(viewport.Height - sizeAfterStartViewportEdge, 0);
5198cacheBeforeSize = Math.Max(cacheBeforeSize - sizeBeforeStartViewportEdge, 0);
5202cacheBeforeSize = Math.Max(cacheBeforeSize - Math.Floor(logicalSize.Height * sizeBeforeStartViewportEdge / pixelSize.Height), 0);
5229viewport.Height = Math.Max(0, parentViewport.Height - pixelSize.Height);
5244cacheAfterSize = Math.Max(cacheAfterSize - sizeAfterEndViewportEdge, 0);
5248cacheAfterSize = Math.Max(cacheAfterSize - Math.Floor(logicalSize.Height * sizeAfterEndViewportEdge / pixelSize.Height), 0);
5260cacheAfterSize = Math.Max(cacheAfterSize - pixelSize.Height, 0);
5264cacheAfterSize = Math.Max(cacheAfterSize - logicalSize.Height, 0);
5329cacheBeforeSize = Math.Max(0, cacheBeforeSize - parentViewport.X);
5334viewport.Width = Math.Max(0, viewport.Width + viewport.X);
5354cacheBeforeSize = Math.Max(0, cacheBeforeSize - inset.Right);
5358cacheBeforeSize = Math.Max(0, cacheBeforeSize - 1);
5373viewport.Width = Math.Max(0, viewport.Width - inset.Left);
5384cacheAfterSize = Math.Max(0, cacheAfterSize - (inset.Left - viewport.Width));
5401cacheAfterSize = Math.Max(0, cacheAfterSize - inset.Left);
5405cacheAfterSize = Math.Max(0, cacheAfterSize - 1);
5432cacheBeforeSize = Math.Max(0, cacheBeforeSize - parentViewport.Y);
5437viewport.Height = Math.Max(0, viewport.Height + viewport.Y);
5457cacheBeforeSize = Math.Max(0, cacheBeforeSize - inset.Bottom);
5461cacheBeforeSize = Math.Max(0, cacheBeforeSize - 1);
5476viewport.Height = Math.Max(0, viewport.Height - inset.Top);
5487cacheAfterSize = Math.Max(0, cacheAfterSize - (inset.Top - viewport.Height));
5504cacheAfterSize = Math.Max(0, cacheAfterSize - inset.Top);
5508cacheAfterSize = Math.Max(0, cacheAfterSize - 1);
5564double spanBeforeViewport = Math.Max(isHorizontal ? viewport.X : viewport.Y, 0.0);
5576firstItemInViewportIndex = (int)Math.Floor(spanBeforeViewport / childSize);
6552double eps = (Math.Abs(value1) + Math.Abs(value2)) * Tolerance;
6733childViewport.X = Math.Min(childViewport.X, 0) -
6736childViewport.Width = Math.Max(childViewport.Width - stackPixelSizeInViewport.Width, 0.0);
6741childViewport.Width = Math.Max(childViewport.Width - stackPixelSizeInViewport.Width, 0.0);
6749Math.Max(parentCacheSize.CacheBeforeViewport - stackLogicalSizeInCacheBeforeViewport.Width, 0.0),
6752Math.Max(parentCacheSize.CacheAfterViewport - stackLogicalSizeInCacheAfterViewport.Width, 0.0));
6760Math.Max(parentCacheSize.CacheBeforeViewport - stackPixelSizeInCacheBeforeViewport.Width, 0.0),
6763Math.Max(parentCacheSize.CacheAfterViewport - stackPixelSizeInCacheAfterViewport.Width, 0.0));
6778childViewport.Y = Math.Min(childViewport.Y, 0) -
6782childViewport.Height = Math.Max(childViewport.Height - stackPixelSizeInViewport.Height, 0.0);
6787childViewport.Height = Math.Max(childViewport.Height - stackPixelSizeInViewport.Height, 0.0);
6795Math.Max(parentCacheSize.CacheBeforeViewport - stackLogicalSizeInCacheBeforeViewport.Height, 0.0),
6798Math.Max(parentCacheSize.CacheAfterViewport - stackLogicalSizeInCacheAfterViewport.Height, 0.0));
6806Math.Max(parentCacheSize.CacheBeforeViewport - stackPixelSizeInCacheBeforeViewport.Height, 0.0),
6809Math.Max(parentCacheSize.CacheAfterViewport - stackPixelSizeInCacheAfterViewport.Height, 0.0));
6914childLogicalSize.Width = Math.Max(itemDesiredSizes.LogicalSize.Width, logicalHeaderSize.Width);
6919childLogicalSize.Height = Math.Max(itemDesiredSizes.LogicalSize.Height, logicalHeaderSize.Height);
7118Size frontPixelSize = isHorizontal ? new Size(Math.Max(inset.Left,0), childDesiredSize.Height)
7119: new Size(childDesiredSize.Width, Math.Max(inset.Top, 0));
7132Size backPixelSize = isHorizontal ? new Size(Math.Max(inset.Right,0), childDesiredSize.Height)
7133: new Size(childDesiredSize.Width, Math.Max(inset.Bottom,0));
7146adjustedChildViewport.Width = Math.Max(0, adjustedChildViewport.Width - childPixelSizeInViewport.Width);
7152adjustedChildViewport.Height = Math.Max(0, adjustedChildViewport.Height - childPixelSizeInViewport.Height);
7237pixelSizeBeforeViewport = DoubleUtil.LessThan(childViewport.X, childPixelSize.Width) ? Math.Max(childViewport.X, 0.0) : childPixelSize.Width;
7238pixelSizeInViewport = Math.Min(childViewport.Width, childPixelSize.Width - pixelSizeBeforeViewport);
7239pixelSizeAfterViewport = Math.Max(childPixelSize.Width - pixelSizeInViewport - pixelSizeBeforeViewport, 0.0); // Please note that due to rounding errors this subtraction can lead to negative values. Hence the Math.Max call
7284logicalSizeBeforeViewport = Math.Floor(childLogicalSize.Width * pixelSizeBeforeViewport / childPixelSize.Width);
7285logicalSizeAfterViewport = Math.Floor(childLogicalSize.Width * pixelSizeAfterViewport / childPixelSize.Width);
7293double childPixelHeightInViewport = Math.Min(childViewport.Height, childPixelSize.Height - Math.Max(childViewport.Y, 0.0));
7296childPixelSizeInViewport.Height = Math.Max(childPixelSizeInViewport.Height, childPixelHeightInViewport);
7298childPixelSizeInCacheBeforeViewport.Height = Math.Max(childPixelSizeInCacheBeforeViewport.Height, childPixelHeightInViewport);
7300childPixelSizeInCacheAfterViewport.Height = Math.Max(childPixelSizeInCacheAfterViewport.Height, childPixelHeightInViewport);
7303childLogicalSizeInViewport.Height = Math.Max(childLogicalSizeInViewport.Height, childLogicalSize.Height);
7305childLogicalSizeInCacheBeforeViewport.Height = Math.Max(childLogicalSizeInCacheBeforeViewport.Height, childLogicalSize.Height);
7307childLogicalSizeInCacheAfterViewport.Height = Math.Max(childLogicalSizeInCacheAfterViewport.Height, childLogicalSize.Height);
7329pixelSizeBeforeViewport = DoubleUtil.LessThan(childViewport.Y, childPixelSize.Height) ? Math.Max(childViewport.Y, 0.0) : childPixelSize.Height;
7330pixelSizeInViewport = Math.Min(childViewport.Height, childPixelSize.Height - pixelSizeBeforeViewport);
7331pixelSizeAfterViewport = Math.Max(childPixelSize.Height - pixelSizeInViewport - pixelSizeBeforeViewport, 0.0); // Please note that due to rounding errors this subtraction can lead to negative values. Hence the Math.Max call
7376logicalSizeBeforeViewport = Math.Floor(childLogicalSize.Height * pixelSizeBeforeViewport / childPixelSize.Height);
7377logicalSizeAfterViewport = Math.Floor(childLogicalSize.Height * pixelSizeAfterViewport / childPixelSize.Height);
7385double childPixelWidthInViewport = Math.Min(childViewport.Width, childPixelSize.Width - Math.Max(childViewport.X, 0.0));
7388childPixelSizeInViewport.Width = Math.Max(childPixelSizeInViewport.Width, childPixelWidthInViewport);
7390childPixelSizeInCacheBeforeViewport.Width = Math.Max(childPixelSizeInCacheBeforeViewport.Width, childPixelWidthInViewport);
7392childPixelSizeInCacheAfterViewport.Width = Math.Max(childPixelSizeInCacheAfterViewport.Width, childPixelWidthInViewport);
7395childLogicalSizeInViewport.Width = Math.Max(childLogicalSizeInViewport.Width, childLogicalSize.Width);
7397childLogicalSizeInCacheBeforeViewport.Width = Math.Max(childLogicalSizeInCacheBeforeViewport.Width, childLogicalSize.Width);
7399childLogicalSizeInCacheAfterViewport.Width = Math.Max(childLogicalSizeInCacheAfterViewport.Width, childLogicalSize.Width);
7442sz1.Height = Math.Max(sz1.Height, sz2.Height);
7447sz1.Width = Math.Max(sz1.Width, sz2.Width);
7497childSize = new Size(Math.Max(headerDesiredSizes.PixelSize.Width, itemDesiredSizes.PixelSize.Width),
7502childSize = new Size(Math.Max(headerDesiredSizes.LogicalSize.Width, itemDesiredSizes.LogicalSize.Width),
7586uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes);
7670Math.Max(1, itemDesiredSizes.LogicalSize.Height))
7671: new Size(Math.Max(1, itemDesiredSizes.LogicalSize.Width),
7812Math.Max(uniformOrAverageContainerPixelSize, dpiScale), // don't round down to 0
7822uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes);
8485rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8510previousChildSize.Width = Math.Max(previousChildSize.Width, pixelHeaderSize.Width);
8517rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
8542previousChildSize.Height = Math.Max(previousChildSize.Height, pixelHeaderSize.Height);
8572rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8578rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
8616rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8669rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
9544return Math.Max(0, _firstItemInExtendedViewportIndex);
9552return Math.Min(ItemCount, _firstItemInExtendedViewportIndex + _actualItemsInExtendedViewportCount);
9670_scrollData._maxDesiredSize.Height = Math.Max(_scrollData._maxDesiredSize.Height, stackPixelSize.Height);
9697_scrollData._maxDesiredSize.Width = Math.Max(_scrollData._maxDesiredSize.Width, stackPixelSize.Width);
9723Math.Min(stackPixelSize.Width, constraint.Width) : constraint.Width;
9728Math.Min(stackPixelSize.Height, constraint.Height) : constraint.Height;
9738Debug.Assert(DoubleUtil.AreClose(viewportSize.Width - Math.Floor(viewportSize.Width), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
9739Debug.Assert(DoubleUtil.AreClose(extentSize.Width - Math.Floor(extentSize.Width), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
9743Debug.Assert(DoubleUtil.AreClose(viewportSize.Height - Math.Floor(viewportSize.Height), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
9744Debug.Assert(DoubleUtil.AreClose(extentSize.Height - Math.Floor(extentSize.Height), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
9997double proposedViewportSize = Math.Floor(viewport.Width / approxSizeOfLogicalUnit);
10090if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.X)/extentSize.Width, Math.Floor(_scrollData._offset.X)/_scrollData._extent.Width))
10093viewportOffset.X = Math.Floor((extentSize.Width * Math.Floor(_scrollData._offset.X)) / _scrollData._extent.Width);
10214double proposedViewportSize = Math.Floor(viewport.Height / approxSizeOfLogicalUnit);
10307if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.Y)/extentSize.Height, Math.Floor(_scrollData._offset.Y)/_scrollData._extent.Height))
10310viewportOffset.Y = Math.Floor((extentSize.Height * Math.Floor(_scrollData._offset.Y)) / _scrollData._extent.Height);
10522_scrollData._maxDesiredSize.Height = Math.Max(_scrollData._maxDesiredSize.Height, stackPixelSize.Height);
10549_scrollData._maxDesiredSize.Width = Math.Max(_scrollData._maxDesiredSize.Width, stackPixelSize.Width);
10575Math.Min(stackPixelSize.Width, constraint.Width) : constraint.Width;
10580Math.Min(stackPixelSize.Height, constraint.Height) : constraint.Height;
10590Debug.Assert(DoubleUtil.AreClose(viewportSize.Width - Math.Floor(viewportSize.Width), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
10591Debug.Assert(DoubleUtil.AreClose(extentSize.Width - Math.Floor(extentSize.Width), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
10595Debug.Assert(DoubleUtil.AreClose(viewportSize.Height - Math.Floor(viewportSize.Height), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
10596Debug.Assert(DoubleUtil.AreClose(extentSize.Height - Math.Floor(extentSize.Height), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
10676lastPageSafeOffset = lastPageSafeOffset.HasValue ? Math.Min(computedViewportOffset.X, (double)lastPageSafeOffset) : computedViewportOffset.X;
10679double proposedViewportSize = Math.Floor(viewport.Width / approxSizeOfLogicalUnit);
10761if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.X)/extentSize.Width, Math.Floor(_scrollData._offset.X)/_scrollData._extent.Width))
10764viewportOffset.X = Math.Floor((extentSize.Width * Math.Floor(_scrollData._offset.X)) / _scrollData._extent.Width);
10807lastPageSafeOffset = lastPageSafeOffset.HasValue ? Math.Min(computedViewportOffset.Y, (double)lastPageSafeOffset) : computedViewportOffset.Y;
10810double proposedViewportSize = Math.Floor(viewport.Height / approxSizeOfLogicalUnit);
10892if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.Y)/extentSize.Height, Math.Floor(_scrollData._offset.Y)/_scrollData._extent.Height))
10895viewportOffset.Y = Math.Floor((extentSize.Height * Math.Floor(_scrollData._offset.Y)) / _scrollData._extent.Height);
11193double visibleStart = Math.Max(start, 0);
11194double visibleEnd = Math.Max(Math.Min(end, viewportSize), visibleStart);
11239else if (childIndex > firstChildInView + Math.Max(viewportSize - 1, 0))
11285maxChildLength = Math.Max(maxChildLength, childSize.Height);
11289maxChildLength = Math.Max(maxChildLength, childSize.Width);
11881else if (DoubleUtil.GreaterThan(Math.Abs(newOffset - oldOffset), _viewport.Width))
11897else if (DoubleUtil.GreaterThan(Math.Abs(newOffset - oldOffset), _viewport.Height))
System\Windows\Documents\TextStore.cs (12)
1000milPointTopLeft = new Point(Math.Min(rectPrev.Left, rectCur.Left), Math.Min(rectPrev.Top, rectCur.Top));
1001milPointBottomRight = new Point(Math.Max(rectPrev.Left, rectCur.Left), Math.Max(rectPrev.Bottom, rectCur.Bottom));
2479runCount = TextPointerBase.GetTextWithLimit(navigator, LogicalDirection.Forward, text, charsCopied, Math.Min(cchReq, text.Length - charsCopied), limit);
2880double radSin = Math.Asin(tf.M12 / Math.Sqrt((tf.M11 * tf.M11) + (tf.M12 * tf.M12)));
2881double radCos = Math.Acos(tf.M11 / Math.Sqrt((tf.M11 * tf.M11) + (tf.M12 * tf.M12)));
2883double angleCos = Math.Round((radCos * 180) / Math.PI, 0);
3846int extraCharsAllowed = Math.Max(0, this.TextEditor.MaxLength - currentLength);
System\Windows\FrameworkElement.cs (59)
4059maxHeight = Math.Max(Math.Min(height, maxHeight), minHeight);
4062minHeight = Math.Max(Math.Min(maxHeight, height), minHeight);
4069maxWidth = Math.Max(Math.Min(width, maxWidth), minWidth);
4072minWidth = Math.Max(Math.Min(maxWidth, width), minWidth);
4174Double yCoverD = (yConstrInfinite ? Double.PositiveInfinity : Math.Abs(yConstr/d));
4175Double xCoverA = (xConstrInfinite ? Double.PositiveInfinity : Math.Abs(xConstr/a));
4195h = Math.Min(0.5*Math.Abs(xConstr/c), yCoverD);
4206w = Math.Min( 0.5*Math.Abs(yConstr/b), xCoverA);
4214Double yCoverB = Math.Abs(yConstr/b);
4215Double xCoverC = Math.Abs(xConstr/c);
4235h = Math.Min(0.5*Math.Abs(yConstr/d), xCoverC);
4246w = Math.Min( 0.5*Math.Abs(xConstr/a), yCoverB);
4252Double xCoverA = Math.Abs(xConstr / a); // w-intercept of x-constraint line.
4253Double xCoverC = Math.Abs(xConstr / c); // h-intercept of x-constraint line.
4255Double yCoverB = Math.Abs(yConstr / b); // w-intercept of y-constraint line.
4256Double yCoverD = Math.Abs(yConstr / d); // h-intercept of y-constraint line.
4263w = Math.Min(yCoverB, xCoverA) * 0.5;
4264h = Math.Min(xCoverC, yCoverD) * 0.5;
4281Double expandFactor = Math.Min(xConstr / childBoundsTr.Width,
4340Math.Max(availableSize.Width - marginWidth, 0),
4341Math.Max(availableSize.Height - marginHeight, 0));
4389frameworkAvailableSize.Width = Math.Max(mm.minWidth, Math.Min(frameworkAvailableSize.Width, mm.maxWidth));
4390frameworkAvailableSize.Height = Math.Max(mm.minHeight, Math.Min(frameworkAvailableSize.Height, mm.maxHeight));
4403Math.Max(desiredSize.Width, mm.minWidth),
4404Math.Max(desiredSize.Height, mm.minHeight));
4470ltd.TransformedUnroundedDS = new Size(Math.Max(0, clippedDesiredWidth), Math.Max(0, clippedDesiredHeight));
4517return new Size(Math.Max(0, clippedDesiredWidth), Math.Max(0, clippedDesiredHeight));
4579arrangeSize.Width = Math.Max(0, arrangeSize.Width - marginWidth);
4580arrangeSize.Height = Math.Max(0, arrangeSize.Height - marginHeight);
4589transformedUnroundedDS.Width = Math.Max(0, transformedUnroundedDS.Width - marginWidth);
4590transformedUnroundedDS.Height = Math.Max(0, transformedUnroundedDS.Height- marginHeight);
4599unclippedDesiredSize = new Size(Math.Max(0, this.DesiredSize.Width - marginWidth),
4600Math.Max(0, this.DesiredSize.Height - marginHeight));
4605unclippedDesiredSize.Width = Math.Max(transformedUnroundedDS.Width, unclippedDesiredSize.Width);
4606unclippedDesiredSize.Height = Math.Max(transformedUnroundedDS.Height, unclippedDesiredSize.Height);
4693double effectiveMaxWidth = Math.Max(unclippedDesiredSize.Width, mm.maxWidth);
4700double effectiveMaxHeight = Math.Max(unclippedDesiredSize.Height, mm.maxHeight);
4731Size clippedInkSize = new Size(Math.Min(innerInkSize.Width, mm.maxWidth),
4732Math.Min(innerInkSize.Height, mm.maxHeight));
4764Size clientSize = new Size(Math.Max(0, finalRect.Width - marginWidth),
4765Math.Max(0, finalRect.Height - marginHeight));
4914inkSize.Width = Math.Min(inkSize.Width, mm.maxWidth);
4915inkSize.Height = Math.Min(inkSize.Height, mm.maxHeight);
4932Size clippingSize = new Size(Math.Max(0, layoutSlotSize.Width - marginWidth),
4933Math.Max(0, layoutSlotSize.Height - marginHeight));
5245inkSize.Width = Math.Min(inkSize.Width, mm.maxWidth);
5246inkSize.Height = Math.Min(inkSize.Height, mm.maxHeight);
System\Windows\Shell\WindowChromeWorker.cs (23)
1065double shortestDimension = Math.Min(windowSize.Width, windowSize.Height);
1068topLeftRadius = Math.Min(topLeftRadius, shortestDimension / 2);
1084topRightRadius = Math.Min(topRightRadius, shortestDimension / 2);
1092bottomLeftRadius = Math.Min(bottomLeftRadius, shortestDimension / 2);
1100bottomRightRadius = Math.Min(bottomRightRadius, shortestDimension / 2);
1127(int)Math.Floor(region.Left),
1128(int)Math.Floor(region.Top),
1129(int)Math.Ceiling(region.Right),
1130(int)Math.Ceiling(region.Bottom));
1135(int)Math.Floor(region.Left),
1136(int)Math.Floor(region.Top),
1137(int)Math.Ceiling(region.Right) + 1,
1138(int)Math.Ceiling(region.Bottom) + 1,
1139(int)Math.Ceiling(radius),
1140(int)Math.Ceiling(radius));
1228deviceGlassThickness.Top = Math.Max(0, deviceGlassThickness.Top);
1233deviceGlassThickness.Left = Math.Max(0, deviceGlassThickness.Left);
1238deviceGlassThickness.Bottom = Math.Max(0, deviceGlassThickness.Bottom);
1243deviceGlassThickness.Right = Math.Max(0, deviceGlassThickness.Right);
1250cxLeftWidth = (int)Math.Ceiling(deviceGlassThickness.Left),
1251cxRightWidth = (int)Math.Ceiling(deviceGlassThickness.Right),
1252cyTopHeight = (int)Math.Ceiling(deviceGlassThickness.Top),
1253cyBottomHeight = (int)Math.Ceiling(deviceGlassThickness.Bottom),
System\Windows\Window.cs (30)
1769frameworkAvailableSize.Width = Math.Max(mm.minWidth, Math.Min(frameworkAvailableSize.Width, mm.maxWidth));
1770frameworkAvailableSize.Height = Math.Max(mm.minHeight, Math.Min(frameworkAvailableSize.Height, mm.maxHeight));
1777Math.Max(desiredSize.Width, mm.minWidth),
1778Math.Max(desiredSize.Height, mm.minHeight));
1799arrangeBounds.Width = Math.Max(mm.minWidth, Math.Min(arrangeBounds.Width, mm.maxWidth));
1800arrangeBounds.Height = Math.Max(mm.minHeight, Math.Min(arrangeBounds.Height, mm.maxHeight));
1834childArrangeBounds.Width = Math.Max(0.0, arrangeBounds.Width - frameSize.Width);
1835childArrangeBounds.Height = Math.Max(0.0, arrangeBounds.Height - frameSize.Height);
3311childConstraint.Width = ((constraint.Width == Double.PositiveInfinity) ? Double.PositiveInfinity : Math.Max(0.0, (constraint.Width - frameSize.Width)));
3312childConstraint.Height = ((constraint.Height == Double.PositiveInfinity) ? Double.PositiveInfinity : Math.Max(0.0, (constraint.Height - frameSize.Height)));
3356maxWidthDeviceUnits = Math.Max(_trackMaxWidthDeviceUnits, _windowMaxWidthDeviceUnits);
3357maxHeightDeviceUnits = Math.Max(_trackMaxHeightDeviceUnits, _windowMaxHeightDeviceUnits);
3366mm.minWidth = Math.Max(this.MinWidth, minSizeLogicalUnits.X);
3371mm.maxWidth = Math.Min(MinWidth, maxSizeLogicalUnits.X);
3377mm.maxWidth = Math.Min(MaxWidth, maxSizeLogicalUnits.X);
3388mm.minHeight = Math.Max(this.MinHeight, minSizeLogicalUnits.Y);
3393mm.maxHeight = Math.Min(this.MinHeight, maxSizeLogicalUnits.Y);
3399mm.maxHeight = Math.Min(MaxHeight, maxSizeLogicalUnits.Y);
3769leftDeviceUnits = Math.Min(leftDeviceUnits, workAreaRectDeviceUnits.right - currentSizeDeviceUnits.Width);
3770leftDeviceUnits = Math.Max(leftDeviceUnits, workAreaRectDeviceUnits.left);
3771topDeviceUnits = Math.Min(topDeviceUnits, workAreaRectDeviceUnits.bottom - currentSizeDeviceUnits.Height);
3772topDeviceUnits = Math.Max(topDeviceUnits, workAreaRectDeviceUnits.top);
4632_windowMaxWidthDeviceUnits = Math.Max(_windowMaxWidthDeviceUnits, windowSize.X);
4633_windowMaxHeightDeviceUnits = Math.Max(_windowMaxHeightDeviceUnits, windowSize.Y);
7523return new Size(Math.Max(0.0, pt.X), Math.Max(0.0, pt.Y));
PresentationFramework.Aero (21)
PresentationFramework.Aero2 (21)
PresentationFramework.AeroLite (14)
PresentationFramework.Classic (23)
Microsoft\Windows\Themes\ClassicBorderDecorator.cs (11)
239float min = Math.Min(rgbColor.Red, Math.Min(rgbColor.Green, rgbColor.Blue));
240float max = Math.Max(rgbColor.Red, Math.Max(rgbColor.Green, rgbColor.Blue));
272saturation = Math.Max(0.0f, Math.Min(saturation, 1.0f));
327float hue = (float)((hlsColor.Hue - Math.Floor(hlsColor.Hue)) * 6);
603Math.Max(0.0, rt.Width - thick.Left - thick.Right),
604Math.Max(0.0, rt.Height - thick.Top - thick.Bottom));
692desired = new Size(Math.Min(borderSize.Width, availableSize.Width), Math.Min(borderSize.Height, availableSize.Height));
PresentationFramework.Luna (27)
PresentationFramework.Royale (26)
PresentationUI (6)
ReachFramework (93)
AlphaFlattener\BrushProxy.cs (32)
516rb.RadiusX = Math.Abs(rb.RadiusX * bounds.Width);
517rb.RadiusY = Math.Abs(rb.RadiusY * bounds.Height);
1916double length = Math.Sqrt(dx * dx + dy * dy);
1930stopDistance = Math.Max(b.RadiusX, b.RadiusY) * (second.Offset - first.Offset);
1948int stopCount = (int)Math.Ceiling(-6.297427 + 4.591693 * Math.Log(stopDistance));
2287double height = Math.Abs(start.Y - end.Y) * multiplier;
2296double width = Math.Abs(start.X - end.X) * multiplier;
2577if (Utility.AreClose(new Vector(Math.Abs(rbA.RadiusX), Math.Abs(rbA.RadiusY)) * rbA.Transform.Value,
2578new Vector(Math.Abs(rbB.RadiusX), Math.Abs(rbB.RadiusY)) * rbB.Transform.Value))
3746min = Math.Min(min, offset);
3747max = Math.Max(max, offset);
3873return Math.Sqrt(sum);
3902return (int)Math.Ceiling(Math.Max(5, step)); // At least five. Radials look bad with less steps.
3951if (Math.Abs(di) < Double.Epsilon)
4045double right = Math.Ceiling(_bounds.Right / _bandDelta);
4046double left = Math.Floor(_bounds.Left / _bandDelta);
4145double rotateAngle = Math.Atan2(-gradientVector.Y, gradientVector.X) * 180.0 / Math.PI;
4190_rx = Math.Abs(b.RadiusX);
4191_ry = Math.Abs(b.RadiusY);
4272double right = Math.Ceiling(maxt * _bandSteps);
4273double left = Math.Floor(mint * _bandSteps);
4388double root = Math.Sqrt(B4AC);
4397maxt = Math.Max(maxt, one);
4398mint = Math.Min(mint, one);
4405maxt = Math.Max(maxt, two);
4406mint = Math.Min(mint, two);
4431double len = Math.Sqrt(dx * dx + dy * dy);
Serialization\VisualSerializer.cs (10)
476scalex = Math.Min(dstwidth / srcwidth, dstheight / srcheight);
481scalex = Math.Max(dstwidth / srcwidth, dstheight / srcheight);
757WriteAttr("RadiusX", Math.Abs(rb.RadiusX * bounds.Width));
758WriteAttr("RadiusY", Math.Abs(rb.RadiusY * bounds.Height));
924WriteAttr("StrokeThickness", Math.Abs(pen.Thickness));
934WriteAttr("StrokeMiterLimit", Math.Max(1.0, pen.MiterLimit));
956dashes.Add(Math.Abs(d));
2266WriteAttr("Opacity", Math.Min(Math.Max( opacity, 0.0),1.0));
2329SetCoordinateFormat(Math.Min(Utility.GetScaleX(mat), Utility.GetScaleY(mat)));
SignalRSamples (2)
Sockets.FunctionalTests (3)
Swaggatherer (2)
System.Collections (5)
System.Collections.Concurrent (8)
System.Collections.Immutable (11)
System.ComponentModel.TypeConverter (6)
System.Console (3)
System.Data.Common (88)
System\Data\SQLTypes\SQLDecimal.cs (26)
414precision = Math.Max(precision, _bScale);
680double dInt = Math.Floor(dVal);
687dVal = Math.Floor(dInt / s_DUINT_BASE);
693dVal = Math.Floor(dInt / s_DUINT_BASE);
700dVal = Math.Floor(dInt / s_DUINT_BASE);
707dVal = Math.Floor(dInt / s_DUINT_BASE);
766dFrac -= Math.Floor(dFrac);
1138dRet /= System.Math.Pow(10.0, _bScale);
1251ResInteger = Math.Max(x._bPrec - MyScale, y._bPrec - OpScale);
1255ResScale = Math.Max(MyScale, OpScale);
1261ResPrec = Math.Min(MaxPrecision, ResPrec);
1465ResScale = Math.Min((ResPrec - ResInteger), ResScale);
1467ResScale = Math.Max(ResScale, Math.Min(ActualScale, s_cNumeDivScaleMin));
1688ResScale = Math.Max(x._bScale + y._bPrec + 1, s_cNumeDivScaleMin);
1691MinScale = Math.Min(ResScale, s_cNumeDivScaleMin);
1693ResInteger = Math.Min(ResInteger, s_NUMERIC_MAX_PRECISION);
1700ResScale = Math.Min((ResPrec - ResInteger), ResScale);
1701ResScale = Math.Max(ResScale, MinScale);
2297bNewPrec = (byte)(Math.Min(s_NUMERIC_MAX_PRECISION, Math.Max(1, lAdjust + _bPrec)));
3168lPosition = Math.Min(s_NUMERIC_MAX_PRECISION, lPosition);
3175lPosition = Math.Max(-s_NUMERIC_MAX_PRECISION, lPosition);
3186int lAdjust = Math.Abs(lPosition - n._bScale); // Precision adjustment
3225lAdjust = Math.Abs(lPosition - n._bScale);
3261n = new SqlDecimal(Math.Pow(dBaseNum, exp));
System.Diagnostics.DiagnosticSource (8)
System.Diagnostics.Process (6)
System.Diagnostics.TextWriterTraceListener (1)
System.Drawing.Primitives (32)
System\Drawing\Rectangle.cs (16)
182(int)Math.Ceiling(value.X),
183(int)Math.Ceiling(value.Y),
184(int)Math.Ceiling(value.Width),
185(int)Math.Ceiling(value.Height));
212(int)Math.Round(value.X),
213(int)Math.Round(value.Y),
214(int)Math.Round(value.Width),
215(int)Math.Round(value.Height));
290int x1 = Math.Max(a.X, b.X);
291int x2 = Math.Min(a.X + a.Width, b.X + b.Width);
292int y1 = Math.Max(a.Y, b.Y);
293int y2 = Math.Min(a.Y + a.Height, b.Y + b.Height);
315int x1 = Math.Min(a.X, b.X);
316int x2 = Math.Max(a.X + a.Width, b.X + b.Width);
317int y1 = Math.Min(a.Y, b.Y);
318int y2 = Math.Max(a.Y + a.Height, b.Y + b.Height);
System.Formats.Asn1 (7)
System.Formats.Tar (13)
System.IO.Compression (6)
System.IO.FileSystem.Watcher (2)
System.IO.Hashing (1)
System.IO.Pipelines (8)
System.Linq (15)
System.Linq.Expressions (8)
System.Linq.Parallel (5)
System.Memory (4)
System.Memory.Data (1)
System.Net.Http (48)
System.Net.HttpListener (10)
System.Net.Mail (7)
System.Net.NameResolution (1)
System.Net.NetworkInformation (1)
System.Net.Ping (4)
System.Net.Primitives (8)
System.Net.Quic (5)
System.Net.Requests (4)
System.Net.Security (6)
System.Net.Sockets (5)
System.Net.WebClient (6)
System.Net.WebSockets (5)
System.Numerics.Tensors (22)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IAggregationOperator.cs (6)
226(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector128<T>.Count);
395(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector256<T>.Count);
564(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector512<T>.Count);
1323(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector128<T>.Count);
1514(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector256<T>.Count);
1705(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector512<T>.Count);
System.Private.CoreLib (530)
src\libraries\System.Private.CoreLib\src\System\Byte.cs (4)
279public static (byte Quotient, byte Remainder) DivRem(byte left, byte right) => Math.DivRem(left, right);
525public static byte Clamp(byte value, byte min, byte max) => Math.Clamp(value, min, max);
531public static byte Max(byte x, byte y) => Math.Max(x, y);
537public static byte Min(byte x, byte y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (63)
182ulong high = Math.BigMul(a, b, out ulong low);
334(ulong quo64, bufNum.Low64) = Math.DivRem(num, den);
376ulong prod = Math.BigMul(quo, (uint)den); // quo * lo divisor
422ulong prod1 = Math.BigMul(quo, bufDen.U0); // quo * lo divisor
423ulong prod2 = Math.BigMul(quo, bufDen.U1); // quo * mid divisor
482ulong tmp = Math.BigMul(bufNum.U0, power);
485tmp += Math.BigMul(bufNum.U1, power);
488tmp += Math.BigMul(bufNum.U2, power);
495ulong tmp = Math.BigMul(bufNum.U0, power);
498tmp += Math.BigMul(bufNum.U1, power);
674(quotient, remainder) = Math.DivRem(high, power);
914low64 = Math.BigMul((uint)low64, UInt32Powers10[scale]);
918low64 = Math.BigMul((uint)low64, TenToPowerNine);
927tmpLow = Math.BigMul((uint)low64, power);
928tmp64 = Math.BigMul((uint)(low64 >> 32), power) + (tmpLow >> 32);
943tmpLow = Math.BigMul((uint)low64, power);
944tmp64 = Math.BigMul((uint)(low64 >> 32), power) + (tmpLow >> 32);
947tmp64 += Math.BigMul(high, power);
979tmp64 += Math.BigMul(rgulNum[cur], power);
1182ulong high = Math.BigMul(pwr, pdecIn.Mid);
1185ulong low = Math.BigMul(pwr, pdecIn.Low);
1270ulong tmpLow = Math.BigMul((uint)low64, power);
1271ulong tmp = Math.BigMul((uint)(low64 >> 32), power) + (tmpLow >> 32);
1274tmp += Math.BigMul(high, power);
1317ulong low64 = Math.BigMul(d1.Low, d2.Low);
1330(low64, ulong remainder) = Math.DivRem(low64, power);
1348tmp = Math.BigMul(d1.Low, d2.Low);
1351tmp = Math.BigMul(d1.Low, d2.Mid) + (tmp >> 32);
1357tmp += Math.BigMul(d1.Low, d2.High);
1372tmp = Math.BigMul(d2.Low, d1.Low);
1375tmp = Math.BigMul(d2.Low, d1.Mid) + (tmp >> 32);
1381tmp += Math.BigMul(d2.Low, d1.High);
1416tmp = Math.BigMul(d1.Low, d2.Low);
1419ulong tmp2 = Math.BigMul(d1.Low, d2.Mid) + (tmp >> 32);
1421tmp = Math.BigMul(d1.Mid, d2.Low);
1429tmp = Math.BigMul(d1.Mid, d2.Mid) + tmp2;
1435tmp2 = Math.BigMul(d1.Low, d2.High);
1441tmp2 = Math.BigMul(d1.High, d2.Low);
1448tmp = Math.BigMul(d1.Mid, d2.High);
1454tmp2 = Math.BigMul(d1.High, d2.Mid);
1461bufProd.High64 = Math.BigMul(d1.High, d2.High) + tmp;
1565mant = (uint)(int)Math.Round(dbl);
1584result.Low64 = Math.BigMul(mant, UInt32Powers10[power]);
1592ulong low64 = Math.BigMul(mant, UInt32Powers10[power - 18]);
1597ulong low64 = Math.BigMul(mant, UInt32Powers10[power - 9]);
1598ulong hi64 = Math.BigMul(TenToPowerNine, (uint)(low64 >> 32));
1599low64 = Math.BigMul(TenToPowerNine, (uint)low64);
1624(uint div, uint rem) = Math.DivRem(mant, 10000);
1635(uint div, uint rem) = Math.DivRem(mant, 100);
1646(uint div, uint rem) = Math.DivRem(mant, 10);
1729mant = (ulong)(long)Math.Round(dbl);
1749ulong low64 = Math.BigMul((uint)mant, pow10);
1750ulong hi64 = Math.BigMul((uint)(mant >> 32), pow10);
1910curScale = Math.Min(9, -scale);
1954ulong num = Math.BigMul(remainder, power);
2005curScale = Math.Min(9, -scale);
2067curScale = Math.Min(9, -scale);
2187ulong tmp = Math.BigMul(d2.Low, power);
2214ulong tmp = Math.BigMul(bufQuo.U0, power);
2275ulong tmp64 = Math.BigMul(b.Buf24.U0, power);
2280tmp64 += Math.BigMul(buf[i], power);
2364(d.uhi, remainder) = Math.DivRem(n, divisor);
2405(d.uhi, remainder) = Math.DivRem(n, power);
src\libraries\System.Private.CoreLib\src\System\Double.cs (57)
67public const double E = Math.E;
71public const double Pi = Math.PI;
75public const double Tau = Math.Tau;
579public static double Log2(double value) => Math.Log2(value);
633public static double Exp(double x) => Math.Exp(x);
636public static double ExpM1(double x) => Math.Exp(x) - 1;
639public static double Exp2(double x) => Math.Pow(2, x);
642public static double Exp2M1(double x) => Math.Pow(2, x) - 1;
645public static double Exp10(double x) => Math.Pow(10, x);
648public static double Exp10M1(double x) => Math.Pow(10, x) - 1;
656public static double Ceiling(double x) => Math.Ceiling(x);
682public static double Floor(double x) => Math.Floor(x);
686public static double Round(double x) => Math.Round(x);
689public static double Round(double x, int digits) => Math.Round(x, digits);
692public static double Round(double x, MidpointRounding mode) => Math.Round(x, mode);
695public static double Round(double x, int digits, MidpointRounding mode) => Math.Round(x, digits, mode);
699public static double Truncate(double x) => Math.Truncate(x);
826static double IFloatingPointConstants<double>.E => Math.E;
855public static double Atan2(double y, double x) => Math.Atan2(y, x);
861public static double BitDecrement(double x) => Math.BitDecrement(x);
864public static double BitIncrement(double x) => Math.BitIncrement(x);
868public static double FusedMultiplyAdd(double left, double right, double addend) => Math.FusedMultiplyAdd(left, right, addend);
871public static double Ieee754Remainder(double left, double right) => Math.IEEERemainder(left, right);
874public static int ILogB(double x) => Math.ILogB(x);
881public static double ReciprocalEstimate(double x) => Math.ReciprocalEstimate(x);
885public static double ReciprocalSqrtEstimate(double x) => Math.ReciprocalSqrtEstimate(x);
888public static double ScaleB(double x, int n) => Math.ScaleB(x, n);
899public static double Acosh(double x) => Math.Acosh(x);
903public static double Asinh(double x) => Math.Asinh(x);
907public static double Atanh(double x) => Math.Atanh(x);
911public static double Cosh(double x) => Math.Cosh(x);
915public static double Sinh(double x) => Math.Sinh(x);
919public static double Tanh(double x) => Math.Tanh(x);
934public static double Log(double x) => Math.Log(x);
937public static double Log(double x, double newBase) => Math.Log(x, newBase);
940public static double LogP1(double x) => Math.Log(x + 1);
943public static double Log2P1(double x) => Math.Log2(x + 1);
947public static double Log10(double x) => Math.Log10(x);
950public static double Log10P1(double x) => Math.Log10(x + 1);
988public static double Clamp(double value, double min, double max) => Math.Clamp(value, min, max);
991public static double CopySign(double value, double sign) => Math.CopySign(value, sign);
995public static double Max(double x, double y) => Math.Max(x, y);
1022public static double Min(double x, double y) => Math.Min(x, y);
1048public static int Sign(double value) => Math.Sign(value);
1065public static double Abs(double value) => Math.Abs(value);
1161public static double MaxMagnitude(double x, double y) => Math.MaxMagnitude(x, y);
1191public static double MinMagnitude(double x, double y) => Math.MinMagnitude(x, y);
1497public static double Pow(double x, double y) => Math.Pow(x, y);
1505public static double Cbrt(double x) => Math.Cbrt(x);
1789public static double Sqrt(double x) => Math.Sqrt(x);
1821public static double Acos(double x) => Math.Acos(x);
1831public static double Asin(double x) => Math.Asin(x);
1841public static double Atan(double x) => Math.Atan(x);
1851public static double Cos(double x) => Math.Cos(x);
1962public static double Sin(double x) => Math.Sin(x);
1965public static (double Sin, double Cos) SinCos(double x) => Math.SinCos(x);
2170public static double Tan(double x) => Math.Tan(x);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (8)
464FormatDigits(ref result, hour12, Math.Min(tokenLen, 2));
469FormatDigits(ref result, dateTime.Hour, Math.Min(tokenLen, 2));
474FormatDigits(ref result, dateTime.Minute, Math.Min(tokenLen, 2));
479FormatDigits(ref result, dateTime.Second, Math.Min(tokenLen, 2));
638FormatDigits(ref result, year, Math.Min(tokenLen, 2));
824(int tens, int ones) = Math.DivRem(offset.Hours, 10);
1499(int offsetHours, int offsetMinutes) = Math.DivRem(offsetTotalMinutes, 60);
1703(int offsetHours, offsetMinutes) = Math.DivRem(offsetMinutes, 60);
src\libraries\System.Private.CoreLib\src\System\Int16.cs (7)
282public static (short Quotient, short Remainder) DivRem(short left, short right) => Math.DivRem(left, right);
629public static short Clamp(short value, short min, short max) => Math.Clamp(value, min, max);
645Math.ThrowNegateTwosCompOverflow();
655public static short Max(short x, short y) => Math.Max(x, y);
661public static short Min(short x, short y) => Math.Min(x, y);
667public static int Sign(short value) => Math.Sign(value);
683public static short Abs(short value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\Int32.cs (7)
291public static (int Quotient, int Remainder) DivRem(int left, int right) => Math.DivRem(left, right);
664public static int Clamp(int value, int min, int max) => Math.Clamp(value, min, max);
680Math.ThrowNegateTwosCompOverflow();
690public static int Max(int x, int y) => Math.Max(x, y);
696public static int Min(int x, int y) => Math.Min(x, y);
702public static int Sign(int value) => Math.Sign(value);
718public static int Abs(int value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\Int64.cs (7)
288public static (long Quotient, long Remainder) DivRem(long left, long right) => Math.DivRem(left, right);
661public static long Clamp(long value, long min, long max) => Math.Clamp(value, min, max);
677Math.ThrowNegateTwosCompOverflow();
687public static long Max(long x, long y) => Math.Max(x, y);
693public static long Min(long x, long y) => Math.Min(x, y);
699public static int Sign(long value) => Math.Sign(value);
715public static long Abs(long value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (7)
299public static (nint Quotient, nint Remainder) DivRem(nint left, nint right) => Math.DivRem(left, right);
672public static nint Clamp(nint value, nint min, nint max) => Math.Clamp(value, min, max);
688Math.ThrowNegateTwosCompOverflow();
698public static nint Max(nint x, nint y) => Math.Max(x, y);
704public static nint Min(nint x, nint y) => Math.Min(x, y);
710public static int Sign(nint value) => Math.Sign(value);
726public static nint Abs(nint value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (36)
615nMaxDigits = Math.Max(number.DigitsCount, DoublePrecision);
726nMaxDigits = Math.Max(number.DigitsCount, SinglePrecision);
821nMaxDigits = Math.Max(number.DigitsCount, HalfPrecision);
1623int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length;
1649int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length;
1678int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value));
1697int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value));
1734int bufferLength = Math.Max(digits, 32 - (int)uint.LeadingZeroCount(value));
1753int bufferLength = Math.Max(digits, 32 - (int)uint.LeadingZeroCount(value));
1828(value, uint remainder) = Math.DivRem(value, 100);
1870(value, uint remainder) = Math.DivRem(value, 100);
1898(value, remainder) = Math.DivRem(value, 100);
1905(value, remainder) = Math.DivRem(value, 10);
1952int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
1988int bufferLength = Math.Max(digits, countedDigits);
2056int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length;
2082int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length;
2111int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value));
2130int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value));
2183int bufferLength = Math.Max(digits, 64 - (int)ulong.LeadingZeroCount(value));
2202int bufferLength = Math.Max(digits, 64 - (int)ulong.LeadingZeroCount(value));
2299(value, ulong remainder) = Math.DivRem(value, 100);
2338(value, remainder) = Math.DivRem(value, 100);
2345(value, remainder) = Math.DivRem(value, 10);
2380int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
2415int bufferLength = Math.Max(digits, countedDigits);
2484int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length;
2512int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length;
2543int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits(uValue));
2564int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits(uValue));
2593return Int64ToHexChars(buffer, lower, hexBase, Math.Max(digits, 1));
2606int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value));
2627int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value));
2656return UInt64ToBinaryChars(buffer, lower, Math.Max(digits, 1));
2742int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
2756int bufferLength = Math.Max(digits, countedDigits);
src\libraries\System.Private.CoreLib\src\System\SByte.cs (7)
285public static (sbyte Quotient, sbyte Remainder) DivRem(sbyte left, sbyte right) => Math.DivRem(left, right);
590public static sbyte Clamp(sbyte value, sbyte min, sbyte max) => Math.Clamp(value, min, max);
606Math.ThrowNegateTwosCompOverflow();
616public static sbyte Max(sbyte x, sbyte y) => Math.Max(x, y);
622public static sbyte Min(sbyte x, sbyte y) => Math.Min(x, y);
628public static int Sign(sbyte value) => Math.Sign(value);
644public static sbyte Abs(sbyte value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (18)
135capacity = Math.Max(capacity, length);
159capacity = Math.Min(DefaultCapacity, maxCapacity);
207persistedCapacity = Math.Min(Math.Max(DefaultCapacity, persistedString.Length), persistedMaxCapacity);
417int capacityToPreserve = Math.Min(Capacity, Math.Max(Length * 6 / 5, m_ChunkChars.Length));
845int length = Math.Min(m_ChunkChars.Length - m_ChunkLength, count);
849length = Math.Min(m_ChunkChars.Length - m_ChunkLength, count);
908chunkEndIndex = Math.Min(chunkEndIndex, chunk.m_ChunkLength);
2108ReadOnlySpan<char> remainingChunk = chunk.m_ChunkChars.AsSpan(indexInChunk, Math.Min(chunk.m_ChunkLength - indexInChunk, count));
2144Debug.Assert(oldValue.Length > Math.Min(count, chunk.m_ChunkLength - indexInChunk),
2230int curInChunk = Math.Max(startIndexInChunk, 0);
2231int endInChunk = Math.Min(chunk.m_ChunkLength, endIndexInChunk);
2475int lengthToCopy = Math.Min(lengthInChunk, count);
2561int newBlockLength = Math.Max(minBlockCharCount, Math.Min(Length, MaxChunkSize));
2669StringBuilder newChunk = new StringBuilder(Math.Max(count, DefaultCapacity), chunk.m_MaxCapacity, chunk.m_ChunkPrevious);
2673int copyCount1 = Math.Min(count, indexInChunk);
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.Blocking.cs (14)
15return Math.Min(_separated.counts.NumThreadsGoal, TargetThreadsGoalForBlockingAdjustment);
28: (short)Math.Min((ushort)(_minThreads + _numBlockedThreads), (ushort)_maxThreads);
146short toSubtract = Math.Min((short)(numThreadsGoal - targetThreadsGoal), _numThreadsAddedDueToBlocking);
157(short)Math.Min((ushort)(_minThreads + BlockingConfig.ThreadsToAddWithoutDelay), (ushort)_maxThreads);
164Math.Max(configuredMaxThreadsWithoutDelay, Math.Min(counts.NumExistingThreads, _maxThreads));
165short targetThreadsGoalWithoutDelay = Math.Min(targetThreadsGoal, maxThreadsGoalWithoutDelay);
221newNumThreadsGoal = (short)Math.Min(newNumThreadsGoal, achievableNumThreadsGoal);
249return Math.Min((uint)delayStepCount * BlockingConfig.DelayStepMs, BlockingConfig.MaxDelayMs);
327blocking_threadsPerDelayStep_procCountFactor = Math.Max(1, blocking_threadsPerDelayStep_procCountFactor);
337MaxDelayMs = Math.Max(1, Math.Min(MaxDelayMs, GateThread.GateActivitiesPeriodMs));
338DelayStepMs = Math.Max(1, Math.Min(DelayStepMs, MaxDelayMs));
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.HillClimbing.cs (21)
200int sampleCount = ((int)Math.Min(_totalSamples - 1, _samplesToMeasure)) / _wavePeriod * _wavePeriod;
235throughputErrorEstimate = Math.Max(throughputErrorEstimate, (GetWaveComponent(_samples, sampleCount, adjacentPeriod2) / averageThroughput).Abs());
271double noiseForConfidence = Math.Max(_averageThroughputNoise, throughputErrorEstimate);
288double move = Math.Min(1.0, Math.Max(-1.0, ratio.Real));
293move *= Math.Min(1.0, Math.Max(0.0, confidence));
301move = Math.Pow(Math.Abs(move), _gainExponent) * (move >= 0.0 ? 1 : -1) * gain;
302move = Math.Min(move, _maxChangePerSample);
321newThreadWaveMagnitude = Math.Min(newThreadWaveMagnitude, _maxThreadWaveMagnitude);
322newThreadWaveMagnitude = Math.Max(newThreadWaveMagnitude, 1);
332_currentControlSetting = Math.Min(maxThreads - newThreadWaveMagnitude, _currentControlSetting);
333_currentControlSetting = Math.Max(minThreads, _currentControlSetting);
343newThreadCount = Math.Min(maxThreads, newThreadCount);
344newThreadCount = Math.Max(minThreads, newThreadCount);
377newSampleInterval = (int)(0.5 + _currentSampleMs * (10.0 * Math.Min(-ratio.Real, 1.0)));
413entry.lastHistoryCount = (int)(Math.Min(_totalSamples, _samplesToMeasure) / _wavePeriod) * _wavePeriod;
447double w = 2 * Math.PI / period;
448double cos = Math.Cos(w);
457return new Complex(q1 - q2 * cos, q2 * Math.Sin(w)) / numSamples;
src\libraries\System.Private.CoreLib\src\System\TimeSpan.cs (17)
351Int128 totalMicroseconds = Math.BigMul(days, MicrosecondsPerDay)
352+ Math.BigMul(hours, MicrosecondsPerHour)
353+ Math.BigMul(minutes, MicrosecondsPerMinute)
354+ Math.BigMul(seconds, MicrosecondsPerSecond)
355+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
387Int128 totalMicroseconds = Math.BigMul(hours, MicrosecondsPerHour)
388+ Math.BigMul(minutes, MicrosecondsPerMinute)
389+ Math.BigMul(seconds, MicrosecondsPerSecond)
390+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
421Int128 totalMicroseconds = Math.BigMul(minutes, MicrosecondsPerMinute)
422+ Math.BigMul(seconds, MicrosecondsPerSecond)
423+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
453Int128 totalMicroseconds = Math.BigMul(seconds, MicrosecondsPerSecond)
454+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
472Int128 totalMicroseconds = Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
783double ticks = Math.Round(timeSpan.Ticks * factor);
798double ticks = Math.Round(timeSpan.Ticks / divisor);
src\libraries\System.Private.CoreLib\src\System\UInt16.cs (4)
276public static (ushort Quotient, ushort Remainder) DivRem(ushort left, ushort right) => Math.DivRem(left, right);
554public static ushort Clamp(ushort value, ushort min, ushort max) => Math.Clamp(value, min, max);
560public static ushort Max(ushort x, ushort y) => Math.Max(x, y);
566public static ushort Min(ushort x, ushort y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\UInt32.cs (4)
286public static (uint Quotient, uint Remainder) DivRem(uint left, uint right) => Math.DivRem(left, right);
587public static uint Clamp(uint value, uint min, uint max) => Math.Clamp(value, min, max);
593public static uint Max(uint x, uint y) => Math.Max(x, y);
599public static uint Min(uint x, uint y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\UInt64.cs (4)
285public static (ulong Quotient, ulong Remainder) DivRem(ulong left, ulong right) => Math.DivRem(left, right);
586public static ulong Clamp(ulong value, ulong min, ulong max) => Math.Clamp(value, min, max);
592public static ulong Max(ulong x, ulong y) => Math.Max(x, y);
598public static ulong Min(ulong x, ulong y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (4)
295public static (nuint Quotient, nuint Remainder) DivRem(nuint left, nuint right) => Math.DivRem(left, right);
605public static nuint Clamp(nuint value, nuint min, nuint max) => Math.Clamp(value, min, max);
611public static nuint Max(nuint x, nuint y) => Math.Max(x, y);
617public static nuint Min(nuint x, nuint y) => Math.Min(x, y);
System.Private.CoreLib.Generators (3)
System.Private.DataContractSerialization (52)
System\Xml\XmlBaseReader.cs (6)
1148actual = Math.Min(count, value.Length);
1178return ReadBytes(DataContractSerializer.Base64Encoding, 3, 4, buffer, offset, Math.Min(count, 512), false);
1370return ReadBytes(DataContractSerializer.Base64Encoding, 3, 4, buffer, offset, Math.Min(count, 512), true);
1390return ReadBytes(DataContractSerializer.BinHexEncoding, 1, 2, buffer, offset, Math.Min(count, 512), true);
1425int actual = Math.Min(_trailByteCount, byteCount);
1493int actual = Math.Min(_trailByteCount, byteCount);
System\Xml\XmlBinaryReader.cs (15)
881int maxLength = Math.Max(_maxBytesPerRead - maxTextNodeLength, 0);
893int actual = Math.Max(maxLength - maxTextNodeLength, 0);
951int maxLength = Math.Max(_maxBytesPerRead - maxTextNodeLength, 0);
963int actual = Math.Max(maxLength - maxTextNodeLength, 0);
993int maxBytesPerRead = Math.Max(_maxBytesPerRead - nodeLength, 0);
1240int actual = Math.Min(count, _arrayCount);
1263int actual = Math.Min(count, _arrayCount);
1286int actual = Math.Min(count, _arrayCount);
1309int actual = Math.Min(count, _arrayCount);
1332int actual = Math.Min(count, _arrayCount);
1355int actual = Math.Min(count, _arrayCount);
1378int actual = Math.Min(count, _arrayCount);
1402int actual = Math.Min(count, _arrayCount);
1431int actual = Math.Min(count, _arrayCount);
1467int actual = Math.Min(count, _arrayCount);
System.Private.Uri (4)
System.Private.Xml (28)
System.Reflection.Emit (3)
System.Reflection.Metadata (25)
System.Reflection.MetadataLoadContext (1)
System.Runtime (1)
System.Runtime.Caching (18)
System.Runtime.Extensions (1)
System.Runtime.Numerics (103)
System\Number.BigInteger.cs (11)
369int remainingIntDigitCount = Math.Max(numberScale - totalDigitCount, 0);
370ReadOnlySpan<byte> intDigitsSpan = chunkDigits.Slice(0, Math.Min(remainingIntDigitCount, chunkDigits.Length));
433totalDigitCount = Math.Min(number.DigitsCount, numberScale);
450ReadOnlySpan<byte> intDigitsSpan = digitsChunkSpan.Slice(0, Math.Min(remainingIntDigitCount, digitsChunkSpan.Length));
506int len = Math.Min(bufferSize - i, blockSize * 2);
507int lowerLen = Math.Min(len, blockSize);
567currentBufferSize = Math.Min((int)(bufferSize * digitRatio) + 1, bufferSize);
775int charsIncludeDigits = Math.Max(digits, charsForBits);
919(ulong quo, ulong rem) = Math.DivRem(uuRes, kuBase);
925(uCarry, base1E9Buffer[cuDst++]) = Math.DivRem(uCarry, kuBase);
939int strDigits = Math.Max(digits, valueDigits);
System\Numerics\BigInteger.cs (20)
355int wholeUInt32Count = Math.DivRem(byteCount, 4, out int unalignedBytes);
747(quotient, remainder) = Math.DivRem(dividend._sign, divisor._sign);
829return Log(value, Math.E);
841return Math.Log(value._sign, baseValue);
856return Math.Log(x, baseValue) + (b - 64) / Math.Log(baseValue, 2);
1601double significand = (double)highBits * Math.Pow(10, exponentLow - exponent);
1604double log10 = Math.Log10(significand);
1608significand /= Math.Pow(10, Math.Floor(log10));
1613significand = Math.Round(significand, 8);
2351size = Math.Max(x.Length, y.Length);
2407size = Math.Max(x.Length, y.Length);
2458size = Math.Max(x.Length, y.Length);
2495(int digitShift, int smallShift) = Math.DivRem(shift, kcbitUint);
2554(int digitShift, int smallShift) = Math.DivRem(shift, kcbitUint);
2587int zl = Math.Max(xl - digitShift, 0) + (trackSignBit ? 1 : 0);
3246(int digitShift, int smallShift) = Math.DivRem(rotateAmount, kcbitUint);
3381(int digitShift, int smallShift) = Math.DivRem(rotateAmount, kcbitUint);
5228(int digitShift, int smallShift) = Math.DivRem(shiftAmount, kcbitUint);
System\Numerics\Complex.cs (62)
42private static readonly double s_sqrtRescaleThreshold = double.MaxValue / (Math.Sqrt(2.0) + 1.0);
45private static readonly double s_asinOverflowThreshold = Math.Sqrt(double.MaxValue) / 2.0;
48private static readonly double s_log2 = Math.Log(2.0);
64public double Phase { get { return Math.Atan2(m_imaginary, m_real); } }
68return new Complex(magnitude * Math.Cos(phase), magnitude * Math.Sin(phase));
228if (Math.Abs(d) < Math.Abs(c))
277if (Math.Abs(d) < Math.Abs(c))
300a = Math.Abs(a);
301b = Math.Abs(b);
328return (large * Math.Sqrt(1.0 + ratio * ratio));
350return x * Math.Log(xp1) / (xp1 - 1.0);
354return Math.Log(xp1);
419double p = Math.Exp(value.m_imaginary);
423return new Complex(Math.Sin(value.m_real) * cosh, Math.Cos(value.m_real) * sinh);
440Asin_Internal(Math.Abs(value.Real), Math.Abs(value.Imaginary), out b, out bPrime, out v);
445u = Math.Asin(b);
449u = Math.Atan(bPrime);
460double p = Math.Exp(value.m_imaginary);
464return new Complex(Math.Cos(value.m_real) * cosh, -Math.Sin(value.m_real) * sinh);
476Asin_Internal(Math.Abs(value.Real), Math.Abs(value.Imaginary), out b, out bPrime, out v);
481u = Math.Acos(b);
485u = Math.Atan(1.0 / bPrime);
488if (value.Real < 0.0) u = Math.PI - u;
507double p = Math.Exp(y2);
510if (Math.Abs(value.m_imaginary) <= 4.0)
513double D = Math.Cos(x2) + cosh;
514return new Complex(Math.Sin(x2) / D, sinh / D);
518double D = 1.0 + Math.Cos(x2) / cosh;
519return new Complex(Math.Sin(x2) / cosh / D, Math.Tanh(y2) / D);
598v = s_log2 + Math.Log(big) + 0.5 * Log1P(ratio * ratio);
613bPrime = x / Math.Sqrt((a + x) * amx);
621bPrime = x / y / Math.Sqrt((a + x) * t);
638v = Log1P(am1 + y * Math.Sqrt(t * (a + 1.0)));
643v = Log1P(am1 + Math.Sqrt(am1 * (a + 1.0)));
649v = Math.Log(a + Math.Sqrt((a - 1.0) * (a + 1.0)));
662return new Complex(Math.Log(Abs(value)), Math.Atan2(value.m_imaginary, value.m_real));
678double expReal = Math.Exp(value.m_real);
679double cosImaginary = expReal * Math.Cos(value.m_imaginary);
680double sinImaginary = expReal * Math.Sin(value.m_imaginary);
692return new Complex(0.0, Math.Sqrt(-value.m_real));
695return new Complex(Math.Sqrt(value.m_real), 0.0);
727if ((Math.Abs(realCopy) >= s_sqrtRescaleThreshold) || (Math.Abs(imaginaryCopy) >= s_sqrtRescaleThreshold))
746x = Math.Sqrt((Hypot(realCopy, imaginaryCopy) + realCopy) * 0.5);
751y = Math.Sqrt((Hypot(realCopy, imaginaryCopy) - realCopy) * 0.5);
783double theta = Math.Atan2(valueImaginary, valueReal);
784double newRho = powerReal * theta + powerImaginary * Math.Log(rho);
786double t = Math.Pow(rho, powerReal) * Math.Pow(Math.E, -powerImaginary * theta);
788return new Complex(t * Math.Cos(newRho), t * Math.Sin(newRho));
System.Runtime.Serialization.Formatters (8)
System.Security.Cryptography (23)
System.Security.Cryptography.Cose (2)
System.Text.Encodings.Web (6)
System.Text.Json (24)
System.Text.Json.SourceGeneration (1)
System.Text.RegularExpressions (37)
System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (9)
114int reps = node.Kind is RegexNodeKind.One ? 1 : Math.Min(node.M, MaxPrefixLength);
164int reps = node.Kind is RegexNodeKind.Set ? 1 : Math.Min(node.M, MaxPrefixLength);
228int limit = Math.Min(node.M, MaxPrefixLength); // MaxPrefixLength here is somewhat arbitrary, as a single loop iteration could yield multiple chars
434int count = Math.Min(node.M, SingleCharIterationLimit);
442int limit = Math.Min(node.M, NodeIterationLimit);
612int minIterations = Math.Min(node.M, MaxLoopExpansion);
643int minIterations = Math.Min(node.M, MaxLoopExpansion);
856int c = Math.Max(s1CharsLength, s1RangeLength).CompareTo(Math.Max(s2CharsLength, s2RangeLength));
System.Text.RegularExpressions.Generator (26)
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (9)
114int reps = node.Kind is RegexNodeKind.One ? 1 : Math.Min(node.M, MaxPrefixLength);
164int reps = node.Kind is RegexNodeKind.Set ? 1 : Math.Min(node.M, MaxPrefixLength);
228int limit = Math.Min(node.M, MaxPrefixLength); // MaxPrefixLength here is somewhat arbitrary, as a single loop iteration could yield multiple chars
434int count = Math.Min(node.M, SingleCharIterationLimit);
442int limit = Math.Min(node.M, NodeIterationLimit);
612int minIterations = Math.Min(node.M, MaxLoopExpansion);
643int minIterations = Math.Min(node.M, MaxLoopExpansion);
856int c = Math.Max(s1CharsLength, s1RangeLength).CompareTo(Math.Max(s2CharsLength, s2RangeLength));
System.Threading (2)
System.Threading.Channels (1)
System.Threading.RateLimiting (3)
System.Threading.Tasks.Dataflow (1)
System.Threading.Tasks.Parallel (1)
System.Windows.Controls.Ribbon (105)
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGalleryCategoriesPanel.cs (10)
392maxChildWidth = Math.Max(maxChildWidth, childSize.Width);
393maxChildHeight = Math.Max(maxChildHeight, childSize.Height);
467stackDesiredSize.Width = Math.Max(stackDesiredSize.Width, childDesiredSize.Width);
477stackDesiredSize.Width = Math.Min(stackDesiredSize.Width, constraint.Width);
478stackDesiredSize.Height = Math.Min(stackDesiredSize.Height, constraint.Height);
497logicalVisibleSpace = DoubleUtil.LessThanOrClose((viewportOffsetY + logicalVisibleSpace) - stackDesiredSize.Height, 0.0) ? 0.0 : Math.Min((viewportOffsetY + logicalVisibleSpace) - stackDesiredSize.Height, constraint.Height);
498viewportOffsetY = Math.Max(viewportOffsetY - logicalVisibleSpace, 0.0);
501offset.X = Math.Max(0, Math.Min(offset.X, extent.Width - viewport.Width));
607rcChild.Width = Math.Max(finalSize.Width, child.DesiredSize.Width);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGalleryItemsPanel.cs (25)
346maxColumnWidth = Math.Max(maxColumnWidth, childSize.Width);
347maxItemHeight = Math.Max(maxItemHeight, childSize.Height);
368columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount);
380columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount);
381arrangeWidth = Math.Max(availableSize.Width / columnCount, maxColumnWidth);
387columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / arrangeWidth), childrenCount)), maxColumnCount);
396columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount);
397_arrangeWidth = Math.Max(availableSize.Width / columnCount, maxColumnWidth);
403columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / _arrangeWidth), childrenCount)), maxColumnCount);
410columnCount = Math.Max(minColumnCount, Math.Min(childrenCount, maxColumnCount));
419maxRowHeight = Math.Max(maxRowHeight, childSize.Height);
572finalColumnCount = Math.Max(minColumnCount, Math.Min((int)(finalSize.Width / arrangeWidth), maxColumnCount));
581maxRowHeight = Math.Max(maxRowHeight, children[i].DesiredSize.Height);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGroupItemsPanel.cs (14)
85remainingHeightInColumn = Math.Max(0, finalSize.Height - childDesiredSize.Height);
107columnWidth = Math.Max(columnWidth, arrangeWidth);
138maxStarColumnWidth = Math.Max(maxStarColumnWidth, child.MaxWidth);
143maxStarColumnWidth = Math.Max(maxStarColumnWidth, Math.Min(child.MaxWidth, child.DesiredSize.Width));
225desiredHeight = Math.Min(Math.Max(desiredHeight, columnHeight), availableSize.Height);
250columnWidth = Math.Max(columnWidth, GetStarChildMinWidth(child as FrameworkElement, ref maxStarColumnWidth));
254columnWidth = Math.Max(columnWidth, childDesiredSize.Width);
255maxStarColumnWidth = Math.Max(maxStarColumnWidth, columnWidth);
260desiredHeight = Math.Min(Math.Max(desiredHeight, columnHeight), availableSize.Height);
360columnDesiredWidth = Math.Max(columnDesiredWidth, child.DesiredSize.Width);
377desiredWidth += Math.Max((columnDesiredWidth - starLayoutInfo.RequestedStarMinWidth), 0);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonTabHeadersPanel.cs (11)
93_separatorOpacity = Math.Max(0.0, reducePaddingRegularTabHeader * 0.2);
126double availableExtraWidth = Math.Min(desiredExtraPaddingPerTab, availableExtraWidthPerTab);
146if (Math.Abs(desiredSize.Width - availableSize.Width) < _desiredWidthEpsilon)
399desiredSize.Height = Math.Max(desiredSize.Height, ribbonTabHeader.DesiredSize.Height);
416desiredSize.Height = Math.Max(desiredSize.Height, child.DesiredSize.Height);
447double leftPadding = Math.Max(0, ribbonTabHeader.DefaultPadding.Left - (isContextualTab ? reducePaddingContextualTabHeader : reducePaddingRegularTabHeader));
448double rightPadding = Math.Max(0, ribbonTabHeader.DefaultPadding.Right - (isContextualTab ? reducePaddingContextualTabHeader : reducePaddingRegularTabHeader));
454desiredSize.Height = Math.Max(desiredSize.Height, ribbonTabHeader.DesiredSize.Height);
465desiredSize.Height = Math.Max(desiredSize.Height, child.DesiredSize.Height);
530return Math.Max(_tabHeaderMinWidth, maxTabHeaderWidth);
1067return Math.Max(0.0, offset);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonTitlePanel.cs (14)
81startContextualTabX = Math.Min(CalculateContextualTabGroupStartX(firstContextualTab), availableSize.Width);
87endContextualTabX = Math.Min(CalculateContextualTabGroupEndX(lastContextualTab), availableSize.Width);
90groupHeaderItemsControl.Measure(new Size(Math.Max(endContextualTabX - startContextualTabX, 0), availableSize.Height));
92desiredSize.Height = Math.Max(desiredSize.Height, groupHeaderItemsControl.DesiredSize.Height);
127availableToQat = Math.Max(availableToQat, 0);
134desiredSize.Height = Math.Max(desiredSize.Height, qat.DesiredSize.Height);
139endContextualTabX = Math.Max(endContextualTabX, availableToQat);
152availableToTitle = Math.Max(leftSpace, rightSpace);
158availableToTitle = Math.Max(availableToTitle, 0);
162desiredSize.Height = Math.Max(desiredSize.Height, titleHost.DesiredSize.Height);
165desiredSize.Width = Math.Min(desiredSize.Width, availableSize.Width); // Prevent clipping
190startContextualTabX = Math.Min(CalculateContextualTabGroupStartX(firstContextualTab), finalSize.Width);
193endContextualTabX = Math.Min(startContextualTabX + tabGroups.DesiredSize.Width, finalSize.Width);
206endContextualTabX = Math.Max(endContextualTabX, qatDesiredWidth);
System.Windows.Input.Manipulations (34)
System.Xaml (1)
UIAutomationClientSideProviders (27)
MS\Internal\AutomationProxies\WindowsEditBoxRange.cs (13)
134End = Math.Min(Math.Max(End, Start + 1), text.Length);
168End = Math.Min(Math.Max(End, Start + 1), text.Length);
302return text.Substring(Start, maxLength >= 0 ? Math.Min(Length, maxLength) : Length);
476Math.Max(0, _provider.LineFromChar(End) - _provider.LinesPerPage() + 1);
661int height = Math.Abs(_provider.GetLogfont().lfHeight);;
688ArrayList rects = new ArrayList(Math.Max(endLine - startLine + 1, 0));
783return Math.Round((double)(-logfont.lfHeight) * 72 / lpy);
830moved = Math.Min(count, limit - index);
875moved = Math.Min(count, lineMax - line - 1);
943moved = Math.Max(count, -oneBasedIndex);
988int actualCount = Math.Max(count, -line);
UIAutomationTypes (3)
WasmAppBuilder (1)
WindowsFormsIntegration (13)