7919 references to Math
aspire (22)
Aspire.Dashboard (23)
Aspire.Deployment.EndToEnd.Tests (3)
Aspire.Hosting (3)
Aspire.Hosting.Azure.Sql (1)
Aspire.Hosting.CodeGeneration.Go (1)
Aspire.Hosting.CodeGeneration.Java (1)
Aspire.Hosting.CodeGeneration.Python (1)
Aspire.Hosting.CodeGeneration.Rust (1)
Aspire.Hosting.Docker (1)
Aspire.Hosting.Tests (1)
Aspire.Playground.Tests (1)
cdac-build-tool (1)
crossgen2 (2)
dotnet (5)
dotnet-svcutil-lib (84)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBaseReader.cs (5)
1167actual = Math.Min(count, value.Length);
1199return ReadBytes(Base64Encoding, 3, 4, buffer, offset, Math.Min(count, 512), false);
1363return ReadBytes(Base64Encoding, 3, 4, buffer, offset, Math.Min(count, 512), true);
1372int actual = Math.Min(_trailByteCount, byteCount);
1442int actual = Math.Min(_trailByteCount, byteCount);
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryReader.cs (15)
864int maxLength = Math.Max(_maxBytesPerRead - maxTextNodeLength, 0);
876int actual = Math.Max(maxLength - maxTextNodeLength, 0);
934int maxLength = Math.Max(_maxBytesPerRead - maxTextNodeLength, 0);
946int actual = Math.Max(maxLength - maxTextNodeLength, 0);
976int maxBytesPerRead = Math.Max(_maxBytesPerRead - nodeLength, 0);
1228int actual = Math.Min(count, _arrayCount);
1260int actual = Math.Min(count, _arrayCount);
1292int actual = Math.Min(count, _arrayCount);
1324int actual = Math.Min(count, _arrayCount);
1356int actual = Math.Min(count, _arrayCount);
1388int actual = Math.Min(count, _arrayCount);
1420int actual = Math.Min(count, _arrayCount);
1447int actual = Math.Min(count, _arrayCount);
1474int actual = Math.Min(count, _arrayCount);
1501int actual = Math.Min(count, _arrayCount);
dotnet-user-jwts (1)
GenerateDocumentationAndConfigFiles (85)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length);
505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (8)
574LineColumnRule.IndentationOperations.Absolute => Math.Max(0, rule.Indentation),
576LineColumnRule.IndentationOperations.Given => (trivia2.RawKind == 0) ? this.Spaces : Math.Max(0, _indentation),
577LineColumnRule.IndentationOperations.Follow => Math.Max(0, lineColumnBeforeTrivia1.Column),
586LineColumnRule.SpaceOperations.Preserve => Math.Max(rule.Spaces, existingWhitespaceBetween.Spaces),
587LineColumnRule.SpaceOperations.Force => Math.Max(rule.Spaces, 0),
594var adjustedRuleLines = Math.Max(0, rule.Lines - GetTrailingLinesAtEndOfTrivia1(lineColumnAfterTrivia1));
596return (rule.LineOperation == LineColumnRule.LineOperations.Preserve) ? Math.Max(adjustedRuleLines, existingWhitespaceBetween.Lines) : adjustedRuleLines;
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
HelixTestTasks (3)
ilc (2)
ILCompiler.Compiler (26)
ILCompiler.DependencyAnalysisFramework (1)
ILCompiler.MetadataTransform (5)
ILCompiler.ReadyToRun (37)
ILCompiler.RyuJit (11)
ILCompiler.TypeSystem (8)
illink (2)
ILLink.RoslynAnalyzer (2)
Microsoft.Analyzers.Local.Tests (1)
Microsoft.Arcade.Common (1)
Microsoft.AspNetCore.Antiforgery (2)
Microsoft.AspNetCore.App.Analyzers (2)
Microsoft.AspNetCore.Authentication.Cookies (2)
Microsoft.AspNetCore.Components (5)
Microsoft.AspNetCore.Components.Endpoints (4)
Microsoft.AspNetCore.Components.Forms (2)
Microsoft.AspNetCore.Components.Server (11)
Microsoft.AspNetCore.Components.Web (20)
Virtualization\Virtualize.cs (16)
303var desiredItemsBefore = Math.Max(0, clamped - OverscanCount);
306desiredItemsBefore = Math.Max(0, _itemCount - capacity);
369return Math.Max(0, requested);
528var lastItemIndex = Math.Min(_itemsBefore + _visibleItemCapacity, _itemCount);
530var placeholdersBeforeCount = Math.Min(_loadedItemsStartIndex, lastItemIndex);
576_lastRenderedPlaceholderCount = Math.Max(0, lastItemIndex - _itemsBefore - _lastRenderedItemCount);
588var itemsAfter = Math.Max(0, _itemCount - _visibleItemCapacity - _itemsBefore);
691var itemsBefore = Math.Max(0, _itemCount - itemsAfter - visibleItemCapacity);
738int val => Math.Min(val, MaxItemCount),
753itemsInSpacer = Math.Max(0, (int)Math.Floor(spacerSize / effectiveItemSize) - OverscanCount);
754visibleItemCapacity = (int)Math.Ceiling(containerSize / effectiveItemSize) + 2 * OverscanCount;
755unusedItemCapacity = Math.Max(0, visibleItemCapacity - maxItemCount);
765itemsBefore = Math.Max(0, _itemCount - visibleItemCapacity);
948_itemsBefore = Math.Min(_itemsBefore + countDelta, Math.Max(0, newTotalCount - _visibleItemCapacity));
Microsoft.AspNetCore.Cryptography.KeyDerivation (1)
Microsoft.AspNetCore.DataProtection (6)
Microsoft.AspNetCore.Diagnostics (1)
Microsoft.AspNetCore.Diagnostics.Middleware (1)
Microsoft.AspNetCore.Hosting (1)
Microsoft.AspNetCore.Http (3)
Microsoft.AspNetCore.Http.Abstractions (5)
Microsoft.AspNetCore.Http.Connections (1)
Microsoft.AspNetCore.Http.Extensions (5)
Microsoft.AspNetCore.Http.Results (2)
Microsoft.AspNetCore.HttpLogging (10)
Microsoft.AspNetCore.HttpOverrides (4)
Microsoft.AspNetCore.HttpsPolicy (1)
Microsoft.AspNetCore.Mvc.Core (3)
Microsoft.AspNetCore.Mvc.TagHelpers (3)
Microsoft.AspNetCore.Mvc.ViewFeatures (5)
Microsoft.AspNetCore.OpenApi.SourceGenerators (3)
Microsoft.AspNetCore.OutputCaching (4)
Microsoft.AspNetCore.Razor.Utilities.Shared (4)
Microsoft.AspNetCore.ResponseCaching (1)
Microsoft.AspNetCore.Routing (12)
Microsoft.AspNetCore.Server.Kestrel.Core (39)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (3)
Microsoft.AspNetCore.SignalR.Common (1)
Microsoft.AspNetCore.SignalR.Core (2)
Microsoft.AspNetCore.StaticAssets (2)
Microsoft.AspNetCore.StaticFiles (1)
Microsoft.AspNetCore.Watch.BrowserRefresh (1)
Microsoft.AspNetCore.WebSockets (5)
Microsoft.AspNetCore.WebUtilities (19)
MultipartReaderStream.cs (9)
187var slice = buffer.AsSpan(offset, Math.Min(count, index));
207read = _innerStream.Read(buffer, offset, Math.Min(count, matchOffset - bufferedData.Offset));
218read = _innerStream.Read(buffer, offset, Math.Min(count, bufferedData.Count));
267var slice = buffer[..Math.Min(buffer.Length, index)];
290var slice = buffer[..Math.Min(buffer.Length, matchOffset - bufferedData.Offset)];
304read = _innerStream.Read(buffer.Span[..Math.Min(buffer.Length, bufferedData.Count)]);
335matchOffset = Math.Max(segment1.Offset, segment1.Offset + segment1.Count - matchBytes.Length);
362bufferSize = Math.Max(4096, bufferSize);
371bufferSize = Math.Max(4096, bufferSize);
Microsoft.Build (73)
Logging\BinaryLogger\Postprocessing\SubStream.cs (8)
49count = Math.Min((int)Math.Max(Length - _position, 0), count);
72count = Math.Min((int)Math.Max(Length - _position, 0), count);
87buffer = buffer.Slice(0, Math.Min((int)Math.Max(Length - _position, 0), buffer.Length));
95buffer = buffer.Slice(0, Math.Min((int)Math.Max(Length - _position, 0), buffer.Length));
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length);
505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Microsoft.Build.Framework (12)
Microsoft.Build.Tasks.Core (7)
Microsoft.Build.Tasks.Git (2)
Microsoft.CodeAnalysis (114)
CodeGen\LocalScopeManager.cs (12)
269begin = Math.Min(begin, bounds.Begin);
270end = Math.Max(end, bounds.End);
293begin = Math.Min(begin, bounds.Begin);
294end = Math.Max(end, bounds.End);
441begin = Math.Min(begin, block.Start);
442end = Math.Max(end, block.Start + block.TotalSize);
452begin = Math.Min(begin, nestedBounds.Begin);
453end = Math.Max(end, nestedBounds.End);
486begin = Math.Min(begin, block.Start);
487end = Math.Max(end, block.Start + block.TotalSize);
497begin = Math.Min(begin, nestedBounds.Begin);
498end = Math.Max(end, nestedBounds.End);
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length);
505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Text\SourceText.cs (10)
310bufferSize = Math.Min(maxBufferSize, length);
564int count = Math.Min(buffer.Length, end - offset);
642var charsToCopy = Math.Min(CharBufferSize, length - index);
729int position = Math.Max(Math.Min(span.Start, this.Length), 0);
730int length = Math.Min(span.End, this.Length) - position;
739int copyLength = Math.Min(tempBuffer.Length, length);
1065var limit = Math.Min(_lineStarts.Count, lastLineNumber + 4);
1104var contentLength = Math.Min(length - position, buffer.Length);
1253var count = Math.Min(this.Length - position, CharBufferSize);
Microsoft.CodeAnalysis.Analyzers (107)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length);
505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (8)
574LineColumnRule.IndentationOperations.Absolute => Math.Max(0, rule.Indentation),
576LineColumnRule.IndentationOperations.Given => (trivia2.RawKind == 0) ? this.Spaces : Math.Max(0, _indentation),
577LineColumnRule.IndentationOperations.Follow => Math.Max(0, lineColumnBeforeTrivia1.Column),
586LineColumnRule.SpaceOperations.Preserve => Math.Max(rule.Spaces, existingWhitespaceBetween.Spaces),
587LineColumnRule.SpaceOperations.Force => Math.Max(rule.Spaces, 0),
594var adjustedRuleLines = Math.Max(0, rule.Lines - GetTrailingLinesAtEndOfTrivia1(lineColumnAfterTrivia1));
596return (rule.LineOperation == LineColumnRule.LineOperations.Preserve) ? Math.Max(adjustedRuleLines, existingWhitespaceBetween.Lines) : adjustedRuleLines;
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
Microsoft.CodeAnalysis.AnalyzerUtilities (119)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length);
505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (8)
574LineColumnRule.IndentationOperations.Absolute => Math.Max(0, rule.Indentation),
576LineColumnRule.IndentationOperations.Given => (trivia2.RawKind == 0) ? this.Spaces : Math.Max(0, _indentation),
577LineColumnRule.IndentationOperations.Follow => Math.Max(0, lineColumnBeforeTrivia1.Column),
586LineColumnRule.SpaceOperations.Preserve => Math.Max(rule.Spaces, existingWhitespaceBetween.Spaces),
587LineColumnRule.SpaceOperations.Force => Math.Max(rule.Spaces, 0),
594var adjustedRuleLines = Math.Max(0, rule.Lines - GetTrailingLinesAtEndOfTrivia1(lineColumnAfterTrivia1));
596return (rule.LineOperation == LineColumnRule.LineOperations.Preserve) ? Math.Max(adjustedRuleLines, existingWhitespaceBetween.Lines) : adjustedRuleLines;
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
Microsoft.CodeAnalysis.CodeStyle (87)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length);
505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (8)
574LineColumnRule.IndentationOperations.Absolute => Math.Max(0, rule.Indentation),
576LineColumnRule.IndentationOperations.Given => (trivia2.RawKind == 0) ? this.Spaces : Math.Max(0, _indentation),
577LineColumnRule.IndentationOperations.Follow => Math.Max(0, lineColumnBeforeTrivia1.Column),
586LineColumnRule.SpaceOperations.Preserve => Math.Max(rule.Spaces, existingWhitespaceBetween.Spaces),
587LineColumnRule.SpaceOperations.Force => Math.Max(rule.Spaces, 0),
594var adjustedRuleLines = Math.Max(0, rule.Lines - GetTrailingLinesAtEndOfTrivia1(lineColumnAfterTrivia1));
596return (rule.LineOperation == LineColumnRule.LineOperations.Preserve) ? Math.Max(adjustedRuleLines, existingWhitespaceBetween.Lines) : adjustedRuleLines;
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
Microsoft.CodeAnalysis.CSharp (47)
Microsoft.CodeAnalysis.CSharp.CodeStyle (7)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (4)
Microsoft.CodeAnalysis.CSharp.Features (22)
Microsoft.CodeAnalysis.CSharp.Workspaces (7)
Microsoft.CodeAnalysis.Extensions.Package (20)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length);
505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Microsoft.CodeAnalysis.Features (40)
Microsoft.CodeAnalysis.Razor.Compiler (12)
Microsoft.CodeAnalysis.ResxSourceGenerator (108)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length);
505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (8)
574LineColumnRule.IndentationOperations.Absolute => Math.Max(0, rule.Indentation),
576LineColumnRule.IndentationOperations.Given => (trivia2.RawKind == 0) ? this.Spaces : Math.Max(0, _indentation),
577LineColumnRule.IndentationOperations.Follow => Math.Max(0, lineColumnBeforeTrivia1.Column),
586LineColumnRule.SpaceOperations.Preserve => Math.Max(rule.Spaces, existingWhitespaceBetween.Spaces),
587LineColumnRule.SpaceOperations.Force => Math.Max(rule.Spaces, 0),
594var adjustedRuleLines = Math.Max(0, rule.Lines - GetTrailingLinesAtEndOfTrivia1(lineColumnAfterTrivia1));
596return (rule.LineOperation == LineColumnRule.LineOperations.Preserve) ? Math.Max(adjustedRuleLines, existingWhitespaceBetween.Lines) : adjustedRuleLines;
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
Microsoft.CodeAnalysis.Scripting (7)
Microsoft.CodeAnalysis.VisualBasic (2)
Microsoft.CodeAnalysis.Workspaces (119)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length);
505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (8)
574LineColumnRule.IndentationOperations.Absolute => Math.Max(0, rule.Indentation),
576LineColumnRule.IndentationOperations.Given => (trivia2.RawKind == 0) ? this.Spaces : Math.Max(0, _indentation),
577LineColumnRule.IndentationOperations.Follow => Math.Max(0, lineColumnBeforeTrivia1.Column),
586LineColumnRule.SpaceOperations.Preserve => Math.Max(rule.Spaces, existingWhitespaceBetween.Spaces),
587LineColumnRule.SpaceOperations.Force => Math.Max(rule.Spaces, 0),
594var adjustedRuleLines = Math.Max(0, rule.Lines - GetTrailingLinesAtEndOfTrivia1(lineColumnAfterTrivia1));
596return (rule.LineOperation == LineColumnRule.LineOperations.Preserve) ? Math.Max(adjustedRuleLines, existingWhitespaceBetween.Lines) : adjustedRuleLines;
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (2)
Microsoft.Data.Analysis (140)
PrimitiveDataFrameColumnComputations.cs (120)
255mutableSpan[i] = (byte)(Math.Abs((decimal)mutableSpan[i]));
286ret = (byte)(Math.Max(readOnlySpan[i], ret));
330ret = (byte)Math.Max(span[(int)row], ret);
350ret = (byte)(Math.Min(readOnlySpan[i], ret));
394ret = (byte)Math.Min(span[(int)row], ret);
542value = (byte)(Math.Max(readOnlySpan[i], value));
569value = (byte)(Math.Max(readOnlySpan[(int)row], value));
590value = (byte)(Math.Min(readOnlySpan[i], value));
617value = (byte)(Math.Min(readOnlySpan[(int)row], value));
724mutableSpan[i] = (byte)(Math.Round((decimal)mutableSpan[i]));
742mutableSpan[i] = (char)(Math.Abs((decimal)mutableSpan[i]));
773ret = (char)(Math.Max(readOnlySpan[i], ret));
817ret = (char)Math.Max(span[(int)row], ret);
837ret = (char)(Math.Min(readOnlySpan[i], ret));
881ret = (char)Math.Min(span[(int)row], ret);
1029value = (char)(Math.Max(readOnlySpan[i], value));
1056value = (char)(Math.Max(readOnlySpan[(int)row], value));
1077value = (char)(Math.Min(readOnlySpan[i], value));
1104value = (char)(Math.Min(readOnlySpan[(int)row], value));
1211mutableSpan[i] = (char)(Math.Round((decimal)mutableSpan[i]));
1229mutableSpan[i] = (decimal)(Math.Abs((decimal)mutableSpan[i]));
1260ret = (decimal)(Math.Max(readOnlySpan[i], ret));
1304ret = (decimal)Math.Max(span[(int)row], ret);
1324ret = (decimal)(Math.Min(readOnlySpan[i], ret));
1368ret = (decimal)Math.Min(span[(int)row], ret);
1516value = (decimal)(Math.Max(readOnlySpan[i], value));
1543value = (decimal)(Math.Max(readOnlySpan[(int)row], value));
1564value = (decimal)(Math.Min(readOnlySpan[i], value));
1591value = (decimal)(Math.Min(readOnlySpan[(int)row], value));
1698mutableSpan[i] = (decimal)(Math.Round((decimal)mutableSpan[i]));
1716mutableSpan[i] = (double)(Math.Abs((decimal)mutableSpan[i]));
1747ret = (double)(Math.Max(readOnlySpan[i], ret));
1791ret = (double)Math.Max(span[(int)row], ret);
1811ret = (double)(Math.Min(readOnlySpan[i], ret));
1855ret = (double)Math.Min(span[(int)row], ret);
2003value = (double)(Math.Max(readOnlySpan[i], value));
2030value = (double)(Math.Max(readOnlySpan[(int)row], value));
2051value = (double)(Math.Min(readOnlySpan[i], value));
2078value = (double)(Math.Min(readOnlySpan[(int)row], value));
2185mutableSpan[i] = (double)(Math.Round((decimal)mutableSpan[i]));
2203mutableSpan[i] = (float)(Math.Abs((decimal)mutableSpan[i]));
2234ret = (float)(Math.Max(readOnlySpan[i], ret));
2278ret = (float)Math.Max(span[(int)row], ret);
2298ret = (float)(Math.Min(readOnlySpan[i], ret));
2342ret = (float)Math.Min(span[(int)row], ret);
2490value = (float)(Math.Max(readOnlySpan[i], value));
2517value = (float)(Math.Max(readOnlySpan[(int)row], value));
2538value = (float)(Math.Min(readOnlySpan[i], value));
2565value = (float)(Math.Min(readOnlySpan[(int)row], value));
2672mutableSpan[i] = (float)(Math.Round((decimal)mutableSpan[i]));
2690mutableSpan[i] = (int)(Math.Abs((decimal)mutableSpan[i]));
2721ret = (int)(Math.Max(readOnlySpan[i], ret));
2765ret = (int)Math.Max(span[(int)row], ret);
2785ret = (int)(Math.Min(readOnlySpan[i], ret));
2829ret = (int)Math.Min(span[(int)row], ret);
2977value = (int)(Math.Max(readOnlySpan[i], value));
3004value = (int)(Math.Max(readOnlySpan[(int)row], value));
3025value = (int)(Math.Min(readOnlySpan[i], value));
3052value = (int)(Math.Min(readOnlySpan[(int)row], value));
3159mutableSpan[i] = (int)(Math.Round((decimal)mutableSpan[i]));
3177mutableSpan[i] = (long)(Math.Abs((decimal)mutableSpan[i]));
3208ret = (long)(Math.Max(readOnlySpan[i], ret));
3252ret = (long)Math.Max(span[(int)row], ret);
3272ret = (long)(Math.Min(readOnlySpan[i], ret));
3316ret = (long)Math.Min(span[(int)row], ret);
3464value = (long)(Math.Max(readOnlySpan[i], value));
3491value = (long)(Math.Max(readOnlySpan[(int)row], value));
3512value = (long)(Math.Min(readOnlySpan[i], value));
3539value = (long)(Math.Min(readOnlySpan[(int)row], value));
3646mutableSpan[i] = (long)(Math.Round((decimal)mutableSpan[i]));
3664mutableSpan[i] = (sbyte)(Math.Abs((decimal)mutableSpan[i]));
3695ret = (sbyte)(Math.Max(readOnlySpan[i], ret));
3739ret = (sbyte)Math.Max(span[(int)row], ret);
3759ret = (sbyte)(Math.Min(readOnlySpan[i], ret));
3803ret = (sbyte)Math.Min(span[(int)row], ret);
3951value = (sbyte)(Math.Max(readOnlySpan[i], value));
3978value = (sbyte)(Math.Max(readOnlySpan[(int)row], value));
3999value = (sbyte)(Math.Min(readOnlySpan[i], value));
4026value = (sbyte)(Math.Min(readOnlySpan[(int)row], value));
4133mutableSpan[i] = (sbyte)(Math.Round((decimal)mutableSpan[i]));
4151mutableSpan[i] = (short)(Math.Abs((decimal)mutableSpan[i]));
4182ret = (short)(Math.Max(readOnlySpan[i], ret));
4226ret = (short)Math.Max(span[(int)row], ret);
4246ret = (short)(Math.Min(readOnlySpan[i], ret));
4290ret = (short)Math.Min(span[(int)row], ret);
4438value = (short)(Math.Max(readOnlySpan[i], value));
4465value = (short)(Math.Max(readOnlySpan[(int)row], value));
4486value = (short)(Math.Min(readOnlySpan[i], value));
4513value = (short)(Math.Min(readOnlySpan[(int)row], value));
4620mutableSpan[i] = (short)(Math.Round((decimal)mutableSpan[i]));
4638mutableSpan[i] = (uint)(Math.Abs((decimal)mutableSpan[i]));
4669ret = (uint)(Math.Max(readOnlySpan[i], ret));
4713ret = (uint)Math.Max(span[(int)row], ret);
4733ret = (uint)(Math.Min(readOnlySpan[i], ret));
4777ret = (uint)Math.Min(span[(int)row], ret);
4925value = (uint)(Math.Max(readOnlySpan[i], value));
4952value = (uint)(Math.Max(readOnlySpan[(int)row], value));
4973value = (uint)(Math.Min(readOnlySpan[i], value));
5000value = (uint)(Math.Min(readOnlySpan[(int)row], value));
5107mutableSpan[i] = (uint)(Math.Round((decimal)mutableSpan[i]));
5125mutableSpan[i] = (ulong)(Math.Abs((decimal)mutableSpan[i]));
5156ret = (ulong)(Math.Max(readOnlySpan[i], ret));
5200ret = (ulong)Math.Max(span[(int)row], ret);
5220ret = (ulong)(Math.Min(readOnlySpan[i], ret));
5264ret = (ulong)Math.Min(span[(int)row], ret);
5412value = (ulong)(Math.Max(readOnlySpan[i], value));
5439value = (ulong)(Math.Max(readOnlySpan[(int)row], value));
5460value = (ulong)(Math.Min(readOnlySpan[i], value));
5487value = (ulong)(Math.Min(readOnlySpan[(int)row], value));
5594mutableSpan[i] = (ulong)(Math.Round((decimal)mutableSpan[i]));
5612mutableSpan[i] = (ushort)(Math.Abs((decimal)mutableSpan[i]));
5643ret = (ushort)(Math.Max(readOnlySpan[i], ret));
5687ret = (ushort)Math.Max(span[(int)row], ret);
5707ret = (ushort)(Math.Min(readOnlySpan[i], ret));
5751ret = (ushort)Math.Min(span[(int)row], ret);
5899value = (ushort)(Math.Max(readOnlySpan[i], value));
5926value = (ushort)(Math.Max(readOnlySpan[(int)row], value));
5947value = (ushort)(Math.Min(readOnlySpan[i], value));
5974value = (ushort)(Math.Min(readOnlySpan[(int)row], value));
6081mutableSpan[i] = (ushort)(Math.Round((decimal)mutableSpan[i]));
Microsoft.Data.Analysis.Interactive (1)
Microsoft.Deployment.DotNet.Releases (1)
Microsoft.Diagnostics.DataContractReader.Contracts (3)
Microsoft.Diagnostics.DataContractReader.Legacy (34)
SOSDacImpl.cs (12)
3882Debug.Assert(buffer is null || new ReadOnlySpan<char>(bufferLocal, 0, (int)Math.Min(count, neededLocal)).SequenceEqual(new ReadOnlySpan<char>(buffer, (int)Math.Min(count, neededLocal))));
4001count = Math.Min(count, (uint)refs.Length);
4027_index = Math.Min(_index + count, (uint)_refs.Length);
5137for (int i = 0; i < Math.Min(GCConstants.DAC_NUM_GC_DATA_POINTS, heapData.InterestingData.Count); i++)
5141for (int i = 0; i < Math.Min(GCConstants.DAC_MAX_COMPACT_REASONS_COUNT, heapData.CompactReasons.Count); i++)
5145for (int i = 0; i < Math.Min(GCConstants.DAC_MAX_EXPAND_MECHANISMS_COUNT, heapData.ExpandMechanisms.Count); i++)
5149for (int i = 0; i < Math.Min(GCConstants.DAC_MAX_GC_MECHANISM_BITS_COUNT, heapData.InterestingMechanismBits.Count); i++)
5209for (int i = 0; i < Math.Min(GCConstants.DAC_MAX_GLOBAL_GC_MECHANISMS_COUNT, globalMechanismsData.Count); i++)
5987int fillPointersToCompare = (int)Math.Min(cFillPointers, pNeededLocal);
6542int fillCount = Math.Min(count, loaderHeapCount);
6565int compareCount = Math.Min(count, pNeededLocal);
Microsoft.DiaSymReader (9)
Microsoft.DotNet.Build.Tasks.Installers (1)
Microsoft.DotNet.Cli.Utils (3)
Microsoft.DotNet.HotReload.Watch (1)
Microsoft.DotNet.XliffTasks (1)
Microsoft.Extensions.AI.Abstractions (2)
Microsoft.Extensions.AI.Evaluation.NLP (13)
Microsoft.Extensions.Caching.Hybrid (5)
Microsoft.Extensions.DataIngestion (3)
Microsoft.Extensions.DataIngestion.Markdig (1)
Microsoft.Extensions.DataIngestion.MarkItDown (1)
Microsoft.Extensions.DependencyInjection (3)
Microsoft.Extensions.DependencyModel (1)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (20)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (3)
Microsoft.Extensions.Http.Diagnostics (2)
Microsoft.Extensions.Http.Diagnostics.Tests (1)
Microsoft.Extensions.Identity.Core (1)
Microsoft.Extensions.Logging.Abstractions (2)
Microsoft.Extensions.Logging.Console (2)
Microsoft.Extensions.Logging.Generators (4)
Microsoft.Extensions.ServiceDiscovery.Dns (3)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests.Fuzzing (1)
Microsoft.Extensions.Telemetry (4)
Microsoft.Gen.Logging (1)
Microsoft.Interop.SourceGeneration (4)
Microsoft.JSInterop (2)
Microsoft.Maui (60)
Layouts\LayoutExtensions.cs (10)
46 consumedWidth = Math.Min(bounds.Width, view.MaximumWidth);
50 var frameWidth = Math.Max(0, consumedWidth - margin.HorizontalThickness);
60 consumedHeight = Math.Min(bounds.Height, view.MaximumHeight);
64 var frameHeight = Math.Max(0, consumedHeight - margin.VerticalThickness);
84 desiredWidth = IsExplicitSet(view.Width) ? desiredWidth : Math.Min(bounds.Width, view.MaximumWidth);
121 desiredHeight = IsExplicitSet(view.Height) ? desiredHeight : Math.Min(bounds.Height, view.MaximumHeight);
189 size.Width = Math.Max(bounds.Width, size.Width);
194 size.Height = Math.Max(bounds.Height, size.Height);
225 bounds.Width = Math.Max(bounds.Width, presentedContent.DesiredSize.Width + padding.HorizontalThickness);
226 bounds.Height = Math.Max(bounds.Height, presentedContent.DesiredSize.Height + padding.VerticalThickness);
Microsoft.Maui.Controls (165)
LegacyLayouts\GridCalc.cs (33)
201 actualHeight = Math.Max(actualHeight, sizeRequest.Request.Height - assignedHeight - grid.RowSpacing * (GetRowSpan(child) - 1));
202 minimumHeight = Math.Max(minimumHeight, sizeRequest.Minimum.Height - assignedHeight - grid.RowSpacing * (GetRowSpan(child) - 1));
234 actualWidth = Math.Max(actualWidth, sizeRequest.Request.Width - assignedWidth - (GetColumnSpan(child) - 1) * grid.ColumnSpacing);
235 minimumWidth = Math.Max(minimumWidth, sizeRequest.Minimum.Width - assignedWidth - (GetColumnSpan(child) - 1) * grid.ColumnSpacing);
272 columnwWidthSum += Math.Max(0, c.ActualWidth);
284 rowHeightSum += Math.Max(0, r.ActualHeight);
317 double contractionNeeded = Math.Min(contractionSpace, Math.Max(currentSize.Width - targetWidth, 0));
325 double availableSpace = col.ActualWidth - Math.Max(col.MinimumWidth, 0);
352 double contractionNeeded = Math.Min(contractionSpace, Math.Max(currentSize.Height - targetHeight, 0));
394 starColumnWidth = Math.Min(column.ActualWidth, starColumnWidth);
411 double contractionNeeded = Math.Min(contractionSpace, Math.Max(request.Width - targetWidth, 0));
457 starRowHeight = Math.Min(row.ActualHeight, starRowHeight);
473 double contractionNeeded = Math.Min(contractionSpace, Math.Max(request.Height - targetHeight, 0));
500 lastRow = Math.Max(lastRow, GetRow(w) + GetRowSpan(w) - 1);
502 lastRow = Math.Max(lastRow, grid.RowDefinitions.Count - 1);
508 lastCol = Math.Max(lastCol, GetColumn(w) + GetColumnSpan(w) - 1);
510 lastCol = Math.Max(lastCol, grid.ColumnDefinitions.Count - 1);
605 starColWidth = Math.Max(starColWidth, GetUnassignedWidth(width, columnSpacing) / totalStarsWidth);
635 starRowHeight = Math.Max(starRowHeight, GetUnassignedHeight(height, rowSpacing) / totalStarsHeight);
677 actualWidth = Math.Max(actualWidth, sizeRequest.Request.Width - assignedWidth - columnSpacing);
678 minimumWidth = Math.Max(minimumWidth, sizeRequest.Minimum.Width - assignedWidth - columnSpacing);
697 starColRequestWidth = Math.Max(starColRequestWidth, col.ActualWidth / col.Width.Value);
698 starColMinWidth = Math.Max(starColMinWidth, col.MinimumWidth / col.Width.Value);
706 return Math.Max(widthConstraint / totalStarsWidth, starColMinWidth);
738 actualHeight = Math.Max(actualHeight, sizeRequest.Request.Height - assignedHeight - rowSpacing);
739 minimumHeight = Math.Max(minimumHeight, sizeRequest.Minimum.Height - assignedHeight - rowSpacing);
758 starRowRequestHeight = Math.Max(starRowRequestHeight, row.ActualHeight / row.Height.Value);
759 starRowMinHeight = Math.Max(starRowMinHeight, row.MinimumHeight / row.Height.Value);
767 return Math.Max(heightConstraint / totalStarsHeight, starRowMinHeight);
Shapes\Matrix.cs (24)
95 this *= CreateRotationRadians(angle * (Math.PI / 180.0));
102 this = CreateRotationRadians(angle * (Math.PI / 180.0)) * this;
109 this *= CreateRotationRadians(angle * (Math.PI / 180.0), centerX, centerY);
116 this = CreateRotationRadians(angle * (Math.PI / 180.0), centerX, centerY) * this;
148 this *= CreateSkewRadians(skewX * (Math.PI / 180.0),
149 skewY * (Math.PI / 180.0));
157 this = CreateSkewRadians(skewX * (Math.PI / 180.0),
158 skewY * (Math.PI / 180.0)) * this;
560 double sin = Math.Sin(angle);
561 double cos = Math.Cos(angle);
599 matrix.SetMatrix(1.0, Math.Tan(skewY),
600 Math.Tan(skewX), 1.0,
744 rect.X = Math.Min(Math.Min(point0.X, point1.X), Math.Min(point2.X, point3.X));
745 rect.Y = Math.Min(Math.Min(point0.Y, point1.Y), Math.Min(point2.Y, point3.Y));
747 rect.Width = Math.Max(Math.Max(point0.X, point1.X), Math.Max(point2.X, point3.X)) - rect.X;
748 rect.Height = Math.Max(Math.Max(point0.Y, point1.Y), Math.Max(point2.Y, point3.Y)) - rect.Y;
Microsoft.Maui.Controls.BindingSourceGen (1)
Microsoft.Maui.Essentials (12)
Microsoft.Maui.Graphics (98)
Rect.cs (12)
107 return FromLTRB(Math.Min(r1.Left, r2.Left), Math.Min(r1.Top, r2.Top), Math.Max(r1.Right, r2.Right), Math.Max(r1.Bottom, r2.Bottom));
117 double x = Math.Max(r1.X, r2.X);
118 double y = Math.Max(r1.Y, r2.Y);
119 double width = Math.Min(r1.Right, r2.Right) - x;
120 double height = Math.Min(r1.Bottom, r2.Bottom) - y;
209 return new Rect(Math.Round(X), Math.Round(Y), Math.Round(Width), Math.Round(Height));
RectF.cs (8)
108 return FromLTRB(Math.Min(r1.Left, r2.Left), Math.Min(r1.Top, r2.Top), Math.Max(r1.Right, r2.Right), Math.Max(r1.Bottom, r2.Bottom));
118 float x = Math.Max(r1.X, r2.X);
119 float y = Math.Max(r1.Y, r2.Y);
120 float width = Math.Min(r1.Right, r2.Right) - x;
121 float height = Math.Min(r1.Bottom, r2.Bottom) - y;
Text\AttributedTextRunExtensions.cs (10)
82 var length1 = Math.Min(first.Length, second.Length);
84 var length2 = Math.Max(first.Length, second.Length) - length1;
92 var length1 = Math.Min(first.Length, second.Length);
94 var length2 = Math.Max(first.Length, second.Length) - length1;
107 var length2 = Math.Max(first.Length, second.Length) - length1;
117 var length2 = Math.Max(first.Length, second.Length) - length1;
132 var length3 = Math.Max(first.Length, second.Length) - (length1 + length2);
145 var length3 = Math.Max(first.Length, second.Length) - (length1 + length2);
166 var start = Math.Max(run.Start, 0);
168 var length = Math.Min(run.Length, maxLength);
Microsoft.Maui.Graphics.Skia (9)
Microsoft.Maui.Graphics.Win2D.WinUI.Desktop (10)
Microsoft.Maui.Maps (40)
Primitives\MapSpan.cs (18)
8 const double EarthCircumferenceKm = GeographyUtils.EarthRadiusKm * 2 * Math.PI;
14 LatitudeDegrees = Math.Min(Math.Max(latitudeDegrees, MinimumRangeDegrees), 90.0);
15 LongitudeDegrees = Math.Min(Math.Max(longitudeDegrees, MinimumRangeDegrees), 180.0);
30 return new Distance(1000 * Math.Min(latKm, longKm) / 2);
36 north = Math.Min(Math.Max(north, 0), 90);
37 south = Math.Max(Math.Min(south, 0), -90);
38 double lat = Math.Max(Math.Min(Center.Latitude, north), south);
39 double maxDLat = Math.Min(north - lat, -south + lat) * 2;
40 return new MapSpan(new Location(lat, Center.Longitude), Math.Min(LatitudeDegrees, maxDLat), LongitudeDegrees);
80 double maxDLat = Math.Min(90 - Center.Latitude, 90 + Center.Latitude) * 2;
81 return new MapSpan(Center, Math.Min(LatitudeDegrees / zoomFactor, maxDLat), LongitudeDegrees / zoomFactor);
102 return EarthCircumferenceKm * Math.Cos(location.Latitude * Math.PI / 180.0);
Microsoft.Maui.Resizetizer (4)
Microsoft.ML.AutoML (68)
Sweepers\Parameters.cs (22)
229? Math.Pow(1.0 * _args.Max / _args.Min, 1.0 / (_args.NumSteps - 1))
231var logMax = Math.Log(_args.Max, logBase);
232var logMin = Math.Log(_args.Min, logBase);
233val = (long)(_args.Min * Math.Pow(logBase, normalizedValue * (logMax - logMin)));
258var logBase = _args.StepSize ?? Math.Pow(1.0 * _args.Max / _args.Min, 1.0 / (_args.NumSteps - 1));
261var maxPlusEpsilon = _args.Max * Math.Sqrt(logBase);
313float logBase = (float)(_args.StepSize ?? Math.Pow(1.0 * _args.Max / _args.Min, 1.0 / (_args.NumSteps - 1)));
314return (float)((Math.Log(valueTyped.Value, logBase) - Math.Log(_args.Min, logBase)) / (Math.Log(_args.Max, logBase) - Math.Log(_args.Min, logBase)));
355? Math.Pow(1.0 * _args.Max / _args.Min, 1.0 / (_args.NumSteps - 1))
357var logMax = Math.Log(_args.Max, logBase);
358var logMin = Math.Log(_args.Min, logBase);
359val = (float)(_args.Min * Math.Pow(logBase, normalizedValue * (logMax - logMin)));
376var logBase = _args.StepSize ?? Math.Pow(1.0 * _args.Max / _args.Min, 1.0 / (_args.NumSteps - 1));
379var maxPlusEpsilon = _args.Max * Math.Sqrt(logBase);
431float logBase = (float)(_args.StepSize ?? Math.Pow(1.0 * _args.Max / _args.Min, 1.0 / (_args.NumSteps - 1)));
432return (float)((Math.Log(valueTyped.Value, logBase) - Math.Log(_args.Min, logBase)) / (Math.Log(_args.Max, logBase) - Math.Log(_args.Min, logBase)));
Microsoft.ML.AutoML.Tests (13)
Microsoft.ML.Core (120)
Utilities\MathUtils.cs (46)
32return Math.Sqrt(x).ToFloat();
37return Math.Log(x).ToFloat();
42return Math.Log(a, newBase).ToFloat();
47return Math.Pow(x, y).ToFloat();
115result = Math.Max(result, x);
129result = Math.Min(result, x);
230intermediate += Math.Exp(inputs[i] - max);
234return (float)(max + Math.Log(1.0 + intermediate));
261return (float)(max + Math.Log(1.0 + Math.Exp(negDiff)));
288float absDiff = Math.Abs(a - b);
291float maxAbs = Math.Max(Math.Abs(a), Math.Abs(b));
296private static readonly double _constantForLogGamma = 0.5 * Math.Log(2 * Math.PI);
312int toAdd = (int)Math.Floor(7 - x);
316res = -Math.Log(v2);
321res += _constantForLogGamma + (x + 0.5) * Math.Log(x) - x;
364_logFactorialCache.Add(_logFactorialCache[i - 1] + Math.Log(i));
390return Math.Max(0, Math.Min(result, 1));
421if (Math.Abs(ratio - 1.0) < tol)
431return Math.Exp(LogGamma(a) + LogGamma(b) - LogGamma(a + b));
468return Math.Pow(x, a) * Math.Pow(1 - x, b) / (a * Beta(a, b)) * Lentz(adel, bdel);
524return Math.Tanh(x).ToFloat();
532return Math.Exp(x).ToFloat();
688maxOut = Math.Max(maxOut, src[i]);
753Double similarity = ab / (Math.Sqrt(a2 * b2) + epsilon);
755if (Math.Abs(similarity) > 1)
772? -prob * Math.Log(prob) - (1 - prob) * Math.Log(1 - prob)
773: -prob * Math.Log(prob, 2) - (1 - prob) * Math.Log(1 - prob, 2);
787? -probTrue * Math.Log(probPredicted) - (1 - probTrue) * Math.Log(1 - probPredicted)
788: -probTrue * Math.Log(probPredicted, 2) - (1 - probTrue) * Math.Log(1 - probPredicted, 2);
810soFar += Math.Exp(term - max);
813soFar = Math.Exp(max - term) * soFar + 1;
817return (float)Math.Log(soFar) + max;
826var res = Math.Sin(a);
827return Math.Abs(res) > 1 ? double.NaN : res;
836var res = Math.Cos(a);
837return Math.Abs(res) > 1 ? double.NaN : res;
Microsoft.ML.Core.Tests (19)
UnitTests\TestLoss.cs (7)
49float almostOutput = Math.Max((float)output * (1 + _epsilon), (float)output + _epsilon);
76TestHelper(loss, 1, 3, Math.Exp(-3), Math.Exp(-3));
77TestHelper(loss, 0, 3, Math.Exp(3), -Math.Exp(3));
78TestHelper(loss, 0, -3, Math.Exp(-3), -Math.Exp(-3));
Microsoft.ML.CpuMath (31)
Microsoft.ML.CpuMath.PerformanceTests (1)
Microsoft.ML.CpuMath.UnitTests (8)
Microsoft.ML.Data (154)
Data\BufferBuilder.cs (8)
181Array.Resize(ref _values, Math.Max(Math.Min(_length, checked(_count * 2)), 8));
183Array.Resize(ref _indices, Math.Max(Math.Min(_length, checked(_count * 2)), 8));
209Array.Resize(ref _values, Math.Max(Math.Min(_length, checked(_count * 2)), 8));
211Array.Resize(ref _indices, Math.Max(Math.Min(_length, checked(_count * 2)), 8));
Transforms\NormalizeColumnDbl.cs (21)
442get { return _m2.Select((m2, i) => Math.Sqrt(m2 / _cnz[i])).ToArray(); }
447get { return _m2.Select((m2, i) => Math.Sqrt(m2 / Math.Max(0, _cnz[i] - 1))).ToArray(); }
457get { return _m2.Select((m2, i) => m2 / Math.Max(0, _cnz[i] - 1)).ToArray(); }
511var val = _useLog ? (TFloat)Math.Log(origVal) : origVal;
732int cv = Math.Max(1, typeSrc.Size);
1006var val = UseLog ? (TFloat)Math.Log(input) : input;
1058int cv = Math.Max(1, typeSrc.Size);
1117var val = useLog ? (TFloat)Math.Log(values[i]) : values[i];
1133var val = useLog ? (TFloat)Math.Log(values[ii]) : values[ii];
1167_den = Math.Max(1, _binUpperBounds.Length - 1);
1242_den[i] = Math.Max(1, _binUpperBounds[i].Length - 1);
1261int cv = Math.Max(1, typeSrc.Size);
1436scale = 1 / Math.Max(Math.Abs(max), Math.Abs(min));
1472scale = 1 / (TFloat)Math.Sqrt(meanSquaredError + mean * mean);
1489return (TFloat)(0.5 + 0.5 * Math.Sign(x) * Math.Sqrt(1 - Math.Exp(-x2 * (4 / Math.PI + ax2) / (1 + ax2))));
Transforms\NormalizeColumnSng.cs (21)
443get { return _m2.Select((m2, i) => Math.Sqrt(m2 / _cnz[i])).ToArray(); }
448get { return _m2.Select((m2, i) => Math.Sqrt(m2 / Math.Max(0, _cnz[i] - 1))).ToArray(); }
458get { return _m2.Select((m2, i) => m2 / Math.Max(0, _cnz[i] - 1)).ToArray(); }
513var val = _useLog ? (TFloat)Math.Log(origVal) : origVal;
889int cv = Math.Max(1, typeSrc.Size);
1166var val = UseLog ? (TFloat)Math.Log(input) : input;
1218int cv = Math.Max(1, typeSrc.Size);
1278var val = useLog ? (TFloat)Math.Log(values[i]) : values[i];
1294var val = useLog ? (TFloat)Math.Log(values[ii]) : values[ii];
1328_den = Math.Max(1, _binUpperBounds.Length - 1);
1403_den[i] = Math.Max(1, _binUpperBounds[i].Length - 1);
1422int cv = Math.Max(1, typeSrc.Size);
1599scale = 1 / Math.Max(Math.Abs(max), Math.Abs(min));
1635scale = 1 / (TFloat)Math.Sqrt(meanSquaredError + mean * mean);
1652return (TFloat)(0.5 + 0.5 * Math.Sign(x) * Math.Sqrt(1 - Math.Exp(-x2 * (4 / Math.PI + ax2) / (1 + ax2))));
Utils\LossFunctions.cs (20)
147return 1 / Math.Max(1, (float)0.25 + scaledFeaturesNormSquared);
161return maxNumThreads >= 2 && Math.Abs(fullUpdate) > Threshold ? fullUpdate / maxNumThreads : fullUpdate;
179return Math.Log(Math.Max(x, 1e-8));
261var fullUpdate = truth * Math.Max(0, Math.Min(1, tmp)) - alpha;
262return maxNumThreads >= 2 && Math.Abs(fullUpdate) > Threshold ? fullUpdate / maxNumThreads : fullUpdate;
385var fullUpdate = truth * Math.Max(0, Math.Min(1, tmp)) - alpha;
386return maxNumThreads >= 2 && Math.Abs(fullUpdate) > Threshold ? fullUpdate / maxNumThreads : fullUpdate;
547return Math.Exp(output) - label * output;
552return (float)Math.Exp(output) - label;
633return output - label * Math.Log(output) + MathUtils.LogGamma(label);
638return output + label / output - Math.Sqrt(label);
640return Math.Pow(output, _index2) / _index2 - label * Math.Pow(output, _index1) / _index1
641- (Math.Pow(label, _index2) / _index2 - label * Math.Pow(label, _index1) / _index1);
651return (float)(Math.Pow(output, _index2) - label * Math.Pow(output, _index1));
Microsoft.ML.Ensemble (2)
Microsoft.ML.Fairlearn (4)
Microsoft.ML.FastTree (129)
Training\DcgCalculator.cs (8)
39DiscountMap[i] = 1.0 / Math.Log(2 + i);
122int maxTrunc = Math.Min(trunc, numDocuments);
145maxDcg += LabelMap[topLabel] / Math.Log(2.0 + t);
371var actions = new Action[(int)Math.Ceiling(1.0 * dataset.NumQueries / chunkSize)];
379NdcgRangeWorkerChunkFromScores(dataset, labels, scores, result, start, Math.Min(dataset.NumQueries - start, chunkSize), threadIndex);
467Array.Sort(permutation, 0, Math.Min(count, _secondLevelcomparers[threadIndex].CompareFirstN), _secondLevelcomparers[threadIndex]);
510var actions = new Action[(int)Math.Ceiling(1.0 * dataset.NumQueries / chunkSize)];
518OrderingRangeWorkerFromScores(dataset, scores, result, start, Math.Min(dataset.NumQueries - start, chunkSize), threadIndex);
Training\EnsembleCompression\LassoBasedEnsembleCompressor.cs (16)
66_numObservations = Math.Min(_trainSet.NumDocs, maxObservations);
110int selectedDocs = Math.Min(perLabelDocCount[curLabel], currentMax);
176int maxAllowedFeaturesAlongPath = (int)Math.Min(maxAllowedFeaturesPerModel * 1.2, _numFeatures);
192float factor = (float)(1.0 / Math.Sqrt(_numObservations));
207featureStds[j] = Math.Sqrt(VectorUtils.GetDotProduct(_observations[j], _observations[j]));
223float targetStd = (float)Math.Sqrt(VectorUtils.GetDotProduct(_targets, _targets));
239double alf = Math.Pow(Math.Max(Epsilon, flmin), 1.0 / (numberOfLambdas - 1));
243int minimumNumberOfLambdas = Math.Min(MinNumberOFLambdas, numberOfLambdas);
263curLambda = Math.Max(curLambda, Math.Abs(feature2residualCorrelations[j]));
339maxDelta = Math.Max((delta >= 0 ? delta : -delta), maxDelta);
374maxDelta = Math.Max((delta >= 0 ? delta : -delta), maxDelta);
453fit.Lambdas[0] = Math.Exp(2 * Math.Log(fit.Lambdas[1]) - Math.Log(fit.Lambdas[2]));
Microsoft.ML.GenAI.Core (3)
Microsoft.ML.GenAI.Phi (4)
Microsoft.ML.ImageAnalytics (4)
Microsoft.ML.IntegrationTests (4)
Microsoft.ML.KMeansClustering (13)
Microsoft.ML.LightGbm (9)
Microsoft.ML.Mkl.Components (10)
Microsoft.ML.PCA (2)
Microsoft.ML.Predictor.Tests (6)
Microsoft.ML.ResultProcessor (1)
Microsoft.ML.Samples (17)
Microsoft.ML.SearchSpace (6)
Microsoft.ML.SearchSpace.Tests (6)
Microsoft.ML.StandardTrainers (102)
Microsoft.ML.Sweeper (61)
Algorithms\KdoSweeper.cs (12)
113var numSweeps = Math.Min(numOfCandidates, _args.NumberInitialPopulation - prevRuns.Length);
171double rVar = Math.Pow(VectorUtils.GetStandardDeviation(randomVals), 2) + 1e-10;
250double bandwidthScale = Math.Max(_args.MinimumMutationSpread, correctedVal);
265double eps = Math.Min(Math.Max(child[index], epsCutoff), 1 - epsCutoff);
300double p2 = Math.Pow((4.0 / (d + 2)), p1);
306bandwidthMatrix[i][i] = p2 * stddevs[i] * Math.Pow(n, -p1);
337weights[i] = _args.Simple ? Math.Pow(weights[i], Math.Min(Math.Sqrt(n), 100)) : Math.Pow(weights[i], _args.WeightRescalingPower * currentMaxPerf);
471a[i][j] = i + j == d - 1 ? Math.Sqrt(diagonalCovariance[i][i]) : 0;
Parameters.cs (22)
237? Math.Pow(1.0 * _options.Max / _options.Min, 1.0 / (_options.NumSteps - 1))
239var logMax = Math.Log(_options.Max, logBase);
240var logMin = Math.Log(_options.Min, logBase);
241val = (long)(_options.Min * Math.Pow(logBase, normalizedValue * (logMax - logMin)));
266var logBase = _options.StepSize ?? Math.Pow(1.0 * _options.Max / _options.Min, 1.0 / (_options.NumSteps - 1));
269var maxPlusEpsilon = _options.Max * Math.Sqrt(logBase);
321float logBase = (float)(_options.StepSize ?? Math.Pow(1.0 * _options.Max / _options.Min, 1.0 / (_options.NumSteps - 1)));
322return (float)((Math.Log(valueTyped.Value, logBase) - Math.Log(_options.Min, logBase)) / (Math.Log(_options.Max, logBase) - Math.Log(_options.Min, logBase)));
369? Math.Pow(1.0 * _options.Max / _options.Min, 1.0 / (_options.NumSteps - 1))
371var logMax = Math.Log(_options.Max, logBase);
372var logMin = Math.Log(_options.Min, logBase);
373val = (float)(_options.Min * Math.Pow(logBase, normalizedValue * (logMax - logMin)));
390var logBase = _options.StepSize ?? Math.Pow(1.0 * _options.Max / _options.Min, 1.0 / (_options.NumSteps - 1));
393var maxPlusEpsilon = _options.Max * Math.Sqrt(logBase);
445float logBase = (float)(_options.StepSize ?? Math.Pow(1.0 * _options.Max / _options.Min, 1.0 / (_options.NumSteps - 1)));
446return (float)((Math.Log(valueTyped.Value, logBase) - Math.Log(_options.Min, logBase)) / (Math.Log(_options.Max, logBase) - Math.Log(_options.Min, logBase)));
Microsoft.ML.Sweeper.Tests (1)
Microsoft.ML.TensorFlow (1)
Microsoft.ML.TestFramework (10)
Microsoft.ML.Tests (13)
Microsoft.ML.TimeSeries (131)
AdaptiveSingularSpectrumSequenceModeler.cs (36)
44public Double Ratio { get { return Math.Pow(Growth, 1d / TimeSpan); } }
664int evaluationLength = Math.Min(Math.Max(tMat.WindowSize, 200), k);
714error += Math.Abs(series[j] - temp);
757int evaluationLength = Math.Min(Math.Max(tMat.WindowSize, 200), k);
809error += Math.Abs(series[j] - temp);
855_info.ExponentialTrendFactor = Math.Abs(_alpha[0]);
867Double highFrequenceyBoundry = Math.PI / 2;
888if (roots[i].Magnitude > 1 && (Math.Abs(roots[i].Phase) <= eps || Math.Abs(Math.Abs(roots[i].Phase) - Math.PI) <= eps))
897if (roots[i].Magnitude >= 1 && 2 * Math.PI / Math.Abs(roots[i].Phase) > _windowSize)
942if (Math.Abs(sortedComponents[i + 1].Phase - sortedComponents[i].Phase) > 0.05)
994if (Math.Abs(roots[ind].Phase) <= eps)
1003if (Math.Abs(roots[i].Phase) <= eps && 0.9 <= roots[i].Magnitude && i != ind1)
1021maxTrendMagnitude = Math.Min(1, _maxTrendRatio);
1030if (roots[i].Magnitude > 1 && Math.Abs(roots[i].Phase) <= eps)
1033maxTrendMagnitude = Math.Max(maxTrendMagnitude, roots[i].Magnitude);
1036maxNonTrendMagnitude = Math.Max(maxNonTrendMagnitude, roots[i].Magnitude);
1042maxTrendMagnitude = Math.Min(maxTrendMagnitude, _maxTrendRatio);
1046var smallTrendMagnitude = Math.Min(maxTrendMagnitude, (maxTrendMagnitude + 1) / 2);
1051if ((highFrequenceyBoundry < roots[i].Phase && roots[i].Phase < Math.PI - eps) ||
1052(-Math.PI + eps < roots[i].Phase && roots[i].Phase < -highFrequenceyBoundry))
1063if (Math.Abs(phase) <= eps)
1065else if (Math.Abs(phase - Math.PI) <= eps)
1067else if (Math.Abs(phase + Math.PI) <= eps)
1134for (i = Math.Max(0, len - _windowSize + 1); i < len; ++i)
1318var temp = (Single)(1f / Math.Sqrt(_windowSize));
1383for (i = Math.Max(0, len - _windowSize); i < len; ++i)
1444for (j = Math.Max(0, i - _windowSize + 1); j < i; ++j, ++k)
1471sdEditor.Values[i] = (float)Math.Sqrt(sdEditor.Values[i]);
SrCnnEntireAnomalyDetector.cs (27)
507_minimumOriginValue = Math.Min(_minimumOriginValue, value);
508_maximumOriginValue = Math.Max(_maximumOriginValue, value);
514_std = Math.Sqrt((squareSum - (sum * sum) / values.Length) / values.Length);
566_magList[i] = Math.Sqrt(_fftRe[i] * _fftRe[i] + _fftIm[i] * _fftIm[i]);
569_magLogList[i] = Math.Log(_magList[i]);
582_spectralList[i] = Math.Exp(_magLogList[i] - _cumSumList[i]);
610_ifftMagList[i] = Math.Sqrt(_ifftRe[i] * _ifftRe[i] + _ifftIm[i] * _ifftIm[i]);
613AverageFilter(_ifftMagList, Math.Min(_ifftMagList.Length, _judgementWindowSize));
614for (int i = 0; i <= Math.Min(length, _minimumScoreWindowSize); ++i)
616_cumSumList[i] = _cumSumList[Math.Min(length, _minimumScoreWindowSize) - 1];
624score = Math.Min(score, _maximumScore);
625score = Math.Max(score, _minimumScore);
633var zscore = Math.Abs(values[i] - _mean) / _std;
705if (Math.Abs(safeDivisor) < _eps)
709return (Math.Abs(mag - avgMag) / safeDivisor);
779segments.Add(new Tuple<int, int>(start, Math.Max(start, cursor)));
882return Math.Max(Math.Min(expectedValue, value + boundMargin), value - boundMargin);
905int start = Math.Max(idx - step, 0);
906int end = Math.Min(data.Length - 1, idx + step);
920start = Math.Max(idx - step, 0);
921end = Math.Min(data.Length - 1, idx + step);
977int window = Math.Min(data.Length / 3, 512);
989trendSum += Math.Abs(_trends[i]);
1013_units[i] = averageTrendPart + Math.Abs(_trends[i]) * trendFraction;
1115if (Math.Floor(sensitivity) == sensitivity)
1135double distanceFactor = Math.Abs(exp - value) / unit;
Microsoft.ML.TimeSeries.Tests (2)
Microsoft.ML.Tokenizers (21)
Microsoft.ML.Tokenizers.Data.Tests (1)
Microsoft.ML.Tokenizers.Tests (13)
LlamaTests.cs (5)
308for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
846for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
860for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
885for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
899for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
Microsoft.ML.TorchSharp (31)
AutoFormerV2\Anchors.cs (10)
46this.strides = strides != null ? strides : this.pyramidLevels.Select(x => (int)Math.Pow(2, x)).ToArray();
47this.sizes = sizes != null ? sizes : this.pyramidLevels.Select(x => (int)Math.Pow(2, x + 2)).ToArray();
49this.scales = scales != null ? scales : new double[] { Math.Pow(2, 0), Math.Pow(2, 1.0 / 3.0), Math.Pow(2, 2.0 / 3.0) };
70var shape = ((imageShape + Math.Pow(2, x) - 1) / Math.Pow(2, x)).to_type(torch.int32);
98scales ??= new double[] { Math.Pow(2, 0), Math.Pow(2, 1.0 / 3.0), Math.Pow(2, 2.0 / 3.0) };
Microsoft.ML.Transforms (76)
Microsoft.ML.Vision (2)
Microsoft.NET.Build.Containers (1)
Microsoft.NET.HostModel (7)
Microsoft.NET.Sdk.StaticWebAssets.Tasks (1)
Microsoft.Private.Windows.Core (7)
Microsoft.SourceLink.AzureDevOpsServer.Git (2)
Microsoft.SourceLink.AzureRepos.Git (2)
Microsoft.SourceLink.Bitbucket.Git (2)
Microsoft.SourceLink.Common (2)
Microsoft.SourceLink.Gitea (2)
Microsoft.SourceLink.Gitee (2)
Microsoft.SourceLink.GitHub (2)
Microsoft.SourceLink.GitLab (2)
Microsoft.SourceLink.GitWeb (2)
Microsoft.TemplateEngine.Cli (7)
Microsoft.TemplateEngine.Core (13)
Microsoft.TestPlatform.CommunicationUtilities (1)
Microsoft.TestPlatform.CrossPlatEngine (6)
Microsoft.TestPlatform.Extensions.BlameDataCollector (1)
Microsoft.VisualBasic.Core (9)
Microsoft.VisualStudio.TestPlatform.Client (1)
Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger (1)
Microsoft.VisualStudio.TestPlatform.ObjectModel (6)
Mono.Cecil (9)
Mono.Cecil.Mdb (1)
Mono.Cecil.Pdb (1)
MSBuild (1)
mscorlib (1)
netstandard (1)
NuGet.CommandLine.XPlat (4)
NuGet.Commands (1)
NuGet.Common (3)
NuGet.Configuration (1)
NuGet.DependencyResolver.Core (1)
NuGet.Frameworks (2)
NuGet.PackageManagement (4)
NuGet.Packaging (14)
NuGet.ProjectModel (1)
NuGet.Protocol (1)
NuGet.Resolver (1)
NuGet.Versioning (3)
PresentationBuildTasks (4)
PresentationCore (523)
MS\Internal\Ink\StrokeRenderer.cs (27)
86double delta = Math.Abs(GetAngleDeltaFromLast(strokeNode.PreviousPosition, strokeNode.Position, ref lastAngle));
106if ((Math.Min(prevArea, currArea) / Math.Max(prevArea, currArea)) <= 0.70d)
248double maxExtent = Math.Max(drawingAttributes.Height, drawingAttributes.Width);
249percentIntersect += Math.Min(4.99999d, ((maxExtent / 20d) * 5d));
517bool directionChangedOverAbsoluteThreshold = Math.Abs(delta) > 90d && Math.Abs(delta) < (360d - 90d);
518bool directionChangedOverOverlapThreshold = overlap && !(ignorePressure || strokeNode.PressureFactor == 1f) && Math.Abs(delta) > 30d && Math.Abs(delta) < (360d - 30d);
527if ((Math.Min(prevArea, currArea) / Math.Max(prevArea, currArea)) <= 0.90d)
832double intersectLeft = Math.Max(rect1.Left, rect2.Left);
833double intersectTop = Math.Max(rect1.Top, rect2.Top);
834double intersectWidth = Math.Max((double)(Math.Min(rect1.Right, rect2.Right) - intersectLeft), (double)0);
835double intersectHeight = Math.Max((double)(Math.Min(rect1.Bottom, rect2.Bottom) - intersectTop), (double)0);
845double minArea = Math.Min(rect1Area, rect2Area);
1048angle = Math.PI / 2.0;
1052angle = Math.PI * 3.0 / 2.0;
1063angle = Math.PI;
1070angle = Math.Atan(dy / dx) + Math.PI;
1074angle = Math.Atan(dy / dx) + (2 * Math.PI);
1078angle = Math.Atan(dy / dx);
1083angle = angle * 180 / Math.PI;
MS\Internal\Media3D\GeneralTransform2DTo3DTo2D.cs (19)
495if (!((Math.Max(visEdgeStart.X, visEdgeEnd.X) < Math.Min(uv1.X, uv2.X)) ||
496(Math.Min(visEdgeStart.X, visEdgeEnd.X) > Math.Max(uv1.X, uv2.X)) ||
497(Math.Max(visEdgeStart.Y, visEdgeEnd.Y) < Math.Min(uv1.Y, uv2.Y)) ||
498(Math.Min(visEdgeStart.Y, visEdgeEnd.Y) > Math.Max(uv1.Y, uv2.Y))))
599if (Math.Abs(visUV1.X - visUV2.X) > Math.Abs(visUV1.Y - visUV2.Y))
913if (!((Math.Max(visEdgeStart.X, visEdgeEnd.X) < Math.Min(uv1.X, uv2.X)) ||
914(Math.Min(visEdgeStart.X, visEdgeEnd.X) > Math.Max(uv1.X, uv2.X)) ||
915(Math.Max(visEdgeStart.Y, visEdgeEnd.Y) < Math.Min(uv1.Y, uv2.Y)) ||
916(Math.Min(visEdgeStart.Y, visEdgeEnd.Y) > Math.Max(uv1.Y, uv2.Y))))
1083closestIntersection = ((currClosest - edges[i]._p1Transformed).Length / Math.Sqrt(denom) *
MS\Internal\TextFormatting\LineServicesCallbacks.cs (14)
425lstTextMetrics.dvAscent = (int)Math.Round(typeface.Baseline(store.Pap.EmSize, Constants.DefaultIdealToReal, store.Settings.TextSource.PixelsPerDip, fullText.TextFormattingMode));
426lstTextMetrics.dvMultiLineHeight = (int)Math.Round(typeface.LineSpacing(store.Pap.EmSize, Constants.DefaultIdealToReal, store.Settings.TextSource.PixelsPerDip, fullText.TextFormattingMode));
686ulInfo.dvpFirstUnderlineOffset = (int)Math.Round(lsrun.EmSize * -underlinePositionInEm);
687ulInfo.dvpFirstUnderlineSize = (int)Math.Round(lsrun.EmSize * underlineThicknessInEm);
740stInfo.dvpLowerStrikethroughOffset = (int)Math.Round(lsrun.EmSize * strikeThroughPositionInEm);
741stInfo.dvpLowerStrikethroughSize = (int)Math.Round(lsrun.EmSize * strikeThroughThicknessInEm);
935int baselineTop = ptOrigin.y + (int)Math.Round(lsrun.EmSize * strikeThroughPositionInEm);
936int overlineTop = baselineTop - (lsrun.BaselineOffset - (int)Math.Round(lsrun.EmSize * strikeThroughThicknessInEm));
1242penThickness = Math.Abs(penThickness);
1318drawingPenThickness /= Math.Abs(unitValue);
1987int expandedBy = Math.Max(0, interWordAdjustTo - adjustedCharWidth);
1994pplsAdjustRight[0][i] = Math.Max(0, adjustedCharWidth - interWordAdjustTo);
2120pplsCompressionRight[0][igi + i] = Math.Max(0, glyphAdvance - interWordCompressTo);
2253int expandedBy = Math.Max(0, interWordExpandTo - glyphAdvance);
MS\Internal\TextFormatting\SimpleTextLine.cs (10)
288realHeight = Math.Max(realHeight, run.Height);
289realAscent = Math.Max(realAscent, run.Baseline);
290realDescent = Math.Max(realDescent, run.Height - run.Baseline);
325_height = formatter.IdealToReal((int)Math.Round(pap.DefaultTypeface.LineSpacing(pap.EmSize, Constants.DefaultIdealToReal, PixelsPerDip, _settings.TextFormattingMode)), PixelsPerDip);
326_baselineOffset = formatter.IdealToReal((int)Math.Round(pap.DefaultTypeface.Baseline(pap.EmSize, Constants.DefaultIdealToReal, PixelsPerDip, _settings.TextFormattingMode)), PixelsPerDip);
360_idealOffsetUnRounded = (int)Math.Round((paragraphWidth - idealWidthAtTrailing) * 0.5);
837int first = Math.Max(ich, dcp) + _cpFirst;
838int afterLast = Math.Min(ich + run.Length, dcp + textLength) + _cpFirst;
1205cpVisible = Math.Max(cpRunStart, cp);
1237cpVisible = Math.Min(cpRunEnd, cp);
MS\Internal\TextFormatting\TextStore.cs (16)
508int effectedRangeStart = Math.Max(cpFetched - offset, bounds[0].Position);
509int effectedRangeEnd = Math.Min(cpFetched - offset + runInfo.Length, bounds[bounds.Length - 1].Position);
519int currentRangeEnd = Math.Min(bounds[i].Position, effectedRangeEnd);
553currentPosition = Math.Max(currentPosition, bounds[i + 1].Position);
1121int runLength = Math.Min(span.length, cchToAdd - ichRun);
1209int first = limit - Math.Min(charRange.Length, limitCp - firstCp);
1292int spanLength = Math.Min(runInfoSpanRider.Length, textEffectsSpanRider.Length);
1293int ichEnd = Math.Min(ichRun + spanLength, cchUniform);
1563(int)Math.Round(realToIdeal * runInfo.TextRun.Properties.FontRenderingEmSize),
1718(int)Math.Round(realToIdeal * runInfo.TextRun.Properties.FontRenderingEmSize),
1957textTop = Math.Max(textTop, lsrun.BaselineOffset);
1958textBottom = Math.Max(textBottom, lsrun.Descent);
1978textBottom = Math.Max(textBottom, lsrun.Height + top);
1982textBottom = Math.Max(textBottom, lsrun.Height + textTop);
2046cellAscent = Math.Max(cellAscent, lsrun.BaselineOffset - move);
2047cellDescent = Math.Max(cellDescent, lsrun.Descent + move);
System\Windows\Input\Stylus\Wisp\WispTabletDevice.cs (12)
271Size mouseDragDefault = new Size(Math.Max(1, SafeSystemMetrics.DragDeltaX / 2),
272Math.Max(1, SafeSystemMetrics.DragDeltaY / 2));
273Size mouseDoubleTapDefault = new Size(Math.Max(1, SafeSystemMetrics.DoubleClickDeltaX / 2),
274Math.Max(1, SafeSystemMetrics.DoubleClickDeltaY / 2));
284_cancelSize = new Size((int)Math.Round((ScreenSize.Width * stylusLogic.CancelDelta) / dwXValue),
285(int)Math.Round((ScreenSize.Height * stylusLogic.CancelDelta) / dwYValue));
289_cancelSize.Width = Math.Max(mouseDragDefault.Width, _cancelSize.Width);
290_cancelSize.Height = Math.Max(mouseDragDefault.Height, _cancelSize.Height);
292_doubleTapSize = new Size((int)Math.Round((ScreenSize.Width * stylusLogic.DoubleTapDelta) / dwXValue),
293(int)Math.Round((ScreenSize.Height * stylusLogic.DoubleTapDelta) / dwYValue));
297_doubleTapSize.Width = Math.Max(mouseDoubleTapDefault.Width, _doubleTapSize.Width);
298_doubleTapSize.Height = Math.Max(mouseDoubleTapDefault.Height, _doubleTapSize.Height);
System\Windows\Media\FormattedText.cs (21)
324i = Math.Min(limit, i + formatRider.Length);
397i = Math.Min(limit, i + formatRider.Length);
451i = Math.Min(limit, i + formatRider.Length);
503i = Math.Min(limit, i + formatRider.Length);
561i = Math.Min(limit, i + formatRider.Length);
619i = Math.Min(limit, i + formatRider.Length);
669i = Math.Min(limit, i + formatRider.Length);
720i = Math.Min(limit, i + formatRider.Length);
771i = Math.Min(limit, i + formatRider.Length);
821i = Math.Min(limit, i + formatRider.Length);
952return _that._maxTextWidths[Math.Min(line, _that._maxTextWidths.Length - 1)];
1091Math.Min(textSourcePosition + line.Length - 1, _that._text.Length - 1)
1602int x0 = Math.Max(enumerator.Position, startIndex);
1603int x1 = Math.Min(enumerator.Position + enumerator.Length, startIndex + count);
1754accBlackBoxLeft = Math.Min(accBlackBoxLeft, blackBoxLeft);
1755accBlackBoxRight = Math.Max(accBlackBoxRight, blackBoxRight);
1756accBlackBoxBottom = Math.Max(accBlackBoxBottom, blackBoxBottom);
1757accBlackBoxTop = Math.Min(accBlackBoxTop, blackBoxTop);
1763metrics.Width = Math.Max(metrics.Width, currentLine.Width);
1764metrics.WidthIncludingTrailingWhitespace = Math.Max(metrics.WidthIncludingTrailingWhitespace, currentLine.WidthIncludingTrailingWhitespace);
1765lineStartOfLongestLine = Math.Min(lineStartOfLongestLine, currentLine.Start);
System\Windows\Media3D\Quaternion.cs (34)
69double angleInRadians = angleInDegrees * (Math.PI / 180.0);
73Vector3D v = (axisOfRotation / length) * Math.Sin(0.5 * angleInRadians);
77_w = Math.Cos(0.5 * angleInRadians);
141double msin = Math.Sqrt(_x*_x + _y*_y + _z*_z);
150double maxcoeff = Math.Max(Math.Abs(_x),Math.Max(Math.Abs(_y),Math.Abs(_z)));
154msin = Math.Sqrt(x*x + y*y + z*z);
160return Math.Atan2(msin,mcos) * (360.0 / Math.PI);
240double rmax = 1.0/Max(Math.Abs(_x),
241Math.Abs(_y),
242Math.Abs(_z),
243Math.Abs(_w));
251double normInverse = 1.0 / Math.Sqrt(norm2);
425double max = Math.Max(Math.Max(Math.Abs(_x),Math.Abs(_y)),
426Math.Max(Math.Abs(_z),Math.Abs(_w)));
433double smallLength = Math.Sqrt(x*x+y*y+z*z+w*w);
437return Math.Sqrt(norm2);
541double theta = t * Math.PI;
543scaleFrom = Math.Cos(theta);
544scaleTo = Math.Sin(theta);
549double omega = Math.Acos(cosOmega);
550double sinOmega = Math.Sqrt(1.0 - cosOmega*cosOmega);
551scaleFrom = Math.Sin((1.0 - t) * omega) / sinOmega;
552scaleTo = Math.Sin(t * omega) / sinOmega;
560double lengthOut = lengthFrom * Math.Pow(lengthTo/lengthFrom, t);
System\Windows\Media3D\Rect3D.cs (18)
76_x = Math.Min(point1._x, point2._x);
77_y = Math.Min(point1._y, point2._y);
78_z = Math.Min(point1._z, point2._z);
79_sizeX = Math.Max(point1._x, point2._x) - _x;
80_sizeY = Math.Max(point1._y, point2._y) - _y;
81_sizeZ = Math.Max(point1._z, point2._z) - _z;
417double x = Math.Max(_x, rect._x);
418double y = Math.Max(_y, rect._y);
419double z = Math.Max(_z, rect._z);
420_sizeX = Math.Min(_x + _sizeX, rect._x + rect._sizeX) - x;
421_sizeY = Math.Min(_y + _sizeY, rect._y + rect._sizeY) - y;
422_sizeZ = Math.Min(_z + _sizeZ, rect._z + rect._sizeZ) - z;
455double x = Math.Min(_x, rect._x);
456double y = Math.Min(_y, rect._y);
457double z = Math.Min(_z, rect._z);
458_sizeX = Math.Max(_x + _sizeX, rect._x + rect._sizeX) - x;
459_sizeY = Math.Max(_y + _sizeY, rect._y + rect._sizeY) - y;
460_sizeZ = Math.Max(_z + _sizeZ, rect._z + rect._sizeZ) - z;
PresentationFramework (1130)
MS\Internal\Documents\DocumentGrid.cs (18)
315if (Math.Abs(pageNumber - _firstVisiblePageNumber) > 1)
576double clippedHorizontalOffset = Math.Min(_horizontalOffset, ExtentWidth - ViewportWidth);
577clippedHorizontalOffset = Math.Max(clippedHorizontalOffset, 0.0);
619double clippedVerticalOffset = Math.Min(_verticalOffset, ExtentHeight - ViewportHeight);
620clippedVerticalOffset = Math.Max(clippedVerticalOffset, 0.0);
1207pageOffset = new Point(Math.Max(ViewportWidth, ExtentWidth) - (xOffset + pageSize.Width), yOffset);
1434visiblePages.Add(_childrenCollection[_firstPageVisualIndex + j - Math.Max(0, firstPage)]);
1588double centerWidth = Math.Max(ViewportWidth, ExtentWidth);
2209(int)Math.Floor(ViewportWidth /
2214maxColumns = Math.Min(maxColumns, _pageCache.PageCount);
2215maxColumns = Math.Min(maxColumns, DocumentViewerConstants.MaximumMaxPagesAcross);
2226int rows = (int)Math.Floor((double)(_pageCache.PageCount / columns));
2238double aspectDiff = Math.Abs(layoutAspect - viewportAspect);
2347newScale = Math.Max(newScale, CurrentMinimumScale);
2348newScale = Math.Min(newScale, DocumentViewerConstants.MaximumScale);
2417scaleFactor = Math.Min(compensatedViewportWidth / rowWidth, compensatedViewportHeight / rowHeight);
2446scaleFactor = Math.Min(compensatedViewportWidth / rowWidth,
2672Math.Max(0.0, (ExtentWidth - row.RowSize.Width) / 2.0) : 0.0;
MS\Internal\Documents\RowCache.cs (13)
310double roundedOffset = Math.Round(offset, _findOffsetPrecision);
318double rowOffset = Math.Round(_rowCache[i].VerticalOffset, _findOffsetPrecision);
319double rowHeight = Math.Round(_rowCache[i].RowSize.Height, _findOffsetPrecision);
410startOffset = Math.Round(startOffset, _findOffsetPrecision);
411endOffset = Math.Round(endOffset, _findOffsetPrecision);
417double rowOffset = Math.Round(_rowCache[i].VerticalOffset, _findOffsetPrecision);
469_extentWidth = Math.Max(currentRow.RowSize.Width, _extentWidth);
536_layoutColumns = Math.Min(_layoutColumns, PageCache.PageCount);
537_layoutColumns = Math.Max(1, _layoutColumns);
651pivotPage = Math.Max(0, PageCache.PageCount - columns);
979_extentWidth = Math.Max(newRow.RowSize.Width, _extentWidth);
1109_extentWidth = Math.Max(row.RowSize.Width, _extentWidth);
1379_rowSize.Height = Math.Max(pageSize.Height, _rowSize.Height);
MS\Internal\Documents\TextBoxView.cs (32)
452desiredSize.Width = Math.Min(constraint.Width, desiredSize.Width);
453desiredSize.Height = Math.Min(constraint.Height, desiredSize.Height);
646int startOffset = Math.Min(_lineMetrics[_lineMetrics.Count - 1].EndOffset, startPosition.Offset);
647int endOffset = Math.Min(_lineMetrics[_lineMetrics.Count - 1].EndOffset, endPosition.Offset);
654firstLineIndex = Math.Max(firstLineIndex, GetLineIndexFromOffset(startOffset, LogicalDirection.Forward));
655lastLineIndex = Math.Min(lastLineIndex, GetLineIndexFromOffset(endOffset, LogicalDirection.Backward));
724int nextLineIndex = Math.Max(0, Math.Min(_lineMetrics.Count - 1, lineIndex + count));
1742Math.Max(0, Math.Min(_scrollData.ExtentWidth - _scrollData.ViewportWidth, _scrollData.HorizontalOffset)),
1743Math.Max(0, Math.Min(_scrollData.ExtentHeight - _scrollData.ViewportHeight, _scrollData.VerticalOffset)));
1889int endOffset = Math.Min(range.StartIndex + range.PositionsAdded, _host.TextContainer.SymbolCount);
2000int startOffset = Math.Max(_lineMetrics[lineIndex].Offset, unclippedStartOffset);
2001int endOffset = Math.Min(_lineMetrics[lineIndex].EndOffset, unclippedEndOffset);
2096int startOffset = Math.Max(lineStartOffset, unclippedStartOffset);
2097int endOffset = Math.Min(lineEndOffset, unclippedEndOffset);
2156lastLineIndex = (int)Math.Ceiling((viewport.Y + viewport.Height) / _lineHeight) - 1;
2159firstLineIndex = Math.Max(0, Math.Min(firstLineIndex, _lineMetrics.Count - 1));
2160lastLineIndex = Math.Max(0, Math.Min(lastLineIndex, _lineMetrics.Count - 1));
2232desiredSize.Width = Math.Max(desiredSize.Width, line.Width);
2506int lastCoveredCharOffset = range.StartIndex + Math.Max(range.PositionsAdded, range.PositionsRemoved);
2602desiredSize.Width = Math.Max(desiredSize.Width, _lineMetrics[i].Width);
2665int lineIndex = Math.Max(oldLineVisualsIndex, firstLineIndex);
2666int lineCount = Math.Min(oldLastLineIndex, firstLineIndex + count - 1) - lineIndex + 1;
2751count = Math.Max(0, count);
2757count = Math.Min(count, _viewportLineVisuals.Count - start);
2932int rangeStart = Math.Max(viewportStart, selectionStart);
2933int rangeSize = Math.Min(viewportEnd, selectionEnd) - rangeStart;
3069padding = Math.Max(0, viewport.Height - _contentSize.Height);
MS\Internal\Ink\LassoHelper.cs (6)
108double step = Math.Sqrt(MinDistanceSquared / distanceSquared);
228&& DoubleUtil.GreaterThanOrClose(point.X, Math.Min(prevLassoPoint.X, lassoPoint.X))
229&& DoubleUtil.LessThanOrClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
238if (DoubleUtil.GreaterThanOrClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
244if ((0 == i) && DoubleUtil.AreClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
249else if (DoubleUtil.GreaterThanOrClose(point.X, Math.Min(prevLassoPoint.X, lassoPoint.X)))
MS\Internal\PtsHost\ContainerParagraph.cs (13)
504fsrcToFillSubtrack.u = Math.Max(Math.Min(fsrcToFillSubtrack.u, fsrcToFill.u + fsrcToFill.du - 1), fsrcToFill.u);
505fsrcToFillSubtrack.du = Math.Max(fsrcToFillSubtrack.du, 0);
518fsrcToFillSubtrack.v = Math.Max(Math.Min(fsrcToFillSubtrack.v, fsrcToFill.v + fsrcToFill.dv - 1), fsrcToFill.v);
519fsrcToFillSubtrack.dv = Math.Max(fsrcToFillSubtrack.dv, 0);
577dvrUsed = Math.Min(fsrcToFill.dv, dvrUsed);
657urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack);
658durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
781urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack);
782durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
MS\Internal\PtsHost\SubpageParagraph.cs (16)
162subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
171subpageHeight = Math.Max(1, subpageHeight - (marginTop + mbp.BPTop));
222dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
223fsrcToFill.du = Math.Max(fsrcToFill.du, fsbbox.fsrc.du + fsbbox.fsrc.u);
266fsbbox.fsrc.du = Math.Max(fsrcToFill.du - (mbp.MarginLeft + mbp.MarginRight), 0);
267fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
342subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
410dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
411durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u);
421fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0);
422fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
498subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
565dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
566durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u);
576fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0);
577fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
MS\Internal\PtsHost\TextParaClient.cs (19)
738int dcpStart = Math.Max(cpStartTextPointer, cpParagraphStart) - cpParagraphStart;
742int dcpEnd = Math.Min(cpEndTextPointer, cpParagraphEnd) - cpParagraphStart;
1407int countVisualsShiftBeforeChange = Math.Min(Math.Max(lineIndexToBeginRemoval - _lineIndexFirstVisual, 0), lineVisuals.Count);
1424int actualLinesToRemove = Math.Min(Math.Max(lineIndexToBeginRemoval - _lineIndexFirstVisual + cLinesToRemove, 0), lineVisuals.Count);
1452int actualLinesToRemove = Math.Min(cLinesToRemove, lineVisuals.Count - (lineIndexToBeginRemoval - _lineIndexFirstVisual));
1872int dcpRangeStartForThisLine = Math.Max(lineDesc.dcpFirst, dcpStart);
1875int cchRangeForThisLine = Math.Max(Math.Min(lineDesc.dcpLim, dcpEnd) - dcpRangeStartForThisLine, 1);
1982int dcpRangeStartForThisElem = Math.Max(elemDesc.dcpFirst, dcpStart);
1985int cchRangeForThisElem = Math.Max(Math.Min(elemDesc.dcpLim, dcpEnd) - dcpRangeStartForThisElem, 1);
2077lineRect.Width = Math.Max(lineVisual.WidthIncludingTrailingWhitespace, 0);
2188elementRect.Width = Math.Max(lineVisual.WidthIncludingTrailingWhitespace, 0);
3126line.GetGlyphRuns(glyphRuns, Math.Max(dcpStart, lineDesc.dcpFirst), Math.Min(dcpEnd, lineDesc.dcpLim));
3188line.GetGlyphRuns(glyphRuns, Math.Max(dcpStart, element.dcpFirst), Math.Min(dcpEnd, element.dcpLim));
System\Windows\Controls\Border.cs (12)
229Size childConstraint = new Size(Math.Max(0.0, constraint.Width - combined.Width),
230Math.Max(0.0, constraint.Height - combined.Height));
642Math.Max(0.0, rt.Width - thick.Left - thick.Right),
643Math.Max(0.0, rt.Height - thick.Top - thick.Bottom));
986LeftTop = Math.Max(0.0, radii.TopLeft - left);
987TopLeft = Math.Max(0.0, radii.TopLeft - top);
988TopRight = Math.Max(0.0, radii.TopRight - top);
989RightTop = Math.Max(0.0, radii.TopRight - right);
990RightBottom = Math.Max(0.0, radii.BottomRight - right);
991BottomRight = Math.Max(0.0, radii.BottomRight - bottom);
992BottomLeft = Math.Max(0.0, radii.BottomLeft - bottom);
993LeftBottom = Math.Max(0.0, radii.BottomLeft - left);
System\Windows\Controls\DataGrid.cs (18)
2617indexToSelect = Math.Min(Items.Count - numSelected - 1, indexToSelect);
5019int newRowCount = Math.Abs(endIndex - startIndex) + 1;
5020int newColumnCount = Math.Abs(endColumnIndex - startColumnIndex) + 1;
5038int previousStartIndex = Math.Min(startIndex, currentCellIndex);
5039int previousRowCount = Math.Abs(currentCellIndex - startIndex) + 1;
5040int previousStartColumnIndex = Math.Min(startColumnIndex, currentCellColumnIndex);
5041int previousColumnCount = Math.Abs(currentCellColumnIndex - startColumnIndex) + 1;
5081_selectedCells.AddRegion(Math.Min(startIndex, endIndex), Math.Min(startColumnIndex, endColumnIndex), newRowCount, newColumnCount);
5679nextDisplayIndex = Math.Max(0, InternalColumns.LastVisibleDisplayIndex);
5760nextRowIndex = Math.Max(0, Items.Count - 1);
5945index = Math.Max(0, Math.Min(numItems - 1, index + (shiftModifier ? -1 : 1)));
6085int jumpDistance = Math.Max(1, (int)scrollHost.ViewportHeight - 1);
6087targetIndex = Math.Max(0, Math.Min(targetIndex, Items.Count - 1));
6530distance = Math.Abs(pt.Y - cellBounds.Top);
6538distance = Math.Abs(pt.X - cellBounds.Left);
System\Windows\Controls\DataGridColumnCollection.cs (24)
748int columnCount = Math.Min(newFrozenCount, Count);
756int columnCount = Math.Min(oldFrozenCount, Count);
946availableStarSpace = Math.Max(0.0, availableStarSpace - columnMinWidth);
1227double displayValue = Math.Max(width.DesiredValue, minWidth);
1267double displayValue = Math.Min(width.DesiredValue, maxWidth);
1335TakeAwayWidthFromColumns(null, Math.Abs(availableSpaceChange), false, newTotalAvailableSpace);
1359column.SetWidthInternal(new DataGridLength(width.Value, width.UnitType, width.DesiredValue, Math.Min(width.DesiredValue, maxWidth)));
1381Math.Max(width.DisplayValue - nonRetrievableSpace, changedColumn.MinWidth)));
1453return Math.Max(availableSpace - requiredSpace, 0.0);
1664column.UpdateWidthForStarColumn(Math.Max(columnDesiredWidth, column.MinWidth), columnDesiredWidth, columnDesiredWidth / perStarWidth);
1693double columnExcessWidth = onlyShrinkToDesiredWidth ? width.DisplayValue - Math.Max(width.DesiredValue, column.MinWidth) : width.DisplayValue - column.MinWidth;
1778double maxColumnResizeWidth = expandBeyondDesiredWidth ? column.MaxWidth : Math.Min(width.DesiredValue, column.MaxWidth);
1913column.UpdateWidthForStarColumn(Math.Min(columnDesiredWidth, column.MaxWidth), columnDesiredWidth, columnDesiredWidth / perStarWidth);
2000double usedStarSpace = ComputeStarColumnWidths(Math.Min(expectedStarSpace, sumOfStarMaxWidths));
2001giveAwayWidth = Math.Max(usedStarSpace - expectedStarSpace, 0.0);
2071double lagWidth = Math.Min(width.DesiredValue, columnMaxWidth) - width.DisplayValue;
2102if (DoubleUtil.LessThan(width.DisplayValue, Math.Min(width.DesiredValue, column.MaxWidth)))
2130giveAwayWidth -= Math.Min(contributingSpace, giveAwayWidth);
2137giveAwayWidth = Math.Min(giveAwayWidth, Math.Max(0d, totalSpace - usedSpace));
2184return Math.Min(usedSpace - totalAvailableWidth, takeAwayWidth);
2192takeAwayWidth = Math.Max(0.0, takeAwayWidth - unusedSpace);
2263double usedStarSpace = ComputeStarColumnWidths(Math.Max(expectedStarSpace, sumOfStarMinWidths));
2264takeAwayWidth = Math.Max(usedStarSpace - expectedStarSpace, 0.0);
System\Windows\Controls\DockPanel.cs (10)
216childConstraint = new Size(Math.Max(0.0, constraint.Width - accumulatedWidth),
217Math.Max(0.0, constraint.Height - accumulatedHeight));
237parentHeight = Math.Max(parentHeight, accumulatedHeight + childDesiredSize.Height);
243parentWidth = Math.Max(parentWidth, accumulatedWidth + childDesiredSize.Width);
250parentWidth = Math.Max(parentWidth, accumulatedWidth);
251parentHeight = Math.Max(parentHeight, accumulatedHeight);
281Math.Max(0.0, arrangeSize.Width - (accumulatedLeft + accumulatedRight)),
282Math.Max(0.0, arrangeSize.Height - (accumulatedTop + accumulatedBottom)) );
295rcChild.X = Math.Max(0.0, arrangeSize.Width - accumulatedRight);
306rcChild.Y = Math.Max(0.0, arrangeSize.Height - accumulatedBottom);
System\Windows\Controls\FlowDocumentScrollViewer.cs (8)
584Math.Max(ia.OriginWidth, pagePadding.Left),
585Math.Max(ia.OriginHeight, pagePadding.Top),
586Math.Max(ia.MediaSizeWidth - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right),
587Math.Max(ia.MediaSizeHeight - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom));
623Zoom = Math.Min(Zoom + ZoomIncrement, MaxZoom);
635Zoom = Math.Max(Zoom - ZoomIncrement, MinZoom);
701SetCurrentValueInternal(ZoomProperty, Math.Min(Zoom + ZoomIncrement, MaxZoom));
705SetCurrentValueInternal(ZoomProperty, Math.Max(Zoom - ZoomIncrement, MinZoom));
System\Windows\Controls\Grid.cs (69)
422gridDesiredSize.Width = Math.Max(gridDesiredSize.Width, child.DesiredSize.Width);
423gridDesiredSize.Height = Math.Max(gridDesiredSize.Height, child.DesiredSize.Height);
953ColumnIndex = Math.Min(GetColumn(child), DefinitionsU.Length - 1),
956RowIndex = Math.Min(GetRow(child), DefinitionsV.Length - 1)
962cell.ColumnSpan = Math.Min(GetColumnSpan(child), DefinitionsU.Length - cell.ColumnIndex);
966cell.RowSpan = Math.Min(GetRowSpan(child), DefinitionsV.Length - cell.RowIndex);
1143userMinSize = Math.Max(userMinSize, Math.Min(userSize, userMaxSize));
1167definitions[i].MeasureSize = Math.Max(userMinSize, Math.Min(userSize, userMaxSize));
1267DefinitionsU[PrivateCells[i].ColumnIndex].UpdateMinSize(Math.Min(children[i].DesiredSize.Width, DefinitionsU[PrivateCells[i].ColumnIndex].UserMaxSize));
1284DefinitionsV[PrivateCells[i].RowIndex].UpdateMinSize(Math.Min(children[i].DesiredSize.Height, DefinitionsV[PrivateCells[i].RowIndex].UserMaxSize));
1505double maxSize = Math.Max(definitions[i].UserMaxSize, minSize);
1557double newMinSize = Math.Min(sizeToDistribute / (count - i), tempDefinitions[i].PreferredSize);
1587tempDefinitions[i].UpdateMinSize(Math.Min(newMinSize, tempDefinitions[i].SizeCache));
1598tempDefinitions[i].UpdateMinSize(Math.Min(newMinSize, tempDefinitions[i].SizeCache));
1709starValue = Math.Min(starValue, c_starClip);
1713double maxSize = Math.Max(definitions[i].MinSize, definitions[i].UserMaxSize);
1714maxSize = Math.Min(maxSize, c_starClip);
1752double userSize = Math.Max(availableSize - takenSize, 0.0) * (starValue / tempDefinitions[i].SizeCache);
1753resolvedSize = Math.Min(userSize, tempDefinitions[i].UserMaxSize);
1754resolvedSize = Math.Max(tempDefinitions[i].MinSize, resolvedSize);
1815double power = Math.Floor(Math.Log(Double.MaxValue / maxStar / starCount, 2.0));
1818scale = Math.Pow(2.0, power - 4.0); // -4 is just for paranoia
1866double effectiveMaxSize = Math.Max(def.MinSize, def.UserMaxSize);
1938resolvedSize = Math.Max(resolvedDef.MinSize, resolvedDef.UserMaxSize);
2056double resolvedSize = (def.MeasureSize > 0.0) ? Math.Max(availableSize - takenSize, 0.0) * (def.MeasureSize / def.SizeCache) : 0.0;
2059resolvedSize = Math.Min(resolvedSize, def.UserMaxSize);
2060resolvedSize = Math.Max(def.MinSize, resolvedSize);
2149starValue = Math.Min(starValue, c_starClip);
2153double maxSize = Math.Max(definitions[i].MinSizeForArrange, definitions[i].UserMaxSize);
2154maxSize = Math.Min(maxSize, c_starClip);
2194definitions[i].SizeCache = Math.Max(definitions[i].MinSizeForArrange, Math.Min(userSize, userMaxSize));
2239double userSize = Math.Max(finalSize - allPreferredArrangeSize, 0.0) * (starValue / definitions[definitionIndices[i]].SizeCache);
2240resolvedSize = Math.Min(userSize, definitions[definitionIndices[i]].UserMaxSize);
2241resolvedSize = Math.Max(definitions[definitionIndices[i]].MinSizeForArrange, resolvedSize);
2266final = Math.Max(final, definitions[definitionIndex].MinSizeForArrange);
2267final = Math.Min(final, definitions[definitionIndex].SizeCache);
2273final = Math.Max(final, definitions[definitionIndex].MinSizeForArrange);
2274final = Math.Min(final, definitions[definitionIndex].SizeCache);
2307final = Math.Max(final, definition.MinSizeForArrange);
2323final = Math.Max(final, definition.MinSizeForArrange);
2394double power = Math.Floor(Math.Log(Double.MaxValue / maxStar / starCount, 2.0));
2397scale = Math.Pow(2.0, power - 4.0); // -4 is just for paranoia
2441double effectiveMaxSize = Math.Max(def.MinSizeForArrange, def.UserMaxSize);
2480def.SizeCache = Math.Max(def.MinSizeForArrange, Math.Min(userSize, userMaxSize));
2549resolvedSize = Math.Max(resolvedDef.MinSizeForArrange, resolvedDef.UserMaxSize);
2681double resolvedSize = (def.MeasureSize > 0.0) ? Math.Max(finalSize - takenSize, 0.0) * (def.MeasureSize / def.SizeCache) : 0.0;
2684resolvedSize = Math.Min(resolvedSize, def.UserMaxSize);
2685resolvedSize = Math.Max(def.MinSizeForArrange, resolvedSize);
2776final = Math.Max(final, definition.MinSizeForArrange);
2792final = Math.Max(final, definition.MinSizeForArrange);
2834double minPower = Math.Floor(Math.Log(minRatio, 2.0));
2835double maxPower = Math.Floor(Math.Log(maxRatio, 2.0));
2836double f = Math.Pow(2.0, Math.Floor((minPower + maxPower) / 2.0));
2915Array.Clear(extData.TempDefinitions, 0, Math.Max(DefinitionsU.Length, DefinitionsV.Length));
3120int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length) * 2;
3153int requiredLength = Math.Max(Math.Max(DefinitionsU.Length, DefinitionsV.Length), 1) * 2;
3171int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length);
3263return (Math.Abs(d) < c_epsilon);
3274return (Math.Abs(d1 - d2) < c_epsilon);
System\Windows\Controls\GridSplitter.cs (13)
503_resizeData.SplitterLength = Math.Min(ActualWidth, ActualHeight);
655horizontalChange = Math.Round(horizontalChange / dragIncrement) * dragIncrement;
656verticalChange = Math.Round(verticalChange / dragIncrement) * dragIncrement;
663_resizeData.Adorner.OffsetX = Math.Min(Math.Max(horizontalChange, _resizeData.MinChange), _resizeData.MaxChange);
667_resizeData.Adorner.OffsetY = Math.Min(Math.Max(verticalChange, _resizeData.MinChange), _resizeData.MaxChange);
801definition1Min = Math.Max(definition1Min, _resizeData.SplitterLength);
805definition2Min = Math.Max(definition2Min, _resizeData.SplitterLength);
811minDelta = -Math.Min(definition1Len - definition1Min, definition2Max - definition2Len);
812maxDelta = Math.Min(definition1Max - definition1Len, definition2Len - definition2Min);
920delta = Math.Min(Math.Max(delta, min), max);
System\Windows\Controls\GridViewHeaderRowPresenter.cs (8)
258double childConstraintWidth = Math.Max(0.0, constraint.Width - accumulatedWidth);
280childConstraintWidth = Math.Min(childConstraintWidth, column.DesiredWidth);
288childConstraintWidth = Math.Min(childConstraintWidth, column.Width);
295maxHeight = Math.Max(maxHeight, child.DesiredSize.Height);
302maxHeight = Math.Max(maxHeight, _paddingHeader.DesiredSize.Height);
351double childArrangeWidth = Math.Min(remainingWidth, ((column.State == ColumnMeasureState.SpecificWidth) ? column.Width : column.DesiredWidth));
385rect = new Rect(accumulatedWidth, 0.0, Math.Max(remainingWidth, 0.0), arrangeSize.Height);
1217return (DoubleUtil.GreaterThan(Math.Abs(currentPos.X - originalPos.X), c_thresholdX));
System\Windows\Controls\Primitives\DataGridColumnHeadersPresenter.cs (10)
116desiredSize.Width = Math.Max(desiredSize.Width, indicatorSize.Width);
117desiredSize.Height = Math.Max(desiredSize.Height, indicatorSize.Height);
124desiredSize.Width = Math.Max(desiredSize.Width, indicatorSize.Width);
125desiredSize.Height = Math.Max(desiredSize.Height, indicatorSize.Height);
128desiredSize.Width = Math.Min(availableSize.Width, desiredSize.Width);
148childRect.Width = Math.Max(finalSize.Width, dataGrid.CellsPanelActualWidth);
631return DoubleUtil.GreaterThan(Math.Abs(currentPos.X - originalPos.X), SystemParameters.MinimumHorizontalDragDistance);
680height = Math.Max(_draggingSrcColumnHeader.RenderSize.Height, _columnHeaderDragIndicator.Height);
902columnEstimatedWidth = Math.Max(averageColumnWidth, column.MinWidth);
903columnEstimatedWidth = Math.Min(columnEstimatedWidth, column.MaxWidth);
System\Windows\Controls\Primitives\Popup.cs (26)
2108if (Math.Abs(score - childArea) < Tolerance)
2134if (Math.Abs(intersection.Width - childBounds.Width) > Tolerance ||
2135Math.Abs(intersection.Height - childBounds.Height) > Tolerance)
2149if (!IsTransparent || double.IsNaN(horizontalAxis.Y) || Math.Abs(horizontalAxis.Y) < Tolerance)
2161else if (IsTransparent && Math.Abs(horizontalAxis.X) < Tolerance)
2184if (!IsTransparent || double.IsNaN(verticalAxis.X) || Math.Abs(verticalAxis.X) < Tolerance)
2195else if (IsTransparent && Math.Abs(verticalAxis.Y) < Tolerance)
2250if (!IsTransparent || double.IsNaN(verticalAxis.X) || Math.Abs(verticalAxis.X) < Tolerance)
2252limitSize.Height = Math.Max(0.0, Math.Max(screenBounds.Bottom - targetBounds.Bottom, targetBounds.Top - screenBounds.Top));
2254else if (IsTransparent && Math.Abs(verticalAxis.Y) < Tolerance)
2256limitSize.Width = Math.Max(0.0, Math.Max(screenBounds.Right - targetBounds.Right, targetBounds.Left - screenBounds.Left));
2272if (!IsTransparent || double.IsNaN(horizontalAxis.X) || Math.Abs(horizontalAxis.Y) < Tolerance)
2274limitSize.Width = Math.Max(0.0, Math.Max(screenBounds.Right - targetBounds.Right, targetBounds.Left - screenBounds.Left));
2276else if (IsTransparent && Math.Abs(horizontalAxis.X) < Tolerance)
2278limitSize.Height = Math.Max(0.0, Math.Max(screenBounds.Bottom - targetBounds.Bottom, targetBounds.Top - screenBounds.Top));
2628desiredSize.Width = Math.Min(desiredSize.Width, screenBounds.Width);
2629desiredSize.Width = Math.Min(desiredSize.Width, limitSize.Width);
2633desiredSize.Height = Math.Min(desiredSize.Height, screenBounds.Height);
2634desiredSize.Height = Math.Min(desiredSize.Height, maxHeight);
2635desiredSize.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)
400get { return Math.Max(0.0, ExtentWidth - ViewportWidth); }
408get { return Math.Max(0.0, ExtentHeight - ViewportHeight); }
1745DoubleUtil.LessThan(Math.Abs(unusedX), PanningInfo.PreFeedbackTranslationX))
1753DoubleUtil.LessThan(Math.Abs(unusedY), PanningInfo.PreFeedbackTranslationY))
1798double newUnused = Math.Max(unused + delta, 0);
1807double newUnused = Math.Min(unused + delta, 0);
1818Math.Round(PanningRatio * cumulativeTranslation / _panningInfo.DeltaPerHorizontalOffet));
1828Math.Round(PanningRatio * cumulativeTranslation / _panningInfo.DeltaPerVerticalOffset));
1841if (Math.Abs(Environment.TickCount - _panningInfo.InertiaBoundaryBeginTimestamp) < PanningInfo.InertiaBoundryMinimumTicks)
1846return (DoubleUtil.GreaterThanOrClose(Math.Abs(_panningInfo.UnusedTranslation.X), PanningInfo.MaxInertiaBoundaryTranslation) ||
1847DoubleUtil.GreaterThanOrClose(Math.Abs(_panningInfo.UnusedTranslation.Y), PanningInfo.MaxInertiaBoundaryTranslation));
1866bool validX = (DoubleUtil.GreaterThan(Math.Abs(translation.X), PanningInfo.PrePanTranslation));
1867bool validY = (DoubleUtil.GreaterThan(Math.Abs(translation.Y), PanningInfo.PrePanTranslation));
1877bool biggerX = (DoubleUtil.GreaterThanOrClose(Math.Abs(translation.X), Math.Abs(translation.Y)));
1890bool biggerY = (DoubleUtil.GreaterThanOrClose(Math.Abs(translation.Y), Math.Abs(translation.X)));
System\Windows\Controls\SinglePageViewer.cs (6)
690Math.Max(ia.OriginWidth, pagePadding.Left),
691Math.Max(ia.OriginHeight, pagePadding.Top),
692Math.Max(ia.MediaSizeWidth - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right),
693Math.Max(ia.MediaSizeHeight - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom));
731SetCurrentValueInternal(ZoomProperty, Math.Min(Zoom + ZoomIncrement, MaxZoom));
743SetCurrentValueInternal(ZoomProperty, Math.Max(Zoom - ZoomIncrement, MinZoom));
System\Windows\Controls\Slider.cs (15)
987valueToSize = Math.Max(0.0, (trackSize.Width - thumbSize.Width) / range);
993Canvas.SetLeft(rangeElement, (thumbSize.Width * 0.5) + Math.Max(Maximum - SelectionEnd, 0) * valueToSize);
997Canvas.SetLeft(rangeElement, (thumbSize.Width * 0.5) + Math.Max(SelectionStart - Minimum, 0) * valueToSize);
1009valueToSize = Math.Max(0.0, (trackSize.Height - thumbSize.Height) / range);
1015Canvas.SetTop(rangeElement, (thumbSize.Height * 0.5) + Math.Max(SelectionStart - Minimum, 0) * valueToSize);
1019Canvas.SetTop(rangeElement, (thumbSize.Height * 0.5) + Math.Max(Maximum - SelectionEnd,0) * valueToSize);
1052valueToSize = Math.Max(0.0, (trackSize.Width - thumbSize.Width) / range);
1076valueToSize = Math.Max(0.0, (trackSize.Height - thumbSize.Height) / range);
1184previous = Minimum + (Math.Round(((value - Minimum) / TickFrequency)) * TickFrequency);
1185next = Math.Min(Maximum, previous + TickFrequency);
1205double next = SnapToTick(Math.Max(this.Minimum, Math.Min(this.Maximum, value + direction)));
1243double tickNumber = Math.Round((value - Minimum) / TickFrequency);
1401this.SetCurrentValueInternal(ValueProperty, Math.Max(this.Minimum, Math.Min(this.Maximum, snappedValue)));
System\Windows\Controls\Stack.cs (15)
593stackDesiredSize.Height = Math.Max(stackDesiredSize.Height, childDesiredSize.Height);
598stackDesiredSize.Width = Math.Max(stackDesiredSize.Width, childDesiredSize.Width);
658offset.Y = Math.Max(0, Math.Min(offset.Y, extent.Height - viewport.Height));
666offset.X = Math.Max(0, Math.Min(offset.X, extent.Width - viewport.Width));
671stackDesiredSize.Width = Math.Min(stackDesiredSize.Width, constraint.Width);
672stackDesiredSize.Height = Math.Min(stackDesiredSize.Height, constraint.Height);
750rcChild.Height = Math.Max(arrangeSize.Height, child.DesiredSize.Height);
757rcChild.Width = Math.Max(arrangeSize.Width, child.DesiredSize.Width);
891double left = Math.Max(targetRectOffset, minPhysicalOffset);
892targetRectSize = Math.Max(Math.Min(targetRectSize + targetRectOffset, minPhysicalOffset + viewportSize) - left, 0);
990iNewOffset = Math.Max(Math.Min(numberOfItems - 1, iNewOffset), 0);
System\Windows\Controls\TextBlock.cs (12)
1259Size contentSize = new Size(Math.Max(0.0, constraint.Width - (padding.Left + padding.Right)),
1260Math.Max(0.0, constraint.Height - (padding.Top + padding.Bottom)));
1299desiredSize.Width = Math.Max(desiredSize.Width, line.GetCollapsedWidth());
1522double contentBottom = Math.Max(0.0, RenderSize.Height - Padding.Bottom);
1956Size contentSize = new Size(Math.Max(0.0, _referenceSize.Width - (padding.Left + padding.Right)),
1957Math.Max(0.0, _referenceSize.Height - (padding.Top + padding.Bottom)));
2309int dcpStart = Math.Max(dcpLineStart, dcpPositionStart);
2310int dcpEnd = Math.Min(dcpLineEnd, dcpPositionEnd);
3096Size contentSize = new Size(Math.Max(0.0, computedSize.Width - (padding.Left + padding.Right)),
3097Math.Max(0.0, computedSize.Height - (padding.Top + padding.Bottom)));
3146double contentBottom = Math.Max(0.0, RenderSize.Height - Padding.Bottom);
3176width = Math.Max(0.0, width - paddingWidth);
System\Windows\Controls\VirtualizedCellInfoCollection.cs (12)
608int left = Math.Max(Left, region.Left);
609int top = Math.Max(Top, region.Top);
610int right = Math.Min(Right, region.Right);
611int bottom = Math.Min(Bottom, region.Bottom);
681Left = Math.Min(Left, region.Left);
682Top = Math.Min(Top, region.Top);
683Right = Math.Max(prevRight, region.Right);
684Bottom = Math.Max(prevBottom, region.Bottom);
724int top = Math.Max(Top, region.Top);
725int bottom = Math.Min(Bottom, region.Bottom);
732int top = Math.Max(Top, region.Top);
733int bottom = Math.Min(Bottom, region.Bottom);
System\Windows\Controls\VirtualizingStackPanel.cs (185)
510double delta = Math.Abs(scrollX - oldViewportOffset.X);
523_scrollData._offset.X = Math.Floor(_scrollData._offset.X);
524_scrollData._computedOffset.X = Math.Floor(_scrollData._computedOffset.X);
638double delta = Math.Abs(scrollY - oldViewportOffset.Y);
651_scrollData._offset.Y = Math.Floor(_scrollData._offset.Y);
652_scrollData._computedOffset.Y = Math.Floor(_scrollData._computedOffset.Y);
2319double factor = Math.Min(1.0, isHorizontal ? viewport.Width / extendedViewport.Width : viewport.Height / extendedViewport.Height);
2320int calcItemsInViewportCount = (int)Math.Ceiling(factor * _itemsInExtendedViewportCount);
2321excludeCount = Math.Max(excludeCount,
2615double spanBeforeViewport = Math.Max(isHorizontal ? viewport.X : viewport.Y, 0.0);
2672_firstItemInExtendedViewportIndex = Math.Max(_firstItemInExtendedViewportIndex - 1, 0);
2674_firstItemInExtendedViewportChildIndex = Math.Max(_firstItemInExtendedViewportChildIndex, 0);
3369arrangeLength = Math.Max(isHorizontal ? arrangeSize.Height : arrangeSize.Width, arrangeLength);
4735pixelSizeBeforeViewport = Math.Max(pixelSizeBeforeViewport, Math.Abs(_viewport.X - _extendedViewport.X));
4739logicalSizeBeforeViewport = Math.Max(logicalSizeBeforeViewport, Math.Abs(_viewport.X - _extendedViewport.X));
4771extendedViewport.Width = Math.Max(extendedViewport.Width + extendedViewport.X, 0.0);
4782extendedViewport.Width = Math.Max(_scrollData._extent.Width - extendedViewport.X, 0.0);
4811extendedViewport.Width = Math.Max(extendedViewport.Width / approxSizeOfLogicalUnit + extendedViewport.X, 0.0) * approxSizeOfLogicalUnit;
4822extendedViewport.Width = Math.Max(_scrollData._extent.Width - extendedViewport.X, 0.0) * approxSizeOfLogicalUnit;
4851pixelSizeBeforeViewport = Math.Max(pixelSizeBeforeViewport, Math.Abs(_viewport.Y - _extendedViewport.Y));
4855logicalSizeBeforeViewport = Math.Max(logicalSizeBeforeViewport, Math.Abs(_viewport.Y - _extendedViewport.Y));
4887extendedViewport.Height = Math.Max(extendedViewport.Height + extendedViewport.Y, 0.0);
4898extendedViewport.Height = Math.Max(_scrollData._extent.Height - extendedViewport.Y, 0.0);
4927extendedViewport.Height = Math.Max(extendedViewport.Height / approxSizeOfLogicalUnit + extendedViewport.Y, 0.0) * approxSizeOfLogicalUnit;
4938extendedViewport.Height = Math.Max(_scrollData._extent.Height - extendedViewport.Y, 0.0) * approxSizeOfLogicalUnit;
4950double factor = Math.Max(1.0, isHorizontal ? extendedViewport.Width / viewport.Width : extendedViewport.Height / viewport.Height);
4951int calcItemsInExtendedViewportCount = (int)Math.Ceiling(factor * _actualItemsInExtendedViewportCount);
4952itemsInExtendedViewportCount = Math.Max(calcItemsInExtendedViewportCount, itemsInExtendedViewportCount);
5063viewport.Width = Math.Max(viewport.Width - sizeAfterStartViewportEdge, 0);
5067cacheBeforeSize = Math.Max(cacheBeforeSize - sizeBeforeStartViewportEdge, 0);
5071cacheBeforeSize = Math.Max(cacheBeforeSize - Math.Floor(logicalSize.Width * sizeBeforeStartViewportEdge / pixelSize.Width), 0);
5098viewport.Width = Math.Max(0, parentViewport.Width - pixelSize.Width);
5113cacheAfterSize = Math.Max(cacheAfterSize - sizeAfterEndViewportEdge, 0);
5117cacheAfterSize = Math.Max(cacheAfterSize - Math.Floor(logicalSize.Width * sizeAfterEndViewportEdge / pixelSize.Width), 0);
5129cacheAfterSize = Math.Max(cacheAfterSize - pixelSize.Width, 0);
5133cacheAfterSize = Math.Max(cacheAfterSize - logicalSize.Width, 0);
5162viewport.Height = Math.Max(viewport.Height - sizeAfterStartViewportEdge, 0);
5166cacheBeforeSize = Math.Max(cacheBeforeSize - sizeBeforeStartViewportEdge, 0);
5170cacheBeforeSize = Math.Max(cacheBeforeSize - Math.Floor(logicalSize.Height * sizeBeforeStartViewportEdge / pixelSize.Height), 0);
5197viewport.Height = Math.Max(0, parentViewport.Height - pixelSize.Height);
5212cacheAfterSize = Math.Max(cacheAfterSize - sizeAfterEndViewportEdge, 0);
5216cacheAfterSize = Math.Max(cacheAfterSize - Math.Floor(logicalSize.Height * sizeAfterEndViewportEdge / pixelSize.Height), 0);
5228cacheAfterSize = Math.Max(cacheAfterSize - pixelSize.Height, 0);
5232cacheAfterSize = Math.Max(cacheAfterSize - logicalSize.Height, 0);
5297cacheBeforeSize = Math.Max(0, cacheBeforeSize - parentViewport.X);
5302viewport.Width = Math.Max(0, viewport.Width + viewport.X);
5322cacheBeforeSize = Math.Max(0, cacheBeforeSize - inset.Right);
5326cacheBeforeSize = Math.Max(0, cacheBeforeSize - 1);
5341viewport.Width = Math.Max(0, viewport.Width - inset.Left);
5352cacheAfterSize = Math.Max(0, cacheAfterSize - (inset.Left - viewport.Width));
5369cacheAfterSize = Math.Max(0, cacheAfterSize - inset.Left);
5373cacheAfterSize = Math.Max(0, cacheAfterSize - 1);
5400cacheBeforeSize = Math.Max(0, cacheBeforeSize - parentViewport.Y);
5405viewport.Height = Math.Max(0, viewport.Height + viewport.Y);
5425cacheBeforeSize = Math.Max(0, cacheBeforeSize - inset.Bottom);
5429cacheBeforeSize = Math.Max(0, cacheBeforeSize - 1);
5444viewport.Height = Math.Max(0, viewport.Height - inset.Top);
5455cacheAfterSize = Math.Max(0, cacheAfterSize - (inset.Top - viewport.Height));
5472cacheAfterSize = Math.Max(0, cacheAfterSize - inset.Top);
5476cacheAfterSize = Math.Max(0, cacheAfterSize - 1);
5532double spanBeforeViewport = Math.Max(isHorizontal ? viewport.X : viewport.Y, 0.0);
5544firstItemInViewportIndex = (int)Math.Floor(spanBeforeViewport / childSize);
6520double eps = (Math.Abs(value1) + Math.Abs(value2)) * Tolerance;
6701childViewport.X = Math.Min(childViewport.X, 0) -
6704childViewport.Width = Math.Max(childViewport.Width - stackPixelSizeInViewport.Width, 0.0);
6709childViewport.Width = Math.Max(childViewport.Width - stackPixelSizeInViewport.Width, 0.0);
6717Math.Max(parentCacheSize.CacheBeforeViewport - stackLogicalSizeInCacheBeforeViewport.Width, 0.0),
6720Math.Max(parentCacheSize.CacheAfterViewport - stackLogicalSizeInCacheAfterViewport.Width, 0.0));
6728Math.Max(parentCacheSize.CacheBeforeViewport - stackPixelSizeInCacheBeforeViewport.Width, 0.0),
6731Math.Max(parentCacheSize.CacheAfterViewport - stackPixelSizeInCacheAfterViewport.Width, 0.0));
6746childViewport.Y = Math.Min(childViewport.Y, 0) -
6750childViewport.Height = Math.Max(childViewport.Height - stackPixelSizeInViewport.Height, 0.0);
6755childViewport.Height = Math.Max(childViewport.Height - stackPixelSizeInViewport.Height, 0.0);
6763Math.Max(parentCacheSize.CacheBeforeViewport - stackLogicalSizeInCacheBeforeViewport.Height, 0.0),
6766Math.Max(parentCacheSize.CacheAfterViewport - stackLogicalSizeInCacheAfterViewport.Height, 0.0));
6774Math.Max(parentCacheSize.CacheBeforeViewport - stackPixelSizeInCacheBeforeViewport.Height, 0.0),
6777Math.Max(parentCacheSize.CacheAfterViewport - stackPixelSizeInCacheAfterViewport.Height, 0.0));
6884childLogicalSize.Width = Math.Max(itemDesiredSizes.LogicalSize.Width, logicalHeaderSize.Width);
6889childLogicalSize.Height = Math.Max(itemDesiredSizes.LogicalSize.Height, logicalHeaderSize.Height);
7088Size frontPixelSize = isHorizontal ? new Size(Math.Max(inset.Left,0), childDesiredSize.Height)
7089: new Size(childDesiredSize.Width, Math.Max(inset.Top, 0));
7102Size backPixelSize = isHorizontal ? new Size(Math.Max(inset.Right,0), childDesiredSize.Height)
7103: new Size(childDesiredSize.Width, Math.Max(inset.Bottom,0));
7116adjustedChildViewport.Width = Math.Max(0, adjustedChildViewport.Width - childPixelSizeInViewport.Width);
7122adjustedChildViewport.Height = Math.Max(0, adjustedChildViewport.Height - childPixelSizeInViewport.Height);
7207pixelSizeBeforeViewport = DoubleUtil.LessThan(childViewport.X, childPixelSize.Width) ? Math.Max(childViewport.X, 0.0) : childPixelSize.Width;
7208pixelSizeInViewport = Math.Min(childViewport.Width, childPixelSize.Width - pixelSizeBeforeViewport);
7209pixelSizeAfterViewport = 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
7254logicalSizeBeforeViewport = Math.Floor(childLogicalSize.Width * pixelSizeBeforeViewport / childPixelSize.Width);
7255logicalSizeAfterViewport = Math.Floor(childLogicalSize.Width * pixelSizeAfterViewport / childPixelSize.Width);
7263double childPixelHeightInViewport = Math.Min(childViewport.Height, childPixelSize.Height - Math.Max(childViewport.Y, 0.0));
7266childPixelSizeInViewport.Height = Math.Max(childPixelSizeInViewport.Height, childPixelHeightInViewport);
7268childPixelSizeInCacheBeforeViewport.Height = Math.Max(childPixelSizeInCacheBeforeViewport.Height, childPixelHeightInViewport);
7270childPixelSizeInCacheAfterViewport.Height = Math.Max(childPixelSizeInCacheAfterViewport.Height, childPixelHeightInViewport);
7273childLogicalSizeInViewport.Height = Math.Max(childLogicalSizeInViewport.Height, childLogicalSize.Height);
7275childLogicalSizeInCacheBeforeViewport.Height = Math.Max(childLogicalSizeInCacheBeforeViewport.Height, childLogicalSize.Height);
7277childLogicalSizeInCacheAfterViewport.Height = Math.Max(childLogicalSizeInCacheAfterViewport.Height, childLogicalSize.Height);
7299pixelSizeBeforeViewport = DoubleUtil.LessThan(childViewport.Y, childPixelSize.Height) ? Math.Max(childViewport.Y, 0.0) : childPixelSize.Height;
7300pixelSizeInViewport = Math.Min(childViewport.Height, childPixelSize.Height - pixelSizeBeforeViewport);
7301pixelSizeAfterViewport = 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
7346logicalSizeBeforeViewport = Math.Floor(childLogicalSize.Height * pixelSizeBeforeViewport / childPixelSize.Height);
7347logicalSizeAfterViewport = Math.Floor(childLogicalSize.Height * pixelSizeAfterViewport / childPixelSize.Height);
7355double childPixelWidthInViewport = Math.Min(childViewport.Width, childPixelSize.Width - Math.Max(childViewport.X, 0.0));
7358childPixelSizeInViewport.Width = Math.Max(childPixelSizeInViewport.Width, childPixelWidthInViewport);
7360childPixelSizeInCacheBeforeViewport.Width = Math.Max(childPixelSizeInCacheBeforeViewport.Width, childPixelWidthInViewport);
7362childPixelSizeInCacheAfterViewport.Width = Math.Max(childPixelSizeInCacheAfterViewport.Width, childPixelWidthInViewport);
7365childLogicalSizeInViewport.Width = Math.Max(childLogicalSizeInViewport.Width, childLogicalSize.Width);
7367childLogicalSizeInCacheBeforeViewport.Width = Math.Max(childLogicalSizeInCacheBeforeViewport.Width, childLogicalSize.Width);
7369childLogicalSizeInCacheAfterViewport.Width = Math.Max(childLogicalSizeInCacheAfterViewport.Width, childLogicalSize.Width);
7412sz1.Height = Math.Max(sz1.Height, sz2.Height);
7417sz1.Width = Math.Max(sz1.Width, sz2.Width);
7467childSize = new Size(Math.Max(headerDesiredSizes.PixelSize.Width, itemDesiredSizes.PixelSize.Width),
7472childSize = new Size(Math.Max(headerDesiredSizes.LogicalSize.Width, itemDesiredSizes.LogicalSize.Width),
7556uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes);
7640Math.Max(1, itemDesiredSizes.LogicalSize.Height))
7641: new Size(Math.Max(1, itemDesiredSizes.LogicalSize.Width),
7782Math.Max(uniformOrAverageContainerPixelSize, dpiScale), // don't round down to 0
7792uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes);
8455rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8480previousChildSize.Width = Math.Max(previousChildSize.Width, pixelHeaderSize.Width);
8487rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
8512previousChildSize.Height = Math.Max(previousChildSize.Height, pixelHeaderSize.Height);
8542rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8548rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
8586rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8639rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
9516return Math.Max(0, _firstItemInExtendedViewportIndex);
9524return Math.Min(ItemCount, _firstItemInExtendedViewportIndex + _actualItemsInExtendedViewportCount);
9642_scrollData._maxDesiredSize.Height = Math.Max(_scrollData._maxDesiredSize.Height, stackPixelSize.Height);
9669_scrollData._maxDesiredSize.Width = Math.Max(_scrollData._maxDesiredSize.Width, stackPixelSize.Width);
9695Math.Min(stackPixelSize.Width, constraint.Width) : constraint.Width;
9700Math.Min(stackPixelSize.Height, constraint.Height) : constraint.Height;
9710Debug.Assert(DoubleUtil.AreClose(viewportSize.Width - Math.Floor(viewportSize.Width), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
9711Debug.Assert(DoubleUtil.AreClose(extentSize.Width - Math.Floor(extentSize.Width), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
9715Debug.Assert(DoubleUtil.AreClose(viewportSize.Height - Math.Floor(viewportSize.Height), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
9716Debug.Assert(DoubleUtil.AreClose(extentSize.Height - Math.Floor(extentSize.Height), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
9966double proposedViewportSize = Math.Floor(viewport.Width / approxSizeOfLogicalUnit);
10059if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.X)/extentSize.Width, Math.Floor(_scrollData._offset.X)/_scrollData._extent.Width))
10062viewportOffset.X = Math.Floor((extentSize.Width * Math.Floor(_scrollData._offset.X)) / _scrollData._extent.Width);
10183double proposedViewportSize = Math.Floor(viewport.Height / approxSizeOfLogicalUnit);
10276if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.Y)/extentSize.Height, Math.Floor(_scrollData._offset.Y)/_scrollData._extent.Height))
10279viewportOffset.Y = Math.Floor((extentSize.Height * Math.Floor(_scrollData._offset.Y)) / _scrollData._extent.Height);
10491_scrollData._maxDesiredSize.Height = Math.Max(_scrollData._maxDesiredSize.Height, stackPixelSize.Height);
10518_scrollData._maxDesiredSize.Width = Math.Max(_scrollData._maxDesiredSize.Width, stackPixelSize.Width);
10544Math.Min(stackPixelSize.Width, constraint.Width) : constraint.Width;
10549Math.Min(stackPixelSize.Height, constraint.Height) : constraint.Height;
10559Debug.Assert(DoubleUtil.AreClose(viewportSize.Width - Math.Floor(viewportSize.Width), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
10560Debug.Assert(DoubleUtil.AreClose(extentSize.Width - Math.Floor(extentSize.Width), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
10564Debug.Assert(DoubleUtil.AreClose(viewportSize.Height - Math.Floor(viewportSize.Height), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
10565Debug.Assert(DoubleUtil.AreClose(extentSize.Height - Math.Floor(extentSize.Height), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
10645lastPageSafeOffset = lastPageSafeOffset.HasValue ? Math.Min(computedViewportOffset.X, (double)lastPageSafeOffset) : computedViewportOffset.X;
10648double proposedViewportSize = Math.Floor(viewport.Width / approxSizeOfLogicalUnit);
10730if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.X)/extentSize.Width, Math.Floor(_scrollData._offset.X)/_scrollData._extent.Width))
10733viewportOffset.X = Math.Floor((extentSize.Width * Math.Floor(_scrollData._offset.X)) / _scrollData._extent.Width);
10776lastPageSafeOffset = lastPageSafeOffset.HasValue ? Math.Min(computedViewportOffset.Y, (double)lastPageSafeOffset) : computedViewportOffset.Y;
10779double proposedViewportSize = Math.Floor(viewport.Height / approxSizeOfLogicalUnit);
10861if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.Y)/extentSize.Height, Math.Floor(_scrollData._offset.Y)/_scrollData._extent.Height))
10864viewportOffset.Y = Math.Floor((extentSize.Height * Math.Floor(_scrollData._offset.Y)) / _scrollData._extent.Height);
11162double visibleStart = Math.Max(start, 0);
11163double visibleEnd = Math.Max(Math.Min(end, viewportSize), visibleStart);
11208else if (childIndex > firstChildInView + Math.Max(viewportSize - 1, 0))
11254maxChildLength = Math.Max(maxChildLength, childSize.Height);
11258maxChildLength = Math.Max(maxChildLength, childSize.Width);
11850else if (DoubleUtil.GreaterThan(Math.Abs(newOffset - oldOffset), _viewport.Width))
11866else if (DoubleUtil.GreaterThan(Math.Abs(newOffset - oldOffset), _viewport.Height))
System\Windows\Documents\TextStore.cs (12)
985milPointTopLeft = new Point(Math.Min(rectPrev.Left, rectCur.Left), Math.Min(rectPrev.Top, rectCur.Top));
986milPointBottomRight = new Point(Math.Max(rectPrev.Left, rectCur.Left), Math.Max(rectPrev.Bottom, rectCur.Bottom));
2443runCount = TextPointerBase.GetTextWithLimit(navigator, LogicalDirection.Forward, text, charsCopied, Math.Min(cchReq, text.Length - charsCopied), limit);
2846double radSin = Math.Asin(tf.M12 / Math.Sqrt((tf.M11 * tf.M11) + (tf.M12 * tf.M12)));
2847double radCos = Math.Acos(tf.M11 / Math.Sqrt((tf.M11 * tf.M11) + (tf.M12 * tf.M12)));
2849double angleCos = Math.Round((radCos * 180) / Math.PI, 0);
3809int extraCharsAllowed = Math.Max(0, this.TextEditor.MaxLength - currentLength);
System\Windows\FrameworkElement.cs (59)
4045maxHeight = Math.Max(Math.Min(height, maxHeight), minHeight);
4048minHeight = Math.Max(Math.Min(maxHeight, height), minHeight);
4055maxWidth = Math.Max(Math.Min(width, maxWidth), minWidth);
4058minWidth = Math.Max(Math.Min(maxWidth, width), minWidth);
4160Double yCoverD = (yConstrInfinite ? Double.PositiveInfinity : Math.Abs(yConstr/d));
4161Double xCoverA = (xConstrInfinite ? Double.PositiveInfinity : Math.Abs(xConstr/a));
4181h = Math.Min(0.5*Math.Abs(xConstr/c), yCoverD);
4192w = Math.Min( 0.5*Math.Abs(yConstr/b), xCoverA);
4200Double yCoverB = Math.Abs(yConstr/b);
4201Double xCoverC = Math.Abs(xConstr/c);
4221h = Math.Min(0.5*Math.Abs(yConstr/d), xCoverC);
4232w = Math.Min( 0.5*Math.Abs(xConstr/a), yCoverB);
4238Double xCoverA = Math.Abs(xConstr / a); // w-intercept of x-constraint line.
4239Double xCoverC = Math.Abs(xConstr / c); // h-intercept of x-constraint line.
4241Double yCoverB = Math.Abs(yConstr / b); // w-intercept of y-constraint line.
4242Double yCoverD = Math.Abs(yConstr / d); // h-intercept of y-constraint line.
4249w = Math.Min(yCoverB, xCoverA) * 0.5;
4250h = Math.Min(xCoverC, yCoverD) * 0.5;
4267Double expandFactor = Math.Min(xConstr / childBoundsTr.Width,
4326Math.Max(availableSize.Width - marginWidth, 0),
4327Math.Max(availableSize.Height - marginHeight, 0));
4375frameworkAvailableSize.Width = Math.Max(mm.minWidth, Math.Min(frameworkAvailableSize.Width, mm.maxWidth));
4376frameworkAvailableSize.Height = Math.Max(mm.minHeight, Math.Min(frameworkAvailableSize.Height, mm.maxHeight));
4389Math.Max(desiredSize.Width, mm.minWidth),
4390Math.Max(desiredSize.Height, mm.minHeight));
4454ltd?.TransformedUnroundedDS = new Size(Math.Max(0, clippedDesiredWidth), Math.Max(0, clippedDesiredHeight));
4500return new Size(Math.Max(0, clippedDesiredWidth), Math.Max(0, clippedDesiredHeight));
4562arrangeSize.Width = Math.Max(0, arrangeSize.Width - marginWidth);
4563arrangeSize.Height = Math.Max(0, arrangeSize.Height - marginHeight);
4572transformedUnroundedDS.Width = Math.Max(0, transformedUnroundedDS.Width - marginWidth);
4573transformedUnroundedDS.Height = Math.Max(0, transformedUnroundedDS.Height- marginHeight);
4582unclippedDesiredSize = new Size(Math.Max(0, this.DesiredSize.Width - marginWidth),
4583Math.Max(0, this.DesiredSize.Height - marginHeight));
4588unclippedDesiredSize.Width = Math.Max(transformedUnroundedDS.Width, unclippedDesiredSize.Width);
4589unclippedDesiredSize.Height = Math.Max(transformedUnroundedDS.Height, unclippedDesiredSize.Height);
4676double effectiveMaxWidth = Math.Max(unclippedDesiredSize.Width, mm.maxWidth);
4683double effectiveMaxHeight = Math.Max(unclippedDesiredSize.Height, mm.maxHeight);
4714Size clippedInkSize = new Size(Math.Min(innerInkSize.Width, mm.maxWidth),
4715Math.Min(innerInkSize.Height, mm.maxHeight));
4747Size clientSize = new Size(Math.Max(0, finalRect.Width - marginWidth),
4748Math.Max(0, finalRect.Height - marginHeight));
4899inkSize.Width = Math.Min(inkSize.Width, mm.maxWidth);
4900inkSize.Height = Math.Min(inkSize.Height, mm.maxHeight);
4917Size clippingSize = new Size(Math.Max(0, layoutSlotSize.Width - marginWidth),
4918Math.Max(0, layoutSlotSize.Height - marginHeight));
5236inkSize.Width = Math.Min(inkSize.Width, mm.maxWidth);
5237inkSize.Height = Math.Min(inkSize.Height, mm.maxHeight);
System\Windows\Shell\WindowChromeWorker.cs (23)
804double shortestDimension = Math.Min(windowSize.Width, windowSize.Height);
807topLeftRadius = Math.Min(topLeftRadius, shortestDimension / 2);
823topRightRadius = Math.Min(topRightRadius, shortestDimension / 2);
831bottomLeftRadius = Math.Min(bottomLeftRadius, shortestDimension / 2);
839bottomRightRadius = Math.Min(bottomRightRadius, shortestDimension / 2);
866(int)Math.Floor(region.Left),
867(int)Math.Floor(region.Top),
868(int)Math.Ceiling(region.Right),
869(int)Math.Ceiling(region.Bottom));
874(int)Math.Floor(region.Left),
875(int)Math.Floor(region.Top),
876(int)Math.Ceiling(region.Right) + 1,
877(int)Math.Ceiling(region.Bottom) + 1,
878(int)Math.Ceiling(radius),
879(int)Math.Ceiling(radius));
967deviceGlassThickness.Top = Math.Max(0, deviceGlassThickness.Top);
972deviceGlassThickness.Left = Math.Max(0, deviceGlassThickness.Left);
977deviceGlassThickness.Bottom = Math.Max(0, deviceGlassThickness.Bottom);
982deviceGlassThickness.Right = Math.Max(0, deviceGlassThickness.Right);
989cxLeftWidth = (int)Math.Ceiling(deviceGlassThickness.Left),
990cxRightWidth = (int)Math.Ceiling(deviceGlassThickness.Right),
991cyTopHeight = (int)Math.Ceiling(deviceGlassThickness.Top),
992cyBottomHeight = (int)Math.Ceiling(deviceGlassThickness.Bottom),
System\Windows\Window.cs (30)
1807frameworkAvailableSize.Width = Math.Max(mm.minWidth, Math.Min(frameworkAvailableSize.Width, mm.maxWidth));
1808frameworkAvailableSize.Height = Math.Max(mm.minHeight, Math.Min(frameworkAvailableSize.Height, mm.maxHeight));
1815Math.Max(desiredSize.Width, mm.minWidth),
1816Math.Max(desiredSize.Height, mm.minHeight));
1837arrangeBounds.Width = Math.Max(mm.minWidth, Math.Min(arrangeBounds.Width, mm.maxWidth));
1838arrangeBounds.Height = Math.Max(mm.minHeight, Math.Min(arrangeBounds.Height, mm.maxHeight));
1873Width = Math.Max(0.0, arrangeBounds.Width - frameSize.Width),
1874Height = Math.Max(0.0, arrangeBounds.Height - frameSize.Height)
3406Width = ((constraint.Width == Double.PositiveInfinity) ? Double.PositiveInfinity : Math.Max(0.0, (constraint.Width - frameSize.Width))),
3407Height = ((constraint.Height == Double.PositiveInfinity) ? Double.PositiveInfinity : Math.Max(0.0, (constraint.Height - frameSize.Height)))
3452maxWidthDeviceUnits = Math.Max(_trackMaxWidthDeviceUnits, _windowMaxWidthDeviceUnits);
3453maxHeightDeviceUnits = Math.Max(_trackMaxHeightDeviceUnits, _windowMaxHeightDeviceUnits);
3462mm.minWidth = Math.Max(this.MinWidth, minSizeLogicalUnits.X);
3467mm.maxWidth = Math.Min(MinWidth, maxSizeLogicalUnits.X);
3473mm.maxWidth = Math.Min(MaxWidth, maxSizeLogicalUnits.X);
3484mm.minHeight = Math.Max(this.MinHeight, minSizeLogicalUnits.Y);
3489mm.maxHeight = Math.Min(this.MinHeight, maxSizeLogicalUnits.Y);
3495mm.maxHeight = Math.Min(MaxHeight, maxSizeLogicalUnits.Y);
3846leftDeviceUnits = Math.Min(leftDeviceUnits, workAreaRectDeviceUnits.right - currentSizeDeviceUnits.Width);
3847leftDeviceUnits = Math.Max(leftDeviceUnits, workAreaRectDeviceUnits.left);
3848topDeviceUnits = Math.Min(topDeviceUnits, workAreaRectDeviceUnits.bottom - currentSizeDeviceUnits.Height);
3849topDeviceUnits = Math.Max(topDeviceUnits, workAreaRectDeviceUnits.top);
4705_windowMaxWidthDeviceUnits = Math.Max(_windowMaxWidthDeviceUnits, windowSize.X);
4706_windowMaxHeightDeviceUnits = Math.Max(_windowMaxHeightDeviceUnits, windowSize.Y);
7591return 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)
235float min = Math.Min(rgbColor.Red, Math.Min(rgbColor.Green, rgbColor.Blue));
236float max = Math.Max(rgbColor.Red, Math.Max(rgbColor.Green, rgbColor.Blue));
268saturation = Math.Max(0.0f, Math.Min(saturation, 1.0f));
323float hue = (float)((hlsColor.Hue - Math.Floor(hlsColor.Hue)) * 6);
601Math.Max(0.0, rt.Width - thick.Left - thick.Right),
602Math.Max(0.0, rt.Height - thick.Top - thick.Bottom));
690desired = new Size(Math.Min(borderSize.Width, availableSize.Width), Math.Min(borderSize.Height, availableSize.Height));
PresentationFramework.Luna (27)
PresentationFramework.Royale (26)
PresentationUI (6)
Publishers.AppHost (2)
ReachFramework (93)
AlphaFlattener\BrushProxy.cs (32)
512rb.RadiusX = Math.Abs(rb.RadiusX * bounds.Width);
513rb.RadiusY = Math.Abs(rb.RadiusY * bounds.Height);
1910double length = Math.Sqrt(dx * dx + dy * dy);
1924stopDistance = Math.Max(b.RadiusX, b.RadiusY) * (second.Offset - first.Offset);
1942int stopCount = (int)Math.Ceiling(-6.297427 + 4.591693 * Math.Log(stopDistance));
2281double height = Math.Abs(start.Y - end.Y) * multiplier;
2290double width = Math.Abs(start.X - end.X) * multiplier;
2572if (Utility.AreClose(new Vector(Math.Abs(rbA.RadiusX), Math.Abs(rbA.RadiusY)) * rbA.Transform.Value,
2573new Vector(Math.Abs(rbB.RadiusX), Math.Abs(rbB.RadiusY)) * rbB.Transform.Value))
3739min = Math.Min(min, offset);
3740max = Math.Max(max, offset);
3866return Math.Sqrt(sum);
3895return (int)Math.Ceiling(Math.Max(5, step)); // At least five. Radials look bad with less steps.
3944if (Math.Abs(di) < Double.Epsilon)
4038double right = Math.Ceiling(_bounds.Right / _bandDelta);
4039double left = Math.Floor(_bounds.Left / _bandDelta);
4138double rotateAngle = Math.Atan2(-gradientVector.Y, gradientVector.X) * 180.0 / Math.PI;
4183_rx = Math.Abs(b.RadiusX);
4184_ry = Math.Abs(b.RadiusY);
4265double right = Math.Ceiling(maxt * _bandSteps);
4266double left = Math.Floor(mint * _bandSteps);
4383double root = Math.Sqrt(B4AC);
4392maxt = Math.Max(maxt, one);
4393mint = Math.Min(mint, one);
4400maxt = Math.Max(maxt, two);
4401mint = Math.Min(mint, two);
4426double len = Math.Sqrt(dx * dx + dy * dy);
Serialization\VisualSerializer.cs (10)
467scalex = Math.Min(dstwidth / srcwidth, dstheight / srcheight);
472scalex = Math.Max(dstwidth / srcwidth, dstheight / srcheight);
749WriteAttr("RadiusX", Math.Abs(rb.RadiusX * bounds.Width));
750WriteAttr("RadiusY", Math.Abs(rb.RadiusY * bounds.Height));
916WriteAttr("StrokeThickness", Math.Abs(pen.Thickness));
926WriteAttr("StrokeMiterLimit", Math.Max(1.0, pen.MiterLimit));
948dashes.Add(Math.Abs(d));
2258WriteAttr("Opacity", Math.Min(Math.Max( opacity, 0.0),1.0));
2321SetCoordinateFormat(Math.Min(Utility.GetScaleX(mat), Utility.GetScaleY(mat)));
Roslyn.Diagnostics.Analyzers (107)
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
496var currentSegmentLength = Math.Min(remainingInSegment, _length);
505var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
600var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
648var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
738_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
745_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
787_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
794_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (8)
574LineColumnRule.IndentationOperations.Absolute => Math.Max(0, rule.Indentation),
576LineColumnRule.IndentationOperations.Given => (trivia2.RawKind == 0) ? this.Spaces : Math.Max(0, _indentation),
577LineColumnRule.IndentationOperations.Follow => Math.Max(0, lineColumnBeforeTrivia1.Column),
586LineColumnRule.SpaceOperations.Preserve => Math.Max(rule.Spaces, existingWhitespaceBetween.Spaces),
587LineColumnRule.SpaceOperations.Force => Math.Max(rule.Spaces, 0),
594var adjustedRuleLines = Math.Max(0, rule.Lines - GetTrailingLinesAtEndOfTrivia1(lineColumnAfterTrivia1));
596return (rule.LineOperation == LineColumnRule.LineOperations.Preserve) ? Math.Max(adjustedRuleLines, existingWhitespaceBetween.Lines) : adjustedRuleLines;
745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
Roslyn.Diagnostics.CSharp.Analyzers (7)
ScenarioTests.Common.Tests (1)
Shared (3)
Stress.ApiService (1)
System.Collections (5)
System.Collections.Concurrent (4)
System.Collections.Immutable (12)
System.CommandLine (3)
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);
1258ResInteger = Math.Max(x._bPrec - MyScale, y._bPrec - OpScale);
1262ResScale = Math.Max(MyScale, OpScale);
1268ResPrec = Math.Min(MaxPrecision, ResPrec);
1472ResScale = Math.Min((ResPrec - ResInteger), ResScale);
1474ResScale = Math.Max(ResScale, Math.Min(ActualScale, s_cNumeDivScaleMin));
1695ResScale = Math.Max(x._bScale + y._bPrec + 1, s_cNumeDivScaleMin);
1698MinScale = Math.Min(ResScale, s_cNumeDivScaleMin);
1700ResInteger = Math.Min(ResInteger, s_NUMERIC_MAX_PRECISION);
1707ResScale = Math.Min((ResPrec - ResInteger), ResScale);
1708ResScale = Math.Max(ResScale, MinScale);
2304bNewPrec = (byte)(Math.Min(s_NUMERIC_MAX_PRECISION, Math.Max(1, lAdjust + _bPrec)));
3175lPosition = Math.Min(s_NUMERIC_MAX_PRECISION, lPosition);
3182lPosition = Math.Max(-s_NUMERIC_MAX_PRECISION, lPosition);
3193int lAdjust = Math.Abs(lPosition - n._bScale); // Precision adjustment
3232lAdjust = Math.Abs(lPosition - n._bScale);
3268n = new SqlDecimal(Math.Pow(dBaseNum, exp));
System.Data.Odbc (28)
System\Data\Odbc\OdbcDataReader.cs (12)
571int nValues = Math.Min(values.Length, FieldCount);
972string strdata = buffer.PtrToStringUni(0, Math.Min(lengthOrIndicator, cbMaxData) / 2);
1013cbActual = Math.Min(lengthOrIndicator, cbMaxData);
1185int lengthOfCopy = Math.Min(lengthFromDataIndex, length);
1188lengthOfCopy = Math.Min(lengthOfCopy, buffer.Length - bufferIndex);
1308length = Math.Min(length, buffer.Length - bufferIndex);
1370cbReadMax = (int)Math.Min(cbLength, internalNativeBuffer.Length - 4);
1379cbReadMax = (int)Math.Min(cbLength, internalNativeBuffer.Length - 2);
1476Buffer.ReadBytes(0, rgBytes, cbOffset, Math.Min(cbActual, cbBufferLen));
1489buffer.ReadBytes(0, rgBytes, cbOffset, Math.Min(cbActual, cbBufferLen));
2277row[columnSize] = unchecked((int)Math.Min(Math.Max(int.MinValue, _metadata![i].size.ToInt64()), int.MaxValue));
System.Data.OleDb (22)
ColumnBinding.cs (11)
188return Math.Max(length, 0);
251_valueBindingOffset = Math.Max(offset, 0);
256_valueBindingSize = Math.Max(size, 0);
694LengthValue(((0 < ValueBindingSize) ? Math.Min(ValueBindingSize, length) : length));
741LengthValue(((0 < ValueBindingSize) ? Math.Min(ValueBindingSize, length) : length) * 2); /* charcount->bytecount*/
760LengthValue(((0 < ValueBindingSize) ? Math.Min(ValueBindingSize, length) : length) * 2); /* charcount->bytecount*/
777int byteCount = Math.Min(LengthValue(), ColumnBindingMaxLen);
786int bytecount = ((ValueBindingOffset < value.Length) ? Math.Min(value.Length - ValueBindingOffset, ColumnBindingMaxLen) : 0);
1200int byteCount = Math.Min(LengthValue(), ColumnBindingMaxLen - 2);
1208int charCount = ((ValueBindingOffset < value.Length) ? Math.Min(value.Length - ValueBindingOffset, (ColumnBindingMaxLen - 2) / 2) : 0);
1223int charCount = ((ValueBindingOffset < value.Length) ? Math.Min(value.Length - ValueBindingOffset, (ColumnBindingMaxLen - 2) / 2) : 0);
System.Diagnostics.DiagnosticSource (14)
System.Diagnostics.EventLog (1)
System.Diagnostics.Process (9)
System.Diagnostics.TextWriterTraceListener (1)
System.DirectoryServices.Protocols (1)
System.Drawing.Common (22)
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.Nrbf (3)
System.Formats.Tar (26)
System.IO.Compression (17)
System.IO.FileSystem.AccessControl (2)
System.IO.FileSystem.Watcher (2)
System.IO.Hashing (4)
System.IO.Pipelines (8)
System.IO.Ports (5)
System.Linq (20)
System.Linq.AsyncEnumerable (5)
System.Linq.Expressions (8)
System.Linq.Parallel (5)
System.Management (1)
System.Memory (4)
System.Memory.Data (1)
System.Net.Http (55)
System.Net.Http.WinHttpHandler (2)
System.Net.HttpListener (10)
System.Net.Mail (8)
System.Net.NameResolution (1)
System.Net.NetworkInformation (1)
System.Net.Ping (4)
System.Net.Primitives (7)
System.Net.Quic (7)
System.Net.Requests (4)
System.Net.Security (8)
System.Net.ServerSentEvents (5)
System.Net.Sockets (9)
System.Net.WebClient (6)
System.Net.WebSockets (8)
System.Numerics.Tensors (18)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IAggregationOperator.cs (6)
264(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector128<T>.Count);
446(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector256<T>.Count);
628(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector512<T>.Count);
1403(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector128<T>.Count);
1610(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector256<T>.Count);
1817(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector512<T>.Count);
System.Private.CoreLib (568)
src\runtime\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);
526public static byte Clamp(byte value, byte min, byte max) => Math.Clamp(value, min, max);
532public static byte Max(byte x, byte y) => Math.Max(x, y);
538public static byte Min(byte x, byte y) => Math.Min(x, y);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Collections\BitArray.cs (7)
120(uint index, uint extraBits) = Math.DivRem((uint)_bitLength, BitsPerInt32);
225(uint byteIndex, uint bitOffset) = Math.DivRem(i, BitsPerByte);
309(uint byteIndex, uint bitOffset) = Math.DivRem((uint)index, BitsPerByte);
328(uint byteIndex, uint bitOffset) = Math.DivRem((uint)index, BitsPerByte);
532(int fromIndex, int shiftCount) = Math.DivRem(count, 32);
595(lengthToClear, int shiftCount) = Math.DivRem(count, BitsPerInt32);
829(uint byteIndex, uint extraBits) = Math.DivRem(i, BitsPerByte);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (52)
185ulong high = Math.BigMul(a, b, out ulong low);
244(div, rem) = Math.DivRem(tmp, den);
249(div, rem) = Math.DivRem(tmp, den);
257(bufNum.Low64, rem) = Math.DivRem(tmp, den);
410(ulong quo64, bufNum.Low64) = Math.DivRem(num, den);
452ulong prod = Math.BigMul(quo, (uint)den); // quo * lo divisor
497uint prod2 = (uint)Math.BigMul(bufDen.Low64, quo, out prod1);
553ulong hi64 = Math.BigMul(bufNum.Low64, power, out ulong low64);
555hi64 = Math.BigMul(bufNum.U2, power) + hi64;
580ulong hi64 = Math.BigMul(bufNum.Low64, power, out ulong low64);
582bufNum.High64 = Math.BigMul(bufNum.U2, power) + (nuint)hi64;
596bufNum.U2 = (uint)Math.BigMul(bufNum.Low64, power, out ulong low64);
772(quotient, remainder) = Math.DivRem(high, power);
1027low64 = Math.BigMul((uint)low64, UInt32Powers10[scale]);
1031low64 = Math.BigMul((uint)low64, TenToPowerNine);
1040high = (uint)Math.BigMul(low64, power, out low64);
1053tmp64 = Math.BigMul(low64, power, out low64);
1054tmp64 += Math.BigMul(high, power);
1086tmp64 += Math.BigMul(rgulNum[cur], power);
1289ulong high = Math.BigMul(pdecIn.Low64, pwr, out ulong low);
1373ulong tmp = Math.BigMul(low64, power, out low64);
1374tmp += Math.BigMul(high, power);
1417ulong low64 = Math.BigMul(d1.Low, d2.Low);
1430(low64, ulong remainder) = Math.DivRem(low64, power);
1448tmp = Math.BigMul(d1.Low, d2.Low64, out ulong low);
1453tmp += Math.BigMul(d1.Low, d2.High);
1468tmp = Math.BigMul(d1.Low64, d2.Low, out ulong low);
1473tmp += Math.BigMul(d2.Low, d1.High);
1503ulong mid64 = Math.BigMul(d1.Low64, d2.Low64, out tmp);
1509ulong hi64 = Math.BigMul(d1.High, d2.High);
1512hi64 += Math.BigMul(d1.Low64, d2.High, out tmp);
1518hi64 += Math.BigMul(d2.Low64, d1.High, out tmp);
1627mant = (uint)(int)Math.Round(dbl);
1646result.Low64 = Math.BigMul(mant, UInt32Powers10[power]);
1654ulong low64 = Math.BigMul(mant, UInt32Powers10[power - 18]);
1659ulong low64 = Math.BigMul(mant, UInt32Powers10[power - 9]);
1660ulong hi64 = Math.BigMul(TenToPowerNine, low64, out low64);
1682(uint div, uint rem) = Math.DivRem(mant, 10000);
1693(uint div, uint rem) = Math.DivRem(mant, 100);
1704(uint div, uint rem) = Math.DivRem(mant, 10);
1787mant = (ulong)(long)Math.Round(dbl);
1807ulong low64 = Math.BigMul((uint)mant, pow10);
1808ulong hi64 = Math.BigMul((uint)(mant >> 32), pow10);
1968curScale = Math.Min(9, -scale);
2012ulong num = Math.BigMul(remainder, power);
2059curScale = Math.Min(9, -scale);
2121curScale = Math.Min(9, -scale);
2241uint hi32 = (uint)Math.BigMul(d2.Low64, power, out ulong low64);
2323ulong tmp64 = Math.BigMul(b.Buf24.U0, power);
2328tmp64 += Math.BigMul(buf[i], power);
2412(d.uhi, remainder) = Math.DivRem(n, divisor);
2453(d.uhi, remainder) = Math.DivRem(n, power);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Double.cs (58)
67public const double E = Math.E;
71public const double Pi = Math.PI;
75public const double Tau = Math.Tau;
581public static double Log2(double value) => Math.Log2(value);
635public static double Exp(double x) => Math.Exp(x);
638public static double ExpM1(double x) => Math.Exp(x) - 1;
641public static double Exp2(double x) => Math.Pow(2, x);
644public static double Exp2M1(double x) => Math.Pow(2, x) - 1;
647public static double Exp10(double x) => Math.Pow(10, x);
650public static double Exp10M1(double x) => Math.Pow(10, x) - 1;
658public static double Ceiling(double x) => Math.Ceiling(x);
681public static double Floor(double x) => Math.Floor(x);
685public static double Round(double x) => Math.Round(x);
688public static double Round(double x, int digits) => Math.Round(x, digits);
691public static double Round(double x, MidpointRounding mode) => Math.Round(x, mode);
694public static double Round(double x, int digits, MidpointRounding mode) => Math.Round(x, digits, mode);
698public static double Truncate(double x) => Math.Truncate(x);
801static double IFloatingPointConstants<double>.E => Math.E;
830public static double Atan2(double y, double x) => Math.Atan2(y, x);
836public static double BitDecrement(double x) => Math.BitDecrement(x);
839public static double BitIncrement(double x) => Math.BitIncrement(x);
843public static double FusedMultiplyAdd(double left, double right, double addend) => Math.FusedMultiplyAdd(left, right, addend);
846public static double Ieee754Remainder(double left, double right) => Math.IEEERemainder(left, right);
849public static int ILogB(double x) => Math.ILogB(x);
856public static double ReciprocalEstimate(double x) => Math.ReciprocalEstimate(x);
860public static double ReciprocalSqrtEstimate(double x) => Math.ReciprocalSqrtEstimate(x);
863public static double ScaleB(double x, int n) => Math.ScaleB(x, n);
874public static double Acosh(double x) => Math.Acosh(x);
878public static double Asinh(double x) => Math.Asinh(x);
882public static double Atanh(double x) => Math.Atanh(x);
886public static double Cosh(double x) => Math.Cosh(x);
890public static double Sinh(double x) => Math.Sinh(x);
894public static double Tanh(double x) => Math.Tanh(x);
909public static double Log(double x) => Math.Log(x);
912public static double Log(double x, double newBase) => Math.Log(x, newBase);
915public static double LogP1(double x) => Math.Log(x + 1);
918public static double Log2P1(double x) => Math.Log2(x + 1);
922public static double Log10(double x) => Math.Log10(x);
925public static double Log10P1(double x) => Math.Log10(x + 1);
967Math.ThrowMinMaxException(min, max);
977Math.ThrowMinMaxException(min, max);
983public static double CopySign(double value, double sign) => Math.CopySign(value, sign);
987public static double Max(double x, double y) => Math.Max(x, y);
1018public 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);
1503public static double Pow(double x, double y) => Math.Pow(x, y);
1511public static double Cbrt(double x) => Math.Cbrt(x);
1795public static double Sqrt(double x) => Math.Sqrt(x);
1827public static double Acos(double x) => Math.Acos(x);
1837public static double Asin(double x) => Math.Asin(x);
1847public static double Atan(double x) => Math.Atan(x);
1857public static double Cos(double x) => Math.Cos(x);
1968public static double Sin(double x) => Math.Sin(x);
1971public static (double Sin, double Cos) SinCos(double x) => Math.SinCos(x);
2176public static double Tan(double x) => Math.Tan(x);
src\runtime\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);
1502(int offsetHours, int offsetMinutes) = Math.DivRem(offsetTotalMinutes, 60);
1706(int offsetHours, offsetMinutes) = Math.DivRem(offsetMinutes, 60);
src\runtime\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);
613public static short Clamp(short value, short min, short max) => Math.Clamp(value, min, max);
629Math.ThrowNegateTwosCompOverflow();
639public static short Max(short x, short y) => Math.Max(x, y);
645public static short Min(short x, short y) => Math.Min(x, y);
651public static int Sign(short value) => Math.Sign(value);
667public static short Abs(short value) => Math.Abs(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int32.cs (8)
54public static long BigMul(int left, int right) => Math.BigMul(left, right);
297public static (int Quotient, int Remainder) DivRem(int left, int right) => Math.DivRem(left, right);
655public static int Clamp(int value, int min, int max) => Math.Clamp(value, min, max);
671Math.ThrowNegateTwosCompOverflow();
681public static int Max(int x, int y) => Math.Max(x, y);
687public static int Min(int x, int y) => Math.Min(x, y);
693public static int Sign(int value) => Math.Sign(value);
709public static int Abs(int value) => Math.Abs(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int64.cs (8)
54public static Int128 BigMul(long left, long right) => Math.BigMul(left, right);
294public static (long Quotient, long Remainder) DivRem(long left, long right) => Math.DivRem(left, right);
652public static long Clamp(long value, long min, long max) => Math.Clamp(value, min, max);
668Math.ThrowNegateTwosCompOverflow();
678public static long Max(long x, long y) => Math.Max(x, y);
684public static long Min(long x, long y) => Math.Min(x, y);
690public static int Sign(long value) => Math.Sign(value);
706public static long Abs(long value) => Math.Abs(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (7)
317public static (nint Quotient, nint Remainder) DivRem(nint left, nint right) => Math.DivRem(left, right);
665public static nint Clamp(nint value, nint min, nint max) => Math.Clamp(value, min, max);
681Math.ThrowNegateTwosCompOverflow();
691public static nint Max(nint x, nint y) => Math.Max(x, y);
697public static nint Min(nint x, nint y) => Math.Min(x, y);
703public static int Sign(nint value) => Math.Sign(value);
719public static nint Abs(nint value) => Math.Abs(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (35)
682int realDigits = Math.Min(precision, defaultHexDigits);
859nMaxDigits = Math.Max(number.DigitsCount, TNumber.MaxRoundTripDigits);
1645int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length;
1671int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length;
1700int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value));
1719int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value));
1756int bufferLength = Math.Max(digits, 32 - (int)uint.LeadingZeroCount(value));
1775int bufferLength = Math.Max(digits, 32 - (int)uint.LeadingZeroCount(value));
1850(value, uint remainder) = Math.DivRem(value, 100);
1892(value, uint remainder) = Math.DivRem(value, 100);
1920(value, remainder) = Math.DivRem(value, 100);
1927(value, remainder) = Math.DivRem(value, 10);
1974int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
2010int bufferLength = Math.Max(digits, countedDigits);
2078int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length;
2104int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length;
2133int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value));
2152int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value));
2205int bufferLength = Math.Max(digits, 64 - (int)ulong.LeadingZeroCount(value));
2224int bufferLength = Math.Max(digits, 64 - (int)ulong.LeadingZeroCount(value));
2321(value, ulong remainder) = Math.DivRem(value, 100);
2360(value, remainder) = Math.DivRem(value, 100);
2367(value, remainder) = Math.DivRem(value, 10);
2402int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
2437int bufferLength = Math.Max(digits, countedDigits);
2506int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length;
2534int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length;
2565int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits(uValue));
2586int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits(uValue));
2615return Int64ToHexChars(buffer, lower, hexBase, Math.Max(digits, 1));
2628int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value));
2649int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value));
2678return UInt64ToBinaryChars(buffer, lower, Math.Max(digits, 1));
2764int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
2778int bufferLength = Math.Max(digits, countedDigits);
src\runtime\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);
592public static sbyte Clamp(sbyte value, sbyte min, sbyte max) => Math.Clamp(value, min, max);
608Math.ThrowNegateTwosCompOverflow();
618public static sbyte Max(sbyte x, sbyte y) => Math.Max(x, y);
624public static sbyte Min(sbyte x, sbyte y) => Math.Min(x, y);
630public static int Sign(sbyte value) => Math.Sign(value);
646public static sbyte Abs(sbyte value) => Math.Abs(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (17)
137capacity = Math.Max(capacity, length);
161capacity = Math.Min(DefaultCapacity, maxCapacity);
209persistedCapacity = Math.Min(Math.Max(DefaultCapacity, persistedString.Length), persistedMaxCapacity);
457int capacityToPreserve = Math.Min(Capacity, Math.Max(Length * 6 / 5, m_ChunkChars.Length));
893int length = Math.Min(m_ChunkChars.Length - m_ChunkLength, count);
957chunkEndIndex = Math.Min(chunkEndIndex, chunk.m_ChunkLength);
2182ReadOnlySpan<char> remainingChunk = chunk.m_ChunkChars.AsSpan(indexInChunk, Math.Min(chunk.m_ChunkLength - indexInChunk, count));
2218Debug.Assert(oldValue.Length > Math.Min(count, chunk.m_ChunkLength - indexInChunk),
2304int curInChunk = Math.Max(startIndexInChunk, 0);
2305int endInChunk = Math.Min(chunk.m_ChunkLength, endIndexInChunk);
2583int lengthToCopy = Math.Min(lengthInChunk, count);
2669int newBlockLength = Math.Max(minBlockCharCount, Math.Min(Length, MaxChunkSize));
2777StringBuilder newChunk = new StringBuilder(Math.Max(count, DefaultCapacity), chunk.m_MaxCapacity, chunk.m_ChunkPrevious);
2781int copyCount1 = Math.Min(count, indexInChunk);
src\runtime\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);
250return Math.Min((uint)delayStepCount * BlockingConfig.DelayStepMs, BlockingConfig.MaxDelayMs);
328blocking_threadsPerDelayStep_procCountFactor = Math.Max(1, blocking_threadsPerDelayStep_procCountFactor);
338MaxDelayMs = Math.Max(1, Math.Min(MaxDelayMs, GateThread.GateActivitiesPeriodMs));
339DelayStepMs = Math.Max(1, Math.Min(DelayStepMs, MaxDelayMs));
src\runtime\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\runtime\src\libraries\System.Private.CoreLib\src\System\TimeSpan.cs (17)
473Int128 totalMicroseconds = Math.BigMul(days, MicrosecondsPerDay)
474+ Math.BigMul(hours, MicrosecondsPerHour)
475+ Math.BigMul(minutes, MicrosecondsPerMinute)
476+ Math.BigMul(seconds, MicrosecondsPerSecond)
477+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
509Int128 totalMicroseconds = Math.BigMul(hours, MicrosecondsPerHour)
510+ Math.BigMul(minutes, MicrosecondsPerMinute)
511+ Math.BigMul(seconds, MicrosecondsPerSecond)
512+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
543Int128 totalMicroseconds = Math.BigMul(minutes, MicrosecondsPerMinute)
544+ Math.BigMul(seconds, MicrosecondsPerSecond)
545+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
575Int128 totalMicroseconds = Math.BigMul(seconds, MicrosecondsPerSecond)
576+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
606Int128 totalMicroseconds = Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
917double ticks = Math.Round(timeSpan.Ticks * factor);
932double ticks = Math.Round(timeSpan.Ticks / divisor);
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt128.cs (11)
843ulong chkHi = Math.BigMul(divHi, q, out ulong chkHiLo);
844ulong chkLoHi = Math.BigMul(divLo, q, out ulong chkLo);
893(highRes, leftUpper) = Math.DivRem(left._upper, divisor);
948Debug.Assert(Math.BigMul(quo, divisor) + rem == (new UInt128(hi, lo)));
984ulong chkHiUL = Math.BigMul(divisor, q, out ulong chkLo);
1382ulong upper = Math.BigMul(left._lower, right._lower, out ulong lower);
1419UInt128 mull = Math.BigMul(al, bl);
1420UInt128 t = Math.BigMul(ah, bl) + mull._upper;
1421UInt128 tl = Math.BigMul(al, bh) + t._lower;
1424return Math.BigMul(ah, bh) + t._upper + tl._upper;
1436Math.ThrowMinMaxException(min, max);
src\runtime\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);
531public static ushort Clamp(ushort value, ushort min, ushort max) => Math.Clamp(value, min, max);
537public static ushort Max(ushort x, ushort y) => Math.Max(x, y);
543public static ushort Min(ushort x, ushort y) => Math.Min(x, y);
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt32.cs (5)
51public static ulong BigMul(uint left, uint right) => Math.BigMul(left, right);
292public static (uint Quotient, uint Remainder) DivRem(uint left, uint right) => Math.DivRem(left, right);
596public static uint Clamp(uint value, uint min, uint max) => Math.Clamp(value, min, max);
602public static uint Max(uint x, uint y) => Math.Max(x, y);
608public static uint Min(uint x, uint y) => Math.Min(x, y);
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt64.cs (5)
51public static UInt128 BigMul(ulong left, ulong right) => Math.BigMul(left, right);
291public static (ulong Quotient, ulong Remainder) DivRem(ulong left, ulong right) => Math.DivRem(left, right);
603public static ulong Clamp(ulong value, ulong min, ulong max) => Math.Clamp(value, min, max);
609public static ulong Max(ulong x, ulong y) => Math.Max(x, y);
615public static ulong Min(ulong x, ulong y) => Math.Min(x, y);
src\runtime\src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (4)
313public static (nuint Quotient, nuint Remainder) DivRem(nuint left, nuint right) => Math.DivRem(left, right);
592public static nuint Clamp(nuint value, nuint min, nuint max) => Math.Clamp(value, min, max);
598public static nuint Max(nuint x, nuint y) => Math.Max(x, y);
604public 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.Reflection.Execution (2)
System.Private.TypeLoader (3)
System.Private.Uri (5)
System.Private.Windows.Core (7)
System.Private.Xml (29)
System.Reflection.Emit (3)
System.Reflection.Metadata (19)
System.Reflection.MetadataLoadContext (1)
System.Runtime (1)
System.Runtime.Caching (17)
System.Runtime.Extensions (1)
System.Runtime.Numerics (103)
System\Number.BigInteger.cs (7)
349ReadOnlySpan<byte> intDigits= number.Digits.Slice(0, Math.Min(number.Scale, number.DigitsCount));
402int totalDigitCount = Math.Min(number.DigitsCount, number.Scale);
425int powersOf1e9BufferLength = PowersOf1e9.GetBufferSize(Math.Max(valueDigits, trailingZeroCount + 1), out int maxIndex);
499int trailingPartialCount = Math.DivRem(trailingZeroCount, PowersOf1e9.MaxPartialDigits, out int remainingTrailingZeroCount);
690int charsIncludeDigits = Math.Max(digits, charsForBits);
848int strDigits = Math.Max(digits, valueDigits);
1436int trailingPartialCount = Math.DivRem(trailingZeroCount, MaxPartialDigits, out int remainingTrailingZeroCount);
System\Numerics\BigInteger.cs (24)
406int wholeLimbCount = Math.DivRem(byteCount, nint.Size, out int unalignedBytes);
902(int q, int r) = Math.DivRem(dividend._sign, divisor._sign);
964return Log(value, Math.E);
986return Math.Log(value._sign, baseValue);
1021return Math.Log(x, baseValue) + (b - 64) / Math.Log(baseValue, 2);
1598msbIndex = Math.Max(0, bytesPerLimb - 1 - (lzc / 8));
1604msbIndex = Math.Max(0, bytesPerLimb - 1 - (lzc / 8));
1753int msb = Math.Max(0, buffer[..^1].LastIndexOfAnyExcept(highLimb));
1833double significand = highBits * Math.Pow(10, exponentLow - exponent);
1836double log10 = Math.Log10(significand);
1840significand /= Math.Pow(10, Math.Floor(log10));
1845significand = Math.Round(significand, 8);
2523? Math.Max(xLen, yLen) + 1
2524: Math.Min(xLen, yLen) + 1;
2536return BitwiseOp<BigIntegerCalculator.BitwiseOrOp>(in left, in right, Math.Max(xLen, yLen) + 1);
2546return BitwiseOp<BigIntegerCalculator.BitwiseXorOp>(in left, in right, Math.Max(xLen, yLen) + 1);
2583(int digitShift, int smallShift) = Math.DivRem(shift, BigIntegerCalculator.BitsPerLimb);
2677(int digitShift, int smallShift) = Math.DivRem(shift, BigIntegerCalculator.BitsPerLimb);
3302Debug.Assert(Math.Abs(rotateLeftAmount) <= 0x80000000);
3373(digitShift32, smallShift32) = Math.DivRem(-(int)rotateLeftAmount, BitsPerUInt32);
3379(digitShift32, smallShift32) = Math.DivRem((int)rotateLeftAmount, BitsPerUInt32);
5225(int digitShift, int smallShift) = Math.DivRem(shiftAmount, BigIntegerCalculator.BitsPerLimb);
System\Numerics\Complex.cs (51)
44private static readonly double s_sqrtRescaleThreshold = double.MaxValue / (Math.Sqrt(2.0) + 1.0);
47private static readonly double s_asinOverflowThreshold = Math.Sqrt(double.MaxValue) / 2.0;
50private static readonly double s_log2 = Math.Log(2.0);
66public double Phase { get { return Math.Atan2(m_imaginary, m_real); } }
70(double sin, double cos) = Math.SinCos(phase);
231if (Math.Abs(d) < Math.Abs(c))
280if (Math.Abs(d) < Math.Abs(c))
314return x * Math.Log(xp1) / (xp1 - 1.0);
318return Math.Log(xp1);
381(double sin, double cos) = Math.SinCos(value.m_real);
382return new Complex(sin * Math.Cosh(value.m_imaginary), cos * Math.Sinh(value.m_imaginary));
398Asin_Internal(Math.Abs(value.Real), Math.Abs(value.Imaginary), out double b, out double bPrime, out double v);
403u = Math.Asin(b);
407u = Math.Atan(bPrime);
418(double sin, double cos) = Math.SinCos(value.m_real);
419return new Complex(cos * Math.Cosh(value.m_imaginary), -sin * Math.Sinh(value.m_imaginary));
430Asin_Internal(Math.Abs(value.Real), Math.Abs(value.Imaginary), out double b, out double bPrime, out double v);
435u = Math.Acos(b);
439u = Math.Atan(1.0 / bPrime);
442if (value.Real < 0.0) u = Math.PI - u;
461(double sin, double cos) = Math.SinCos(x2);
462double cosh = Math.Cosh(y2);
463if (Math.Abs(value.m_imaginary) <= 4.0)
466return new Complex(sin / D, Math.Sinh(y2) / D);
471return new Complex(sin / cosh / D, Math.Tanh(y2) / D);
550v = s_log2 + Math.Log(big) + 0.5 * Log1P(ratio * ratio);
565bPrime = x / Math.Sqrt((a + x) * amx);
573bPrime = x / y / Math.Sqrt((a + x) * t);
590v = Log1P(am1 + y * Math.Sqrt(t * (a + 1.0)));
595v = Log1P(am1 + Math.Sqrt(am1 * (a + 1.0)));
601v = Math.Log(a + Math.Sqrt((a - 1.0) * (a + 1.0)));
614return new Complex(Math.Log(Abs(value)), Math.Atan2(value.m_imaginary, value.m_real));
630double expReal = Math.Exp(value.m_real);
664return new Complex(0.0, Math.Sqrt(-value.m_real));
667return new Complex(Math.Sqrt(value.m_real), 0.0);
699if ((Math.Abs(realCopy) >= s_sqrtRescaleThreshold) || (Math.Abs(imaginaryCopy) >= s_sqrtRescaleThreshold))
717x = Math.Sqrt((double.Hypot(realCopy, imaginaryCopy) + realCopy) * 0.5);
722y = Math.Sqrt((double.Hypot(realCopy, imaginaryCopy) - realCopy) * 0.5);
754double theta = Math.Atan2(valueImaginary, valueReal);
755double newRho = powerReal * theta + powerImaginary * Math.Log(rho);
757double t = Math.Pow(rho, powerReal) * Math.Exp(-powerImaginary * theta);
System.Runtime.Serialization.Formatters (2)
System.Runtime.Serialization.Schema (1)
System.Security.Cryptography (22)
System.Security.Cryptography.Cose (2)
System.Security.Cryptography.Pkcs (5)
System.ServiceModel.Federation (1)
System.ServiceModel.Http (3)
System.ServiceModel.NetFramingBase (11)
System\ServiceModel\Channels\SingletonConnectionReader.cs (8)
351int bytesToCopy = Math.Min(_chunkBytesRemaining,
352Math.Min(_chunkBufferSize, count));
377bytesToRead = Math.Min(count, _chunkBytesRemaining + IntEncoder.MaxEncodedSize);
383DecodeData(buffer, offset, Math.Min(bytesRead, _chunkBytesRemaining));
455int bytesToCopy = Math.Min(_chunkBytesRemaining,
456Math.Min(_chunkBufferSize, count));
481bytesToRead = Math.Min(count, _chunkBytesRemaining + IntEncoder.MaxEncodedSize);
487DecodeData(buffer, offset, Math.Min(bytesRead, _chunkBytesRemaining));
System.ServiceModel.NetNamedPipe (1)
System.ServiceModel.Primitives (38)
System\ServiceModel\Channels\TransmissionStrategy.cs (20)
89_meanRtt = Math.Min((long)initRtt.TotalMilliseconds, Constants.MaxMeanRtt >> Constants.TimeMultiplier) << Constants.TimeMultiplier;
93_timeout = Math.Max(((200 << Constants.TimeMultiplier) * 2) + _meanRtt, _meanRtt + (_serrRtt << Constants.ChebychevFactor));
259int count = Math.Min(_windowSize, QuotaRemaining) - _window.Count;
263count = Math.Min(count, _waitQueue.Count);
299_slowStartThreshold = Math.Max(1, _windowSize >> 1);
592QuotaRemaining = quotaRemaining - Math.Min(_windowSize, _window.Count);
631int inFlightAfterAck = Math.Min(_windowSize, _window.Count) - (int)slide;
632QuotaRemaining = quotaRemaining - Math.Max(0, inFlightAfterAck);
643_windowSize = Math.Min(_maxWindowSize, Math.Min(_slowStartThreshold + 1, _windowSize + (int)slide));
648sendBeginIndex = Math.Max(0, (int)oldWindowEnd - (int)_windowStart);
655int segmentSize = Math.Max(1, (_lossWindowSize - _slowStartThreshold) / 8);
661_windowSize = Math.Min(_maxWindowSize, _windowSize + 1);
664sendBeginIndex = Math.Max(0, (int)oldWindowEnd - (int)_windowStart);
667int sendEndIndex = Math.Min(_windowSize, _window.Count);
732now = Math.Max(now, lastAttemptTime);
735_serrRtt = Math.Min(_serrRtt + ((Math.Abs(error) - _serrRtt) >> Constants.Gain), Constants.MaxSerrRtt);
736_meanRtt = Math.Min(_meanRtt + (error >> Constants.Gain), Constants.MaxMeanRtt);
737_timeout = Math.Max(((200 << Constants.TimeMultiplier) * 2) + _meanRtt, _meanRtt + (_serrRtt << Constants.ChebychevFactor));
System.ServiceModel.Syndication (1)
System.ServiceProcess.ServiceController (2)
System.Speech (10)
System.Text.Encodings.Web (6)
System.Text.Json (22)
System.Text.Json.SourceGeneration (4)
System.Text.RegularExpressions (44)
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 (27)
src\runtime\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 (2)
System.Threading.Tasks.Dataflow (1)
System.Threading.Tasks.Parallel (1)
System.Web.HttpUtility (2)
System.Windows.Controls.Ribbon (105)
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGalleryCategoriesPanel.cs (10)
383maxChildWidth = Math.Max(maxChildWidth, childSize.Width);
384maxChildHeight = Math.Max(maxChildHeight, childSize.Height);
458stackDesiredSize.Width = Math.Max(stackDesiredSize.Width, childDesiredSize.Width);
468stackDesiredSize.Width = Math.Min(stackDesiredSize.Width, constraint.Width);
469stackDesiredSize.Height = Math.Min(stackDesiredSize.Height, constraint.Height);
488logicalVisibleSpace = DoubleUtil.LessThanOrClose((viewportOffsetY + logicalVisibleSpace) - stackDesiredSize.Height, 0.0) ? 0.0 : Math.Min((viewportOffsetY + logicalVisibleSpace) - stackDesiredSize.Height, constraint.Height);
489viewportOffsetY = Math.Max(viewportOffsetY - logicalVisibleSpace, 0.0);
492offset.X = Math.Max(0, Math.Min(offset.X, extent.Width - viewport.Width));
598rcChild.Width = Math.Max(finalSize.Width, child.DesiredSize.Width);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGalleryItemsPanel.cs (25)
340maxColumnWidth = Math.Max(maxColumnWidth, childSize.Width);
341maxItemHeight = Math.Max(maxItemHeight, childSize.Height);
362columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount);
374columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount);
375arrangeWidth = Math.Max(availableSize.Width / columnCount, maxColumnWidth);
381columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / arrangeWidth), childrenCount)), maxColumnCount);
390columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount);
391_arrangeWidth = Math.Max(availableSize.Width / columnCount, maxColumnWidth);
397columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / _arrangeWidth), childrenCount)), maxColumnCount);
404columnCount = Math.Max(minColumnCount, Math.Min(childrenCount, maxColumnCount));
413maxRowHeight = Math.Max(maxRowHeight, childSize.Height);
566finalColumnCount = Math.Max(minColumnCount, Math.Min((int)(finalSize.Width / arrangeWidth), maxColumnCount));
575maxRowHeight = Math.Max(maxRowHeight, children[i].DesiredSize.Height);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGroupItemsPanel.cs (14)
82remainingHeightInColumn = Math.Max(0, finalSize.Height - childDesiredSize.Height);
104columnWidth = Math.Max(columnWidth, arrangeWidth);
132maxStarColumnWidth = Math.Max(maxStarColumnWidth, child.MaxWidth);
137maxStarColumnWidth = Math.Max(maxStarColumnWidth, Math.Min(child.MaxWidth, child.DesiredSize.Width));
219desiredHeight = Math.Min(Math.Max(desiredHeight, columnHeight), availableSize.Height);
244columnWidth = Math.Max(columnWidth, GetStarChildMinWidth(child as FrameworkElement, ref maxStarColumnWidth));
248columnWidth = Math.Max(columnWidth, childDesiredSize.Width);
249maxStarColumnWidth = Math.Max(maxStarColumnWidth, columnWidth);
254desiredHeight = Math.Min(Math.Max(desiredHeight, columnHeight), availableSize.Height);
354columnDesiredWidth = Math.Max(columnDesiredWidth, child.DesiredSize.Width);
371desiredWidth += Math.Max((columnDesiredWidth - starLayoutInfo.RequestedStarMinWidth), 0);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonTabHeadersPanel.cs (11)
89_separatorOpacity = Math.Max(0.0, reducePaddingRegularTabHeader * 0.2);
122double availableExtraWidth = Math.Min(desiredExtraPaddingPerTab, availableExtraWidthPerTab);
142if (Math.Abs(desiredSize.Width - availableSize.Width) < _desiredWidthEpsilon)
395desiredSize.Height = Math.Max(desiredSize.Height, ribbonTabHeader.DesiredSize.Height);
412desiredSize.Height = Math.Max(desiredSize.Height, child.DesiredSize.Height);
443double leftPadding = Math.Max(0, ribbonTabHeader.DefaultPadding.Left - (isContextualTab ? reducePaddingContextualTabHeader : reducePaddingRegularTabHeader));
444double rightPadding = Math.Max(0, ribbonTabHeader.DefaultPadding.Right - (isContextualTab ? reducePaddingContextualTabHeader : reducePaddingRegularTabHeader));
450desiredSize.Height = Math.Max(desiredSize.Height, ribbonTabHeader.DesiredSize.Height);
461desiredSize.Height = Math.Max(desiredSize.Height, child.DesiredSize.Height);
526return Math.Max(_tabHeaderMinWidth, maxTabHeaderWidth);
1048return Math.Max(0.0, offset);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonTitlePanel.cs (14)
76startContextualTabX = Math.Min(CalculateContextualTabGroupStartX(firstContextualTab), availableSize.Width);
82endContextualTabX = Math.Min(CalculateContextualTabGroupEndX(lastContextualTab), availableSize.Width);
85groupHeaderItemsControl.Measure(new Size(Math.Max(endContextualTabX - startContextualTabX, 0), availableSize.Height));
87desiredSize.Height = Math.Max(desiredSize.Height, groupHeaderItemsControl.DesiredSize.Height);
122availableToQat = Math.Max(availableToQat, 0);
129desiredSize.Height = Math.Max(desiredSize.Height, qat.DesiredSize.Height);
134endContextualTabX = Math.Max(endContextualTabX, availableToQat);
147availableToTitle = Math.Max(leftSpace, rightSpace);
153availableToTitle = Math.Max(availableToTitle, 0);
157desiredSize.Height = Math.Max(desiredSize.Height, titleHost.DesiredSize.Height);
160desiredSize.Width = Math.Min(desiredSize.Width, availableSize.Width); // Prevent clipping
185startContextualTabX = Math.Min(CalculateContextualTabGroupStartX(firstContextualTab), finalSize.Width);
188endContextualTabX = Math.Min(startContextualTabX + tabGroups.DesiredSize.Width, finalSize.Width);
201endContextualTabX = Math.Max(endContextualTabX, qatDesiredWidth);
System.Windows.Forms (621)
System.Windows.Forms.Design (181)
System.Windows.Forms.Primitives (20)
System.Windows.Input.Manipulations (34)
System.Xaml (1)
tlens (1)
UIAutomationClientSideProviders (27)
MS\Internal\AutomationProxies\WindowsEditBoxRange.cs (13)
127End = Math.Min(Math.Max(End, Start + 1), text.Length);
161End = Math.Min(Math.Max(End, Start + 1), text.Length);
295return text.Substring(Start, maxLength >= 0 ? Math.Min(Length, maxLength) : Length);
469Math.Max(0, _provider.LineFromChar(End) - _provider.LinesPerPage() + 1);
654int height = Math.Abs(_provider.GetLogfont().lfHeight);;
681ArrayList rects = new ArrayList(Math.Max(endLine - startLine + 1, 0));
776return Math.Round((double)(-logfont.lfHeight) * 72 / lpy);
823moved = Math.Min(count, limit - index);
868moved = Math.Min(count, lineMax - line - 1);
936moved = Math.Max(count, -oneBasedIndex);
981int actualCount = Math.Max(count, -line);
UIAutomationTypes (3)
VBCSCompiler (1)
vstest.console (1)
vstest.console.arm64 (1)
WindowsFormsIntegration (13)