7483 references to Math
AnalyzerRunner (1)
Aspire.Dashboard (17)
Aspire.Hosting (2)
Aspire.Hosting.Docker (1)
Aspire.Playground.Tests (1)
BuildActionTelemetryTable (2)
CodeGenerator (8)
CSharpSyntaxGenerator (1)
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)
http2cat (12)
IIS.FunctionalTests (12)
IIS.LongTests (12)
IIS.NewHandler.FunctionalTests (12)
IIS.NewShim.FunctionalTests (12)
IIS.ShadowCopy.Tests (3)
IISExpress.FunctionalTests (12)
illink (2)
InMemory.FunctionalTests (2)
KeyManagementSimulator (2)
LocalizationSample (4)
Metrics (22)
Metrics.Legacy (22)
Microsoft.Analyzers.Local.Tests (1)
Microsoft.Arcade.Common (1)
Microsoft.Arcade.Test.Common (3)
Microsoft.AspNetCore.App.Analyzers (2)
Microsoft.AspNetCore.Authentication.Cookies (2)
Microsoft.AspNetCore.Authentication.OpenIdConnect (1)
Microsoft.AspNetCore.Components (4)
Microsoft.AspNetCore.Components.Forms (2)
Microsoft.AspNetCore.Components.QuickGrid (1)
Microsoft.AspNetCore.Components.Server (11)
Microsoft.AspNetCore.Components.Tests (2)
Microsoft.AspNetCore.Components.Web (15)
Virtualization\Virtualize.cs (11)
229var lastItemIndex = Math.Min(_itemsBefore + _visibleItemCapacity, _itemCount);
231var placeholdersBeforeCount = Math.Min(_loadedItemsStartIndex, lastItemIndex);
271_lastRenderedPlaceholderCount = Math.Max(0, lastItemIndex - _itemsBefore - _lastRenderedItemCount);
283var itemsAfter = Math.Max(0, _itemCount - _visibleItemCapacity - _itemsBefore);
320var itemsBefore = Math.Max(0, _itemCount - itemsAfter - visibleItemCapacity);
359int val => Math.Min(val, MaxItemCount),
363itemsInSpacer = Math.Max(0, (int)Math.Floor(spacerSize / _itemSize) - OverscanCount);
364visibleItemCapacity = (int)Math.Ceiling(containerSize / _itemSize) + 2 * OverscanCount;
365unusedItemCapacity = Math.Max(0, visibleItemCapacity - maxItemCount);
375itemsBefore = Math.Max(0, _itemCount - visibleItemCapacity);
Microsoft.AspNetCore.Components.WebAssembly (1)
Microsoft.AspNetCore.Components.WebView (3)
Microsoft.AspNetCore.CookiePolicy.Test (2)
Microsoft.AspNetCore.Cryptography.KeyDerivation (1)
Microsoft.AspNetCore.DataProtection (3)
Microsoft.AspNetCore.DataProtection.Tests (1)
Microsoft.AspNetCore.Diagnostics (1)
Microsoft.AspNetCore.Grpc.JsonTranscoding (1)
Microsoft.AspNetCore.Grpc.Swagger (1)
Microsoft.AspNetCore.Hosting (1)
Microsoft.AspNetCore.Http (3)
Microsoft.AspNetCore.Http.Abstractions (5)
Microsoft.AspNetCore.Http.Connections (1)
Microsoft.AspNetCore.Http.Connections.Tests (1)
Microsoft.AspNetCore.Http.Extensions (5)
Microsoft.AspNetCore.Http.Results (2)
Microsoft.AspNetCore.Http.Tests (1)
Microsoft.AspNetCore.HttpLogging (8)
Microsoft.AspNetCore.HttpOverrides (4)
Microsoft.AspNetCore.HttpsPolicy (1)
Microsoft.AspNetCore.Identity.FunctionalTests (1)
Microsoft.AspNetCore.InternalTesting (1)
Microsoft.AspNetCore.Mvc.Core (3)
Microsoft.AspNetCore.Mvc.Core.TestCommon (2)
Microsoft.AspNetCore.Mvc.TagHelpers (3)
Microsoft.AspNetCore.Mvc.ViewFeatures (5)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (2)
Microsoft.AspNetCore.OpenApi (1)
Microsoft.AspNetCore.OpenApi.SourceGenerators (3)
Microsoft.AspNetCore.OutputCaching (4)
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (4)
Microsoft.AspNetCore.ResponseCaching (1)
Microsoft.AspNetCore.Routing (10)
Microsoft.AspNetCore.Routing.Microbenchmarks (2)
Microsoft.AspNetCore.Server.HttpSys (1)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (12)
Microsoft.AspNetCore.Server.IIS (5)
Microsoft.AspNetCore.Server.Kestrel.Core (34)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (7)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (2)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (1)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (1)
Microsoft.AspNetCore.Shared.Tests (20)
Microsoft.AspNetCore.SignalR.Client.Core (2)
Microsoft.AspNetCore.SignalR.Client.Tests (1)
Microsoft.AspNetCore.SignalR.Common (1)
Microsoft.AspNetCore.SignalR.Common.Tests (1)
Microsoft.AspNetCore.SignalR.Core (2)
Microsoft.AspNetCore.SignalR.Microbenchmarks (1)
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (2)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (1)
Microsoft.AspNetCore.SignalR.Specification.Tests (1)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (1)
Microsoft.AspNetCore.StaticAssets (1)
Microsoft.AspNetCore.StaticFiles (1)
Microsoft.AspNetCore.StaticFiles.FunctionalTests (1)
Microsoft.AspNetCore.TestHost (2)
Microsoft.AspNetCore.WebSockets (5)
Microsoft.AspNetCore.WebSockets.Tests (2)
Microsoft.AspNetCore.WebUtilities (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.AspNetCore.WebUtilities.Tests (4)
Microsoft.Build (56)
Microsoft.Build.Engine.OM.UnitTests (1)
Microsoft.Build.Engine.UnitTests (1)
Microsoft.Build.Framework (11)
SegmentedArray.cs (10)
488var currentSegmentLength = Math.Min(remainingInSegment, _length);
497var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
592var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
640var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
730_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
737_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
779_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
786_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Microsoft.Build.Tasks.Core (8)
Microsoft.Build.Tasks.UnitTests (6)
Microsoft.Build.UnitTests.Shared (2)
Microsoft.Build.Utilities.Core (4)
Microsoft.CodeAnalysis (112)
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\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
494var currentSegmentLength = Math.Min(remainingInSegment, _length);
503var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
598var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
646var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
736_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
743_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
785_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
792_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Text\SourceText.cs (10)
308bufferSize = Math.Min(maxBufferSize, length);
562int count = Math.Min(buffer.Length, end - offset);
640var charsToCopy = Math.Min(CharBufferSize, length - index);
725int position = Math.Max(Math.Min(span.Start, this.Length), 0);
726int length = Math.Min(span.End, this.Length) - position;
731int copyLength = Math.Min(buffer.Length, length);
1012var limit = Math.Min(_lineStarts.Count, lastLineNumber + 4);
1051var contentLength = Math.Min(length - position, buffer.Length);
1194var count = Math.Min(this.Length - position, CharBufferSize);
Microsoft.CodeAnalysis.Analyzers (22)
Microsoft.CodeAnalysis.AnalyzerUtilities (34)
Microsoft.CodeAnalysis.BannedApiAnalyzers (22)
Microsoft.CodeAnalysis.CodeStyle (83)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
494var currentSegmentLength = Math.Min(remainingInSegment, _length);
503var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
598var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
646var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
736_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
743_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
785_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
792_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
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.Collections.Package (15)
Segmented\SegmentedArray.cs (10)
494var currentSegmentLength = Math.Min(remainingInSegment, _length);
503var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
598var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
646var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
736_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
743_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
785_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
792_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Microsoft.CodeAnalysis.CSharp (49)
Microsoft.CodeAnalysis.CSharp.CodeStyle (7)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (12)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (3)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Features (24)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (8)
EditAndContinue\SyntaxComparerTests.cs (8)
95Assert.Equal(0.67, Math.Round(distance, 2));
105Assert.Equal(0.33, Math.Round(distance, 2));
112Assert.Equal(0.33, Math.Round(distance, 2));
119Assert.Equal(1, Math.Round(distance, 2));
129Assert.Equal(0, Math.Round(distance, 2));
135Assert.Equal(0, Math.Round(distance, 2));
141Assert.Equal(0, Math.Round(distance, 2));
147Assert.Equal(0, Math.Round(distance, 2));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (5)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
Microsoft.CodeAnalysis.CSharp.Workspaces (7)
Microsoft.CodeAnalysis.EditorFeatures (21)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (8)
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (8)
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (6)
Microsoft.CodeAnalysis.Features (33)
Microsoft.CodeAnalysis.Features.Test.Utilities (1)
Microsoft.CodeAnalysis.InteractiveHost (19)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
494var currentSegmentLength = Math.Min(remainingInSegment, _length);
503var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
598var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
646var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
736_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
743_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
785_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
792_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Microsoft.CodeAnalysis.LanguageServer.Protocol (7)
Microsoft.CodeAnalysis.PublicApiAnalyzers (3)
Microsoft.CodeAnalysis.Remote.ServiceHub (3)
Microsoft.CodeAnalysis.ResxSourceGenerator (23)
Microsoft.CodeAnalysis.Scripting (7)
Microsoft.CodeAnalysis.Test.Utilities (9)
Microsoft.CodeAnalysis.Threading.Package (15)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
494var currentSegmentLength = Math.Min(remainingInSegment, _length);
503var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
598var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
646var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
736_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
743_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
785_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
792_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Microsoft.CodeAnalysis.UnitTests (21)
LinePositionTests.cs (4)
80Assert.Equal(-1, Math.Sign(new LinePosition(1, 1).CompareTo(new LinePosition(1, 2))));
83Assert.Equal(-1, Math.Sign(new LinePosition(1, 2).CompareTo(new LinePosition(2, 1))));
88Assert.Equal(+1, Math.Sign(new LinePosition(1, 2).CompareTo(new LinePosition(1, 1))));
91Assert.Equal(+1, Math.Sign(new LinePosition(2, 1).CompareTo(new LinePosition(1, 2))));
Microsoft.CodeAnalysis.VisualBasic (2)
Microsoft.CodeAnalysis.Workspaces (109)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
494var currentSegmentLength = Math.Min(remainingInSegment, _length);
503var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
598var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
646var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
736_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
743_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
785_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
792_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
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 (24)
src\Dependencies\Collections\Segmented\SegmentedArray.cs (10)
494var currentSegmentLength = Math.Min(remainingInSegment, _length);
503var currentSegmentLength = Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed);
598var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
646var currentSegmentLength = Math.Min(Math.Min(remainingInFirstSegment, remainingInSecondSegment), _length - _completed);
736_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
743_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
785_current = segment.AsMemory().Slice(offset, Math.Min(remainingInSegment, _length));
792_current = segment.AsMemory().Slice(0, Math.Min(SegmentedArrayHelper.GetSegmentSize<T>(), _length - _completed));
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
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.DotNet.Build.Tasks.Feed (2)
Microsoft.DotNet.Build.Tasks.Feed.Tests (2)
Microsoft.DotNet.Build.Tasks.Installers (1)
Microsoft.DotNet.Helix.Sdk (2)
Microsoft.DotNet.NuGetRepack.Tests (3)
Microsoft.DotNet.RemoteExecutor (1)
Microsoft.DotNet.SignTool (2)
Microsoft.DotNet.XliffTasks (1)
Microsoft.DotNet.XUnitAssert.Tests (15)
AsyncCollectionAssertsTests.cs (12)
754 var padding = Math.Max(expectedType.Length, actualType.Length);
792 var padding = Math.Max(expectedType.Length, actualType.Length);
873 var padding = Math.Max(expectedType.Length, actualType.Length);
925 var padding = Math.Max(expectedType.Length, actualType.Length);
965 var padding = Math.Max(expectedType.Length, actualType.Length);
1026 var padding = Math.Max(expectedType.Length, actualType.Length);
1141 var padding = Math.Max(expectedType.Length, actualType.Length);
1191 var padding = Math.Max(expectedType.Length, actualType.Length);
1232 var padding = Math.Max(expectedType.Length, actualType.Length);
1274 var padding = Math.Max(expectedType.Length, actualType.Length);
1332 var padding = Math.Max(expectedType.Length, actualType.Length);
1359 var padding = Math.Max(expectedType.Length, actualType.Length);
Microsoft.Extensions.AI (1)
Microsoft.Extensions.AI.Integration.Tests (1)
Microsoft.Extensions.AI.OpenAI (3)
Microsoft.Extensions.Caching.Hybrid (5)
Microsoft.Extensions.Caching.StackExchangeRedis (1)
Microsoft.Extensions.DependencyInjection (3)
Microsoft.Extensions.DependencyModel (1)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (10)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (18)
Linux\AcceptanceTest.cs (11)
180Assert.Equal(0.1, Math.Round(provider.Resources.GuaranteedCpuUnits, 1)); // hack to make hardcoded calculation in resource utilization main package work.
181Assert.Equal(0.2d, Math.Round(provider.Resources.MaximumCpuUnits, 1)); // read from cpuset.cpus
349var roundedCpuUsedPercentage = Math.Round(utilization.CpuUsedPercentage, 1);
354Assert.Equal(roundedCpuUsedPercentage, Math.Round(cpuRequestFromGauge * 100));
356Assert.Equal(roundedCpuUsedPercentage, Math.Round(cpuFromGauge * 100));
430var roundedCpuUsedPercentage = Math.Round(utilization.CpuUsedPercentage, 1);
432Assert.Equal(0, Math.Round(cpuLimitFromGauge * 100));
433Assert.Equal(0, Math.Round(cpuRequestFromGauge * 100));
510var roundedCpuUsedPercentage = Math.Round(utilization.CpuUsedPercentage, 1);
512Assert.Equal(42, Math.Round(cpuLimitFromGauge * 100));
513Assert.Equal(83, Math.Round(cpuRequestFromGauge * 100));
Microsoft.Extensions.FileProviders.Physical (1)
Microsoft.Extensions.Http.Diagnostics (1)
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 (1)
Microsoft.Extensions.Telemetry (5)
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 (15)
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.VisualBasic.Core (9)
Microsoft.VisualStudio.LanguageServices (17)
Microsoft.VisualStudio.LanguageServices.CSharp (1)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
MSBuild (3)
MSBuildTaskHost (3)
mscorlib (1)
netstandard (1)
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);
960return _that._maxTextWidths[Math.Min(line, _that._maxTextWidths.Length - 1)];
1102Math.Min(textSourcePosition + line.Length - 1, _that._text.Length - 1)
1613int x0 = Math.Max(enumerator.Position, startIndex);
1614int x1 = Math.Min(enumerator.Position + enumerator.Length, startIndex + count);
1765accBlackBoxLeft = Math.Min(accBlackBoxLeft, blackBoxLeft);
1766accBlackBoxRight = Math.Max(accBlackBoxRight, blackBoxRight);
1767accBlackBoxBottom = Math.Max(accBlackBoxBottom, blackBoxBottom);
1768accBlackBoxTop = Math.Min(accBlackBoxTop, blackBoxTop);
1774metrics.Width = Math.Max(metrics.Width, currentLine.Width);
1775metrics.WidthIncludingTrailingWhitespace = Math.Max(metrics.WidthIncludingTrailingWhitespace, currentLine.WidthIncludingTrailingWhitespace);
1776lineStartOfLongestLine = 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);
1213pageOffset = new Point(Math.Max(ViewportWidth, ExtentWidth) - (xOffset + pageSize.Width), yOffset);
1443visiblePages.Add(_childrenCollection[_firstPageVisualIndex + j - Math.Max(0, firstPage)]);
1597double centerWidth = Math.Max(ViewportWidth, ExtentWidth);
2218(int)Math.Floor(ViewportWidth /
2223maxColumns = Math.Min(maxColumns, _pageCache.PageCount);
2224maxColumns = Math.Min(maxColumns, DocumentViewerConstants.MaximumMaxPagesAcross);
2235int rows = (int)Math.Floor((double)(_pageCache.PageCount / columns));
2247double aspectDiff = Math.Abs(layoutAspect - viewportAspect);
2356newScale = Math.Max(newScale, CurrentMinimumScale);
2357newScale = Math.Min(newScale, DocumentViewerConstants.MaximumScale);
2426scaleFactor = Math.Min(compensatedViewportWidth / rowWidth, compensatedViewportHeight / rowHeight);
2455scaleFactor = Math.Min(compensatedViewportWidth / rowWidth,
2681Math.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);
579dvrUsed = Math.Min(fsrcToFill.dv, dvrUsed);
662urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack);
663durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
792urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack);
793durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
MS\Internal\PtsHost\SubpageParagraph.cs (16)
166subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
175subpageHeight = Math.Max(1, subpageHeight - (marginTop + mbp.BPTop));
229dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
230fsrcToFill.du = Math.Max(fsrcToFill.du, fsbbox.fsrc.du + fsbbox.fsrc.u);
273fsbbox.fsrc.du = Math.Max(fsrcToFill.du - (mbp.MarginLeft + mbp.MarginRight), 0);
274fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
353subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
425dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
426durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u);
436fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0);
437fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
513subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
584dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
585durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u);
595fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0);
596fsbbox.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)
2623indexToSelect = Math.Min(Items.Count - numSelected - 1, indexToSelect);
5025int newRowCount = Math.Abs(endIndex - startIndex) + 1;
5026int newColumnCount = Math.Abs(endColumnIndex - startColumnIndex) + 1;
5044int previousStartIndex = Math.Min(startIndex, currentCellIndex);
5045int previousRowCount = Math.Abs(currentCellIndex - startIndex) + 1;
5046int previousStartColumnIndex = Math.Min(startColumnIndex, currentCellColumnIndex);
5047int previousColumnCount = Math.Abs(currentCellColumnIndex - startColumnIndex) + 1;
5087_selectedCells.AddRegion(Math.Min(startIndex, endIndex), Math.Min(startColumnIndex, endColumnIndex), newRowCount, newColumnCount);
5685nextDisplayIndex = Math.Max(0, InternalColumns.LastVisibleDisplayIndex);
5766nextRowIndex = Math.Max(0, Items.Count - 1);
5951index = Math.Max(0, Math.Min(numItems - 1, index + (shiftModifier ? -1 : 1)));
6091int jumpDistance = Math.Max(1, (int)scrollHost.ViewportHeight - 1);
6093targetIndex = Math.Max(0, Math.Min(targetIndex, Items.Count - 1));
6536distance = Math.Abs(pt.Y - cellBounds.Top);
6544distance = 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)
368gridDesiredSize.Width = Math.Max(gridDesiredSize.Width, child.DesiredSize.Width);
369gridDesiredSize.Height = Math.Max(gridDesiredSize.Height, child.DesiredSize.Height);
899ColumnIndex = Math.Min(GetColumn(child), DefinitionsU.Length - 1),
902RowIndex = Math.Min(GetRow(child), DefinitionsV.Length - 1)
908cell.ColumnSpan = Math.Min(GetColumnSpan(child), DefinitionsU.Length - cell.ColumnIndex);
912cell.RowSpan = Math.Min(GetRowSpan(child), DefinitionsV.Length - cell.RowIndex);
1089userMinSize = Math.Max(userMinSize, Math.Min(userSize, userMaxSize));
1113definitions[i].MeasureSize = Math.Max(userMinSize, Math.Min(userSize, userMaxSize));
1213DefinitionsU[PrivateCells[i].ColumnIndex].UpdateMinSize(Math.Min(children[i].DesiredSize.Width, DefinitionsU[PrivateCells[i].ColumnIndex].UserMaxSize));
1230DefinitionsV[PrivateCells[i].RowIndex].UpdateMinSize(Math.Min(children[i].DesiredSize.Height, DefinitionsV[PrivateCells[i].RowIndex].UserMaxSize));
1451double maxSize = Math.Max(definitions[i].UserMaxSize, minSize);
1503double newMinSize = Math.Min(sizeToDistribute / (count - i), tempDefinitions[i].PreferredSize);
1533tempDefinitions[i].UpdateMinSize(Math.Min(newMinSize, tempDefinitions[i].SizeCache));
1544tempDefinitions[i].UpdateMinSize(Math.Min(newMinSize, tempDefinitions[i].SizeCache));
1655starValue = Math.Min(starValue, c_starClip);
1659double maxSize = Math.Max(definitions[i].MinSize, definitions[i].UserMaxSize);
1660maxSize = Math.Min(maxSize, c_starClip);
1698double userSize = Math.Max(availableSize - takenSize, 0.0) * (starValue / tempDefinitions[i].SizeCache);
1699resolvedSize = Math.Min(userSize, tempDefinitions[i].UserMaxSize);
1700resolvedSize = Math.Max(tempDefinitions[i].MinSize, resolvedSize);
1761double power = Math.Floor(Math.Log(Double.MaxValue / maxStar / starCount, 2.0));
1764scale = Math.Pow(2.0, power - 4.0); // -4 is just for paranoia
1812double effectiveMaxSize = Math.Max(def.MinSize, def.UserMaxSize);
1884resolvedSize = Math.Max(resolvedDef.MinSize, resolvedDef.UserMaxSize);
2002double resolvedSize = (def.MeasureSize > 0.0) ? Math.Max(availableSize - takenSize, 0.0) * (def.MeasureSize / def.SizeCache) : 0.0;
2005resolvedSize = Math.Min(resolvedSize, def.UserMaxSize);
2006resolvedSize = Math.Max(def.MinSize, resolvedSize);
2095starValue = Math.Min(starValue, c_starClip);
2099double maxSize = Math.Max(definitions[i].MinSizeForArrange, definitions[i].UserMaxSize);
2100maxSize = Math.Min(maxSize, c_starClip);
2140definitions[i].SizeCache = Math.Max(definitions[i].MinSizeForArrange, Math.Min(userSize, userMaxSize));
2185double userSize = Math.Max(finalSize - allPreferredArrangeSize, 0.0) * (starValue / definitions[definitionIndices[i]].SizeCache);
2186resolvedSize = Math.Min(userSize, definitions[definitionIndices[i]].UserMaxSize);
2187resolvedSize = Math.Max(definitions[definitionIndices[i]].MinSizeForArrange, resolvedSize);
2212final = Math.Max(final, definitions[definitionIndex].MinSizeForArrange);
2213final = Math.Min(final, definitions[definitionIndex].SizeCache);
2219final = Math.Max(final, definitions[definitionIndex].MinSizeForArrange);
2220final = Math.Min(final, definitions[definitionIndex].SizeCache);
2253final = Math.Max(final, definition.MinSizeForArrange);
2269final = Math.Max(final, definition.MinSizeForArrange);
2340double power = Math.Floor(Math.Log(Double.MaxValue / maxStar / starCount, 2.0));
2343scale = Math.Pow(2.0, power - 4.0); // -4 is just for paranoia
2387double effectiveMaxSize = Math.Max(def.MinSizeForArrange, def.UserMaxSize);
2426def.SizeCache = Math.Max(def.MinSizeForArrange, Math.Min(userSize, userMaxSize));
2495resolvedSize = Math.Max(resolvedDef.MinSizeForArrange, resolvedDef.UserMaxSize);
2627double resolvedSize = (def.MeasureSize > 0.0) ? Math.Max(finalSize - takenSize, 0.0) * (def.MeasureSize / def.SizeCache) : 0.0;
2630resolvedSize = Math.Min(resolvedSize, def.UserMaxSize);
2631resolvedSize = Math.Max(def.MinSizeForArrange, resolvedSize);
2722final = Math.Max(final, definition.MinSizeForArrange);
2738final = Math.Max(final, definition.MinSizeForArrange);
2780double minPower = Math.Floor(Math.Log(minRatio, 2.0));
2781double maxPower = Math.Floor(Math.Log(maxRatio, 2.0));
2782double f = Math.Pow(2.0, Math.Floor((minPower + maxPower) / 2.0));
2861Array.Clear(extData.TempDefinitions, 0, Math.Max(DefinitionsU.Length, DefinitionsV.Length));
3066int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length) * 2;
3099int requiredLength = Math.Max(Math.Max(DefinitionsU.Length, DefinitionsV.Length), 1) * 2;
3117int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length);
3209return (Math.Abs(d) < c_epsilon);
3220return (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);
1245return (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)
2114if (Math.Abs(score - childArea) < Tolerance)
2140if (Math.Abs(intersection.Width - childBounds.Width) > Tolerance ||
2141Math.Abs(intersection.Height - childBounds.Height) > Tolerance)
2155if (!IsTransparent || double.IsNaN(horizontalAxis.Y) || Math.Abs(horizontalAxis.Y) < Tolerance)
2167else if (IsTransparent && Math.Abs(horizontalAxis.X) < Tolerance)
2190if (!IsTransparent || double.IsNaN(verticalAxis.X) || Math.Abs(verticalAxis.X) < Tolerance)
2201else if (IsTransparent && Math.Abs(verticalAxis.Y) < Tolerance)
2256if (!IsTransparent || double.IsNaN(verticalAxis.X) || Math.Abs(verticalAxis.X) < Tolerance)
2258limitSize.Height = Math.Max(0.0, Math.Max(screenBounds.Bottom - targetBounds.Bottom, targetBounds.Top - screenBounds.Top));
2260else if (IsTransparent && Math.Abs(verticalAxis.Y) < Tolerance)
2262limitSize.Width = Math.Max(0.0, Math.Max(screenBounds.Right - targetBounds.Right, targetBounds.Left - screenBounds.Left));
2278if (!IsTransparent || double.IsNaN(horizontalAxis.X) || Math.Abs(horizontalAxis.Y) < Tolerance)
2280limitSize.Width = Math.Max(0.0, Math.Max(screenBounds.Right - targetBounds.Right, targetBounds.Left - screenBounds.Left));
2282else if (IsTransparent && Math.Abs(horizontalAxis.X) < Tolerance)
2284limitSize.Height = Math.Max(0.0, Math.Max(screenBounds.Bottom - targetBounds.Bottom, targetBounds.Top - screenBounds.Top));
2634desiredSize.Width = Math.Min(desiredSize.Width, screenBounds.Width);
2635desiredSize.Width = Math.Min(desiredSize.Width, limitSize.Width);
2639desiredSize.Height = Math.Min(desiredSize.Height, screenBounds.Height);
2640desiredSize.Height = Math.Min(desiredSize.Height, maxHeight);
2641desiredSize.Height = Math.Min(desiredSize.Height, limitSize.Height);
2714return 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)
702Math.Max(ia.OriginWidth, pagePadding.Left),
703Math.Max(ia.OriginHeight, pagePadding.Top),
704Math.Max(ia.MediaSizeWidth - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right),
705Math.Max(ia.MediaSizeHeight - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom));
743SetCurrentValueInternal(ZoomProperty, Math.Min(Zoom + ZoomIncrement, MaxZoom));
755SetCurrentValueInternal(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);
4738pixelSizeBeforeViewport = Math.Max(pixelSizeBeforeViewport, Math.Abs(_viewport.X - _extendedViewport.X));
4742logicalSizeBeforeViewport = Math.Max(logicalSizeBeforeViewport, Math.Abs(_viewport.X - _extendedViewport.X));
4774extendedViewport.Width = Math.Max(extendedViewport.Width + extendedViewport.X, 0.0);
4785extendedViewport.Width = Math.Max(_scrollData._extent.Width - extendedViewport.X, 0.0);
4814extendedViewport.Width = Math.Max(extendedViewport.Width / approxSizeOfLogicalUnit + extendedViewport.X, 0.0) * approxSizeOfLogicalUnit;
4825extendedViewport.Width = Math.Max(_scrollData._extent.Width - extendedViewport.X, 0.0) * approxSizeOfLogicalUnit;
4854pixelSizeBeforeViewport = Math.Max(pixelSizeBeforeViewport, Math.Abs(_viewport.Y - _extendedViewport.Y));
4858logicalSizeBeforeViewport = Math.Max(logicalSizeBeforeViewport, Math.Abs(_viewport.Y - _extendedViewport.Y));
4890extendedViewport.Height = Math.Max(extendedViewport.Height + extendedViewport.Y, 0.0);
4901extendedViewport.Height = Math.Max(_scrollData._extent.Height - extendedViewport.Y, 0.0);
4930extendedViewport.Height = Math.Max(extendedViewport.Height / approxSizeOfLogicalUnit + extendedViewport.Y, 0.0) * approxSizeOfLogicalUnit;
4941extendedViewport.Height = Math.Max(_scrollData._extent.Height - extendedViewport.Y, 0.0) * approxSizeOfLogicalUnit;
4953double factor = Math.Max(1.0, isHorizontal ? extendedViewport.Width / viewport.Width : extendedViewport.Height / viewport.Height);
4954int calcItemsInExtendedViewportCount = (int)Math.Ceiling(factor * _actualItemsInExtendedViewportCount);
4955itemsInExtendedViewportCount = Math.Max(calcItemsInExtendedViewportCount, itemsInExtendedViewportCount);
5066viewport.Width = Math.Max(viewport.Width - sizeAfterStartViewportEdge, 0);
5070cacheBeforeSize = Math.Max(cacheBeforeSize - sizeBeforeStartViewportEdge, 0);
5074cacheBeforeSize = Math.Max(cacheBeforeSize - Math.Floor(logicalSize.Width * sizeBeforeStartViewportEdge / pixelSize.Width), 0);
5101viewport.Width = Math.Max(0, parentViewport.Width - pixelSize.Width);
5116cacheAfterSize = Math.Max(cacheAfterSize - sizeAfterEndViewportEdge, 0);
5120cacheAfterSize = Math.Max(cacheAfterSize - Math.Floor(logicalSize.Width * sizeAfterEndViewportEdge / pixelSize.Width), 0);
5132cacheAfterSize = Math.Max(cacheAfterSize - pixelSize.Width, 0);
5136cacheAfterSize = Math.Max(cacheAfterSize - logicalSize.Width, 0);
5165viewport.Height = Math.Max(viewport.Height - sizeAfterStartViewportEdge, 0);
5169cacheBeforeSize = Math.Max(cacheBeforeSize - sizeBeforeStartViewportEdge, 0);
5173cacheBeforeSize = Math.Max(cacheBeforeSize - Math.Floor(logicalSize.Height * sizeBeforeStartViewportEdge / pixelSize.Height), 0);
5200viewport.Height = Math.Max(0, parentViewport.Height - pixelSize.Height);
5215cacheAfterSize = Math.Max(cacheAfterSize - sizeAfterEndViewportEdge, 0);
5219cacheAfterSize = Math.Max(cacheAfterSize - Math.Floor(logicalSize.Height * sizeAfterEndViewportEdge / pixelSize.Height), 0);
5231cacheAfterSize = Math.Max(cacheAfterSize - pixelSize.Height, 0);
5235cacheAfterSize = Math.Max(cacheAfterSize - logicalSize.Height, 0);
5300cacheBeforeSize = Math.Max(0, cacheBeforeSize - parentViewport.X);
5305viewport.Width = Math.Max(0, viewport.Width + viewport.X);
5325cacheBeforeSize = Math.Max(0, cacheBeforeSize - inset.Right);
5329cacheBeforeSize = Math.Max(0, cacheBeforeSize - 1);
5344viewport.Width = Math.Max(0, viewport.Width - inset.Left);
5355cacheAfterSize = Math.Max(0, cacheAfterSize - (inset.Left - viewport.Width));
5372cacheAfterSize = Math.Max(0, cacheAfterSize - inset.Left);
5376cacheAfterSize = Math.Max(0, cacheAfterSize - 1);
5403cacheBeforeSize = Math.Max(0, cacheBeforeSize - parentViewport.Y);
5408viewport.Height = Math.Max(0, viewport.Height + viewport.Y);
5428cacheBeforeSize = Math.Max(0, cacheBeforeSize - inset.Bottom);
5432cacheBeforeSize = Math.Max(0, cacheBeforeSize - 1);
5447viewport.Height = Math.Max(0, viewport.Height - inset.Top);
5458cacheAfterSize = Math.Max(0, cacheAfterSize - (inset.Top - viewport.Height));
5475cacheAfterSize = Math.Max(0, cacheAfterSize - inset.Top);
5479cacheAfterSize = Math.Max(0, cacheAfterSize - 1);
5535double spanBeforeViewport = Math.Max(isHorizontal ? viewport.X : viewport.Y, 0.0);
5547firstItemInViewportIndex = (int)Math.Floor(spanBeforeViewport / childSize);
6523double eps = (Math.Abs(value1) + Math.Abs(value2)) * Tolerance;
6704childViewport.X = Math.Min(childViewport.X, 0) -
6707childViewport.Width = Math.Max(childViewport.Width - stackPixelSizeInViewport.Width, 0.0);
6712childViewport.Width = Math.Max(childViewport.Width - stackPixelSizeInViewport.Width, 0.0);
6720Math.Max(parentCacheSize.CacheBeforeViewport - stackLogicalSizeInCacheBeforeViewport.Width, 0.0),
6723Math.Max(parentCacheSize.CacheAfterViewport - stackLogicalSizeInCacheAfterViewport.Width, 0.0));
6731Math.Max(parentCacheSize.CacheBeforeViewport - stackPixelSizeInCacheBeforeViewport.Width, 0.0),
6734Math.Max(parentCacheSize.CacheAfterViewport - stackPixelSizeInCacheAfterViewport.Width, 0.0));
6749childViewport.Y = Math.Min(childViewport.Y, 0) -
6753childViewport.Height = Math.Max(childViewport.Height - stackPixelSizeInViewport.Height, 0.0);
6758childViewport.Height = Math.Max(childViewport.Height - stackPixelSizeInViewport.Height, 0.0);
6766Math.Max(parentCacheSize.CacheBeforeViewport - stackLogicalSizeInCacheBeforeViewport.Height, 0.0),
6769Math.Max(parentCacheSize.CacheAfterViewport - stackLogicalSizeInCacheAfterViewport.Height, 0.0));
6777Math.Max(parentCacheSize.CacheBeforeViewport - stackPixelSizeInCacheBeforeViewport.Height, 0.0),
6780Math.Max(parentCacheSize.CacheAfterViewport - stackPixelSizeInCacheAfterViewport.Height, 0.0));
6887childLogicalSize.Width = Math.Max(itemDesiredSizes.LogicalSize.Width, logicalHeaderSize.Width);
6892childLogicalSize.Height = Math.Max(itemDesiredSizes.LogicalSize.Height, logicalHeaderSize.Height);
7091Size frontPixelSize = isHorizontal ? new Size(Math.Max(inset.Left,0), childDesiredSize.Height)
7092: new Size(childDesiredSize.Width, Math.Max(inset.Top, 0));
7105Size backPixelSize = isHorizontal ? new Size(Math.Max(inset.Right,0), childDesiredSize.Height)
7106: new Size(childDesiredSize.Width, Math.Max(inset.Bottom,0));
7119adjustedChildViewport.Width = Math.Max(0, adjustedChildViewport.Width - childPixelSizeInViewport.Width);
7125adjustedChildViewport.Height = Math.Max(0, adjustedChildViewport.Height - childPixelSizeInViewport.Height);
7210pixelSizeBeforeViewport = DoubleUtil.LessThan(childViewport.X, childPixelSize.Width) ? Math.Max(childViewport.X, 0.0) : childPixelSize.Width;
7211pixelSizeInViewport = Math.Min(childViewport.Width, childPixelSize.Width - pixelSizeBeforeViewport);
7212pixelSizeAfterViewport = 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
7257logicalSizeBeforeViewport = Math.Floor(childLogicalSize.Width * pixelSizeBeforeViewport / childPixelSize.Width);
7258logicalSizeAfterViewport = Math.Floor(childLogicalSize.Width * pixelSizeAfterViewport / childPixelSize.Width);
7266double childPixelHeightInViewport = Math.Min(childViewport.Height, childPixelSize.Height - Math.Max(childViewport.Y, 0.0));
7269childPixelSizeInViewport.Height = Math.Max(childPixelSizeInViewport.Height, childPixelHeightInViewport);
7271childPixelSizeInCacheBeforeViewport.Height = Math.Max(childPixelSizeInCacheBeforeViewport.Height, childPixelHeightInViewport);
7273childPixelSizeInCacheAfterViewport.Height = Math.Max(childPixelSizeInCacheAfterViewport.Height, childPixelHeightInViewport);
7276childLogicalSizeInViewport.Height = Math.Max(childLogicalSizeInViewport.Height, childLogicalSize.Height);
7278childLogicalSizeInCacheBeforeViewport.Height = Math.Max(childLogicalSizeInCacheBeforeViewport.Height, childLogicalSize.Height);
7280childLogicalSizeInCacheAfterViewport.Height = Math.Max(childLogicalSizeInCacheAfterViewport.Height, childLogicalSize.Height);
7302pixelSizeBeforeViewport = DoubleUtil.LessThan(childViewport.Y, childPixelSize.Height) ? Math.Max(childViewport.Y, 0.0) : childPixelSize.Height;
7303pixelSizeInViewport = Math.Min(childViewport.Height, childPixelSize.Height - pixelSizeBeforeViewport);
7304pixelSizeAfterViewport = 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
7349logicalSizeBeforeViewport = Math.Floor(childLogicalSize.Height * pixelSizeBeforeViewport / childPixelSize.Height);
7350logicalSizeAfterViewport = Math.Floor(childLogicalSize.Height * pixelSizeAfterViewport / childPixelSize.Height);
7358double childPixelWidthInViewport = Math.Min(childViewport.Width, childPixelSize.Width - Math.Max(childViewport.X, 0.0));
7361childPixelSizeInViewport.Width = Math.Max(childPixelSizeInViewport.Width, childPixelWidthInViewport);
7363childPixelSizeInCacheBeforeViewport.Width = Math.Max(childPixelSizeInCacheBeforeViewport.Width, childPixelWidthInViewport);
7365childPixelSizeInCacheAfterViewport.Width = Math.Max(childPixelSizeInCacheAfterViewport.Width, childPixelWidthInViewport);
7368childLogicalSizeInViewport.Width = Math.Max(childLogicalSizeInViewport.Width, childLogicalSize.Width);
7370childLogicalSizeInCacheBeforeViewport.Width = Math.Max(childLogicalSizeInCacheBeforeViewport.Width, childLogicalSize.Width);
7372childLogicalSizeInCacheAfterViewport.Width = Math.Max(childLogicalSizeInCacheAfterViewport.Width, childLogicalSize.Width);
7415sz1.Height = Math.Max(sz1.Height, sz2.Height);
7420sz1.Width = Math.Max(sz1.Width, sz2.Width);
7470childSize = new Size(Math.Max(headerDesiredSizes.PixelSize.Width, itemDesiredSizes.PixelSize.Width),
7475childSize = new Size(Math.Max(headerDesiredSizes.LogicalSize.Width, itemDesiredSizes.LogicalSize.Width),
7559uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes);
7643Math.Max(1, itemDesiredSizes.LogicalSize.Height))
7644: new Size(Math.Max(1, itemDesiredSizes.LogicalSize.Width),
7785Math.Max(uniformOrAverageContainerPixelSize, dpiScale), // don't round down to 0
7795uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes);
8458rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8483previousChildSize.Width = Math.Max(previousChildSize.Width, pixelHeaderSize.Width);
8490rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
8515previousChildSize.Height = Math.Max(previousChildSize.Height, pixelHeaderSize.Height);
8545rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8551rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
8589rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8642rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
9519return Math.Max(0, _firstItemInExtendedViewportIndex);
9527return Math.Min(ItemCount, _firstItemInExtendedViewportIndex + _actualItemsInExtendedViewportCount);
9645_scrollData._maxDesiredSize.Height = Math.Max(_scrollData._maxDesiredSize.Height, stackPixelSize.Height);
9672_scrollData._maxDesiredSize.Width = Math.Max(_scrollData._maxDesiredSize.Width, stackPixelSize.Width);
9698Math.Min(stackPixelSize.Width, constraint.Width) : constraint.Width;
9703Math.Min(stackPixelSize.Height, constraint.Height) : constraint.Height;
9713Debug.Assert(DoubleUtil.AreClose(viewportSize.Width - Math.Floor(viewportSize.Width), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
9714Debug.Assert(DoubleUtil.AreClose(extentSize.Width - Math.Floor(extentSize.Width), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
9718Debug.Assert(DoubleUtil.AreClose(viewportSize.Height - Math.Floor(viewportSize.Height), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
9719Debug.Assert(DoubleUtil.AreClose(extentSize.Height - Math.Floor(extentSize.Height), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
9969double proposedViewportSize = Math.Floor(viewport.Width / approxSizeOfLogicalUnit);
10062if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.X)/extentSize.Width, Math.Floor(_scrollData._offset.X)/_scrollData._extent.Width))
10065viewportOffset.X = Math.Floor((extentSize.Width * Math.Floor(_scrollData._offset.X)) / _scrollData._extent.Width);
10186double proposedViewportSize = Math.Floor(viewport.Height / approxSizeOfLogicalUnit);
10279if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.Y)/extentSize.Height, Math.Floor(_scrollData._offset.Y)/_scrollData._extent.Height))
10282viewportOffset.Y = Math.Floor((extentSize.Height * Math.Floor(_scrollData._offset.Y)) / _scrollData._extent.Height);
10494_scrollData._maxDesiredSize.Height = Math.Max(_scrollData._maxDesiredSize.Height, stackPixelSize.Height);
10521_scrollData._maxDesiredSize.Width = Math.Max(_scrollData._maxDesiredSize.Width, stackPixelSize.Width);
10547Math.Min(stackPixelSize.Width, constraint.Width) : constraint.Width;
10552Math.Min(stackPixelSize.Height, constraint.Height) : constraint.Height;
10562Debug.Assert(DoubleUtil.AreClose(viewportSize.Width - Math.Floor(viewportSize.Width), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
10563Debug.Assert(DoubleUtil.AreClose(extentSize.Width - Math.Floor(extentSize.Width), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
10567Debug.Assert(DoubleUtil.AreClose(viewportSize.Height - Math.Floor(viewportSize.Height), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
10568Debug.Assert(DoubleUtil.AreClose(extentSize.Height - Math.Floor(extentSize.Height), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
10648lastPageSafeOffset = lastPageSafeOffset.HasValue ? Math.Min(computedViewportOffset.X, (double)lastPageSafeOffset) : computedViewportOffset.X;
10651double proposedViewportSize = Math.Floor(viewport.Width / approxSizeOfLogicalUnit);
10733if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.X)/extentSize.Width, Math.Floor(_scrollData._offset.X)/_scrollData._extent.Width))
10736viewportOffset.X = Math.Floor((extentSize.Width * Math.Floor(_scrollData._offset.X)) / _scrollData._extent.Width);
10779lastPageSafeOffset = lastPageSafeOffset.HasValue ? Math.Min(computedViewportOffset.Y, (double)lastPageSafeOffset) : computedViewportOffset.Y;
10782double proposedViewportSize = Math.Floor(viewport.Height / approxSizeOfLogicalUnit);
10864if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.Y)/extentSize.Height, Math.Floor(_scrollData._offset.Y)/_scrollData._extent.Height))
10867viewportOffset.Y = Math.Floor((extentSize.Height * Math.Floor(_scrollData._offset.Y)) / _scrollData._extent.Height);
11165double visibleStart = Math.Max(start, 0);
11166double visibleEnd = Math.Max(Math.Min(end, viewportSize), visibleStart);
11211else if (childIndex > firstChildInView + Math.Max(viewportSize - 1, 0))
11257maxChildLength = Math.Max(maxChildLength, childSize.Height);
11261maxChildLength = Math.Max(maxChildLength, childSize.Width);
11853else if (DoubleUtil.GreaterThan(Math.Abs(newOffset - oldOffset), _viewport.Width))
11869else 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)
814double shortestDimension = Math.Min(windowSize.Width, windowSize.Height);
817topLeftRadius = Math.Min(topLeftRadius, shortestDimension / 2);
833topRightRadius = Math.Min(topRightRadius, shortestDimension / 2);
841bottomLeftRadius = Math.Min(bottomLeftRadius, shortestDimension / 2);
849bottomRightRadius = Math.Min(bottomRightRadius, shortestDimension / 2);
876(int)Math.Floor(region.Left),
877(int)Math.Floor(region.Top),
878(int)Math.Ceiling(region.Right),
879(int)Math.Ceiling(region.Bottom));
884(int)Math.Floor(region.Left),
885(int)Math.Floor(region.Top),
886(int)Math.Ceiling(region.Right) + 1,
887(int)Math.Ceiling(region.Bottom) + 1,
888(int)Math.Ceiling(radius),
889(int)Math.Ceiling(radius));
977deviceGlassThickness.Top = Math.Max(0, deviceGlassThickness.Top);
982deviceGlassThickness.Left = Math.Max(0, deviceGlassThickness.Left);
987deviceGlassThickness.Bottom = Math.Max(0, deviceGlassThickness.Bottom);
992deviceGlassThickness.Right = Math.Max(0, deviceGlassThickness.Right);
999cxLeftWidth = (int)Math.Ceiling(deviceGlassThickness.Left),
1000cxRightWidth = (int)Math.Ceiling(deviceGlassThickness.Right),
1001cyTopHeight = (int)Math.Ceiling(deviceGlassThickness.Top),
1002cyBottomHeight = (int)Math.Ceiling(deviceGlassThickness.Bottom),
System\Windows\Window.cs (30)
1813frameworkAvailableSize.Width = Math.Max(mm.minWidth, Math.Min(frameworkAvailableSize.Width, mm.maxWidth));
1814frameworkAvailableSize.Height = Math.Max(mm.minHeight, Math.Min(frameworkAvailableSize.Height, mm.maxHeight));
1821Math.Max(desiredSize.Width, mm.minWidth),
1822Math.Max(desiredSize.Height, mm.minHeight));
1843arrangeBounds.Width = Math.Max(mm.minWidth, Math.Min(arrangeBounds.Width, mm.maxWidth));
1844arrangeBounds.Height = Math.Max(mm.minHeight, Math.Min(arrangeBounds.Height, mm.maxHeight));
1879Width = Math.Max(0.0, arrangeBounds.Width - frameSize.Width),
1880Height = Math.Max(0.0, arrangeBounds.Height - frameSize.Height)
3415Width = ((constraint.Width == Double.PositiveInfinity) ? Double.PositiveInfinity : Math.Max(0.0, (constraint.Width - frameSize.Width))),
3416Height = ((constraint.Height == Double.PositiveInfinity) ? Double.PositiveInfinity : Math.Max(0.0, (constraint.Height - frameSize.Height)))
3461maxWidthDeviceUnits = Math.Max(_trackMaxWidthDeviceUnits, _windowMaxWidthDeviceUnits);
3462maxHeightDeviceUnits = Math.Max(_trackMaxHeightDeviceUnits, _windowMaxHeightDeviceUnits);
3471mm.minWidth = Math.Max(this.MinWidth, minSizeLogicalUnits.X);
3476mm.maxWidth = Math.Min(MinWidth, maxSizeLogicalUnits.X);
3482mm.maxWidth = Math.Min(MaxWidth, maxSizeLogicalUnits.X);
3493mm.minHeight = Math.Max(this.MinHeight, minSizeLogicalUnits.Y);
3498mm.maxHeight = Math.Min(this.MinHeight, maxSizeLogicalUnits.Y);
3504mm.maxHeight = Math.Min(MaxHeight, maxSizeLogicalUnits.Y);
3855leftDeviceUnits = Math.Min(leftDeviceUnits, workAreaRectDeviceUnits.right - currentSizeDeviceUnits.Width);
3856leftDeviceUnits = Math.Max(leftDeviceUnits, workAreaRectDeviceUnits.left);
3857topDeviceUnits = Math.Min(topDeviceUnits, workAreaRectDeviceUnits.bottom - currentSizeDeviceUnits.Height);
3858topDeviceUnits = Math.Max(topDeviceUnits, workAreaRectDeviceUnits.top);
4717_windowMaxWidthDeviceUnits = Math.Max(_windowMaxWidthDeviceUnits, windowSize.X);
4718_windowMaxHeightDeviceUnits = Math.Max(_windowMaxHeightDeviceUnits, windowSize.Y);
7606return 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)
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 (24)
Roslyn.VisualStudio.DiagnosticsWindow (1)
Roslyn.VisualStudio.Next.UnitTests (1)
ScenarioTests.Common.Tests (1)
Shared (3)
SignalRSamples (2)
Sockets.FunctionalTests (3)
Stress.ApiService (1)
Swaggatherer (2)
System.Collections (5)
System.Collections.Concurrent (8)
System.Collections.Immutable (12)
System.ComponentModel.TypeConverter (6)
System.Console (3)
System.Data.Common (88)
System\Data\SQLTypes\SQLDecimal.cs (26)
414precision = Math.Max(precision, _bScale);
680double dInt = Math.Floor(dVal);
687dVal = Math.Floor(dInt / s_DUINT_BASE);
693dVal = Math.Floor(dInt / s_DUINT_BASE);
700dVal = Math.Floor(dInt / s_DUINT_BASE);
707dVal = Math.Floor(dInt / s_DUINT_BASE);
766dFrac -= Math.Floor(dFrac);
1138dRet /= System.Math.Pow(10.0, _bScale);
1251ResInteger = Math.Max(x._bPrec - MyScale, y._bPrec - OpScale);
1255ResScale = Math.Max(MyScale, OpScale);
1261ResPrec = Math.Min(MaxPrecision, ResPrec);
1465ResScale = Math.Min((ResPrec - ResInteger), ResScale);
1467ResScale = Math.Max(ResScale, Math.Min(ActualScale, s_cNumeDivScaleMin));
1688ResScale = Math.Max(x._bScale + y._bPrec + 1, s_cNumeDivScaleMin);
1691MinScale = Math.Min(ResScale, s_cNumeDivScaleMin);
1693ResInteger = Math.Min(ResInteger, s_NUMERIC_MAX_PRECISION);
1700ResScale = Math.Min((ResPrec - ResInteger), ResScale);
1701ResScale = Math.Max(ResScale, MinScale);
2297bNewPrec = (byte)(Math.Min(s_NUMERIC_MAX_PRECISION, Math.Max(1, lAdjust + _bPrec)));
3168lPosition = Math.Min(s_NUMERIC_MAX_PRECISION, lPosition);
3175lPosition = Math.Max(-s_NUMERIC_MAX_PRECISION, lPosition);
3186int lAdjust = Math.Abs(lPosition - n._bScale); // Precision adjustment
3225lAdjust = Math.Abs(lPosition - n._bScale);
3261n = new SqlDecimal(Math.Pow(dBaseNum, exp));
System.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.Diagnostics.DiagnosticSource (10)
System.Diagnostics.Process (6)
System.Diagnostics.TextWriterTraceListener (1)
System.Drawing.Common.Tests (15)
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 (6)
System.Formats.Nrbf (3)
System.Formats.Tar (13)
System.IO.Compression (8)
System.IO.FileSystem.Watcher (2)
System.IO.Hashing (1)
System.IO.Pipelines (8)
System.IO.Ports (5)
System.Linq (20)
System.Linq.AsyncEnumerable (5)
System.Linq.Expressions (8)
System.Linq.Parallel (5)
System.Memory (4)
System.Memory.Data (1)
System.Net.Http (55)
System.Net.HttpListener (10)
System.Net.Mail (7)
System.Net.NameResolution (1)
System.Net.NetworkInformation (1)
System.Net.Ping (4)
System.Net.Primitives (8)
System.Net.Quic (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 (10)
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 (525)
src\libraries\System.Private.CoreLib\src\System\Byte.cs (4)
279public static (byte Quotient, byte Remainder) DivRem(byte left, byte right) => Math.DivRem(left, right);
525public static byte Clamp(byte value, byte min, byte max) => Math.Clamp(value, min, max);
531public static byte Max(byte x, byte y) => Math.Max(x, y);
537public static byte Min(byte x, byte y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (52)
184ulong high = Math.BigMul(a, b, out ulong low);
243(div, rem) = Math.DivRem(tmp, den);
248(div, rem) = Math.DivRem(tmp, den);
256(bufNum.Low64, rem) = Math.DivRem(tmp, den);
409(ulong quo64, bufNum.Low64) = Math.DivRem(num, den);
451ulong prod = Math.BigMul(quo, (uint)den); // quo * lo divisor
496uint prod2 = (uint)Math.BigMul(bufDen.Low64, quo, out prod1);
552ulong hi64 = Math.BigMul(bufNum.Low64, power, out ulong low64);
554hi64 = Math.BigMul(bufNum.U2, power) + hi64;
579ulong hi64 = Math.BigMul(bufNum.Low64, power, out ulong low64);
581bufNum.High64 = Math.BigMul(bufNum.U2, power) + (nuint)hi64;
595bufNum.U2 = (uint)Math.BigMul(bufNum.Low64, power, out ulong low64);
771(quotient, remainder) = Math.DivRem(high, power);
1026low64 = Math.BigMul((uint)low64, UInt32Powers10[scale]);
1030low64 = Math.BigMul((uint)low64, TenToPowerNine);
1039high = (uint)Math.BigMul(low64, power, out low64);
1052tmp64 = Math.BigMul(low64, power, out low64);
1053tmp64 += Math.BigMul(high, power);
1085tmp64 += Math.BigMul(rgulNum[cur], power);
1288ulong high = Math.BigMul(pdecIn.Low64, pwr, out ulong low);
1372ulong tmp = Math.BigMul(low64, power, out low64);
1373tmp += Math.BigMul(high, power);
1416ulong low64 = Math.BigMul(d1.Low, d2.Low);
1429(low64, ulong remainder) = Math.DivRem(low64, power);
1447tmp = Math.BigMul(d1.Low, d2.Low64, out ulong low);
1452tmp += Math.BigMul(d1.Low, d2.High);
1467tmp = Math.BigMul(d1.Low64, d2.Low, out ulong low);
1472tmp += Math.BigMul(d2.Low, d1.High);
1502ulong mid64 = Math.BigMul(d1.Low64, d2.Low64, out tmp);
1508ulong hi64 = Math.BigMul(d1.High, d2.High);
1511hi64 += Math.BigMul(d1.Low64, d2.High, out tmp);
1517hi64 += Math.BigMul(d2.Low64, d1.High, out tmp);
1626mant = (uint)(int)Math.Round(dbl);
1645result.Low64 = Math.BigMul(mant, UInt32Powers10[power]);
1653ulong low64 = Math.BigMul(mant, UInt32Powers10[power - 18]);
1658ulong low64 = Math.BigMul(mant, UInt32Powers10[power - 9]);
1659ulong hi64 = Math.BigMul(TenToPowerNine, low64, out low64);
1681(uint div, uint rem) = Math.DivRem(mant, 10000);
1692(uint div, uint rem) = Math.DivRem(mant, 100);
1703(uint div, uint rem) = Math.DivRem(mant, 10);
1786mant = (ulong)(long)Math.Round(dbl);
1806ulong low64 = Math.BigMul((uint)mant, pow10);
1807ulong hi64 = Math.BigMul((uint)(mant >> 32), pow10);
1967curScale = Math.Min(9, -scale);
2011ulong num = Math.BigMul(remainder, power);
2058curScale = Math.Min(9, -scale);
2120curScale = Math.Min(9, -scale);
2240uint hi32 = (uint)Math.BigMul(d2.Low64, power, out ulong low64);
2322ulong tmp64 = Math.BigMul(b.Buf24.U0, power);
2327tmp64 += Math.BigMul(buf[i], power);
2411(d.uhi, remainder) = Math.DivRem(n, divisor);
2452(d.uhi, remainder) = Math.DivRem(n, power);
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;
579public static double Log2(double value) => Math.Log2(value);
633public static double Exp(double x) => Math.Exp(x);
636public static double ExpM1(double x) => Math.Exp(x) - 1;
639public static double Exp2(double x) => Math.Pow(2, x);
642public static double Exp2M1(double x) => Math.Pow(2, x) - 1;
645public static double Exp10(double x) => Math.Pow(10, x);
648public static double Exp10M1(double x) => Math.Pow(10, x) - 1;
656public static double Ceiling(double x) => Math.Ceiling(x);
679public static double Floor(double x) => Math.Floor(x);
683public static double Round(double x) => Math.Round(x);
686public static double Round(double x, int digits) => Math.Round(x, digits);
689public static double Round(double x, MidpointRounding mode) => Math.Round(x, mode);
692public static double Round(double x, int digits, MidpointRounding mode) => Math.Round(x, digits, mode);
696public static double Truncate(double x) => Math.Truncate(x);
779static double IFloatingPointConstants<double>.E => Math.E;
808public static double Atan2(double y, double x) => Math.Atan2(y, x);
814public static double BitDecrement(double x) => Math.BitDecrement(x);
817public static double BitIncrement(double x) => Math.BitIncrement(x);
821public static double FusedMultiplyAdd(double left, double right, double addend) => Math.FusedMultiplyAdd(left, right, addend);
824public static double Ieee754Remainder(double left, double right) => Math.IEEERemainder(left, right);
827public static int ILogB(double x) => Math.ILogB(x);
834public static double ReciprocalEstimate(double x) => Math.ReciprocalEstimate(x);
838public static double ReciprocalSqrtEstimate(double x) => Math.ReciprocalSqrtEstimate(x);
841public static double ScaleB(double x, int n) => Math.ScaleB(x, n);
852public static double Acosh(double x) => Math.Acosh(x);
856public static double Asinh(double x) => Math.Asinh(x);
860public static double Atanh(double x) => Math.Atanh(x);
864public static double Cosh(double x) => Math.Cosh(x);
868public static double Sinh(double x) => Math.Sinh(x);
872public static double Tanh(double x) => Math.Tanh(x);
887public static double Log(double x) => Math.Log(x);
890public static double Log(double x, double newBase) => Math.Log(x, newBase);
893public static double LogP1(double x) => Math.Log(x + 1);
896public static double Log2P1(double x) => Math.Log2(x + 1);
900public static double Log10(double x) => Math.Log10(x);
903public static double Log10P1(double x) => Math.Log10(x + 1);
945Math.ThrowMinMaxException(min, max);
955Math.ThrowMinMaxException(min, max);
961public static double CopySign(double value, double sign) => Math.CopySign(value, sign);
965public static double Max(double x, double y) => Math.Max(x, y);
996public static double Min(double x, double y) => Math.Min(x, y);
1026public static int Sign(double value) => Math.Sign(value);
1043public static double Abs(double value) => Math.Abs(value);
1139public static double MaxMagnitude(double x, double y) => Math.MaxMagnitude(x, y);
1169public static double MinMagnitude(double x, double y) => Math.MinMagnitude(x, y);
1477public static double Pow(double x, double y) => Math.Pow(x, y);
1485public static double Cbrt(double x) => Math.Cbrt(x);
1769public static double Sqrt(double x) => Math.Sqrt(x);
1801public static double Acos(double x) => Math.Acos(x);
1811public static double Asin(double x) => Math.Asin(x);
1821public static double Atan(double x) => Math.Atan(x);
1831public static double Cos(double x) => Math.Cos(x);
1942public static double Sin(double x) => Math.Sin(x);
1945public static (double Sin, double Cos) SinCos(double x) => Math.SinCos(x);
2150public static double Tan(double x) => Math.Tan(x);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (8)
464FormatDigits(ref result, hour12, Math.Min(tokenLen, 2));
469FormatDigits(ref result, dateTime.Hour, Math.Min(tokenLen, 2));
474FormatDigits(ref result, dateTime.Minute, Math.Min(tokenLen, 2));
479FormatDigits(ref result, dateTime.Second, Math.Min(tokenLen, 2));
638FormatDigits(ref result, year, Math.Min(tokenLen, 2));
824(int tens, int ones) = Math.DivRem(offset.Hours, 10);
1502(int offsetHours, int offsetMinutes) = Math.DivRem(offsetTotalMinutes, 60);
1706(int offsetHours, offsetMinutes) = Math.DivRem(offsetMinutes, 60);
src\libraries\System.Private.CoreLib\src\System\Int16.cs (7)
282public static (short Quotient, short Remainder) DivRem(short left, short right) => Math.DivRem(left, right);
619public static short Clamp(short value, short min, short max) => Math.Clamp(value, min, max);
635Math.ThrowNegateTwosCompOverflow();
645public static short Max(short x, short y) => Math.Max(x, y);
651public static short Min(short x, short y) => Math.Min(x, y);
657public static int Sign(short value) => Math.Sign(value);
673public static short Abs(short value) => Math.Abs(value);
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);
660public static int Clamp(int value, int min, int max) => Math.Clamp(value, min, max);
676Math.ThrowNegateTwosCompOverflow();
686public static int Max(int x, int y) => Math.Max(x, y);
692public static int Min(int x, int y) => Math.Min(x, y);
698public static int Sign(int value) => Math.Sign(value);
714public static int Abs(int value) => Math.Abs(value);
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);
657public static long Clamp(long value, long min, long max) => Math.Clamp(value, min, max);
673Math.ThrowNegateTwosCompOverflow();
683public static long Max(long x, long y) => Math.Max(x, y);
689public static long Min(long x, long y) => Math.Min(x, y);
695public static int Sign(long value) => Math.Sign(value);
711public static long Abs(long value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (7)
299public static (nint Quotient, nint Remainder) DivRem(nint left, nint right) => Math.DivRem(left, right);
652public static nint Clamp(nint value, nint min, nint max) => Math.Clamp(value, min, max);
668Math.ThrowNegateTwosCompOverflow();
678public static nint Max(nint x, nint y) => Math.Max(x, y);
684public static nint Min(nint x, nint y) => Math.Min(x, y);
690public static int Sign(nint value) => Math.Sign(value);
706public static nint Abs(nint value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (34)
598nMaxDigits = Math.Max(number.DigitsCount, TNumber.MaxRoundTripDigits);
1384int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length;
1410int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length;
1439int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value));
1458int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value));
1495int bufferLength = Math.Max(digits, 32 - (int)uint.LeadingZeroCount(value));
1514int bufferLength = Math.Max(digits, 32 - (int)uint.LeadingZeroCount(value));
1589(value, uint remainder) = Math.DivRem(value, 100);
1631(value, uint remainder) = Math.DivRem(value, 100);
1659(value, remainder) = Math.DivRem(value, 100);
1666(value, remainder) = Math.DivRem(value, 10);
1713int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
1749int bufferLength = Math.Max(digits, countedDigits);
1817int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length;
1843int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length;
1872int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value));
1891int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value));
1944int bufferLength = Math.Max(digits, 64 - (int)ulong.LeadingZeroCount(value));
1963int bufferLength = Math.Max(digits, 64 - (int)ulong.LeadingZeroCount(value));
2060(value, ulong remainder) = Math.DivRem(value, 100);
2099(value, remainder) = Math.DivRem(value, 100);
2106(value, remainder) = Math.DivRem(value, 10);
2141int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
2176int bufferLength = Math.Max(digits, countedDigits);
2245int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length;
2273int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length;
2304int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits(uValue));
2325int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits(uValue));
2354return Int64ToHexChars(buffer, lower, hexBase, Math.Max(digits, 1));
2367int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value));
2388int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value));
2417return UInt64ToBinaryChars(buffer, lower, Math.Max(digits, 1));
2503int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
2517int bufferLength = Math.Max(digits, countedDigits);
src\libraries\System.Private.CoreLib\src\System\SByte.cs (7)
285public static (sbyte Quotient, sbyte Remainder) DivRem(sbyte left, sbyte right) => Math.DivRem(left, right);
582public static sbyte Clamp(sbyte value, sbyte min, sbyte max) => Math.Clamp(value, min, max);
598Math.ThrowNegateTwosCompOverflow();
608public static sbyte Max(sbyte x, sbyte y) => Math.Max(x, y);
614public static sbyte Min(sbyte x, sbyte y) => Math.Min(x, y);
620public static int Sign(sbyte value) => Math.Sign(value);
636public static sbyte Abs(sbyte value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (17)
135capacity = Math.Max(capacity, length);
159capacity = Math.Min(DefaultCapacity, maxCapacity);
207persistedCapacity = Math.Min(Math.Max(DefaultCapacity, persistedString.Length), persistedMaxCapacity);
417int capacityToPreserve = Math.Min(Capacity, Math.Max(Length * 6 / 5, m_ChunkChars.Length));
845int length = Math.Min(m_ChunkChars.Length - m_ChunkLength, count);
909chunkEndIndex = Math.Min(chunkEndIndex, chunk.m_ChunkLength);
2109ReadOnlySpan<char> remainingChunk = chunk.m_ChunkChars.AsSpan(indexInChunk, Math.Min(chunk.m_ChunkLength - indexInChunk, count));
2145Debug.Assert(oldValue.Length > Math.Min(count, chunk.m_ChunkLength - indexInChunk),
2231int curInChunk = Math.Max(startIndexInChunk, 0);
2232int endInChunk = Math.Min(chunk.m_ChunkLength, endIndexInChunk);
2476int lengthToCopy = Math.Min(lengthInChunk, count);
2562int newBlockLength = Math.Max(minBlockCharCount, Math.Min(Length, MaxChunkSize));
2670StringBuilder newChunk = new StringBuilder(Math.Max(count, DefaultCapacity), chunk.m_MaxCapacity, chunk.m_ChunkPrevious);
2674int copyCount1 = Math.Min(count, indexInChunk);
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.Blocking.cs (14)
15return Math.Min(_separated.counts.NumThreadsGoal, TargetThreadsGoalForBlockingAdjustment);
28: (short)Math.Min((ushort)(_minThreads + _numBlockedThreads), (ushort)_maxThreads);
146short toSubtract = Math.Min((short)(numThreadsGoal - targetThreadsGoal), _numThreadsAddedDueToBlocking);
157(short)Math.Min((ushort)(_minThreads + BlockingConfig.ThreadsToAddWithoutDelay), (ushort)_maxThreads);
164Math.Max(configuredMaxThreadsWithoutDelay, Math.Min(counts.NumExistingThreads, _maxThreads));
165short targetThreadsGoalWithoutDelay = Math.Min(targetThreadsGoal, maxThreadsGoalWithoutDelay);
221newNumThreadsGoal = (short)Math.Min(newNumThreadsGoal, achievableNumThreadsGoal);
249return Math.Min((uint)delayStepCount * BlockingConfig.DelayStepMs, BlockingConfig.MaxDelayMs);
327blocking_threadsPerDelayStep_procCountFactor = Math.Max(1, blocking_threadsPerDelayStep_procCountFactor);
337MaxDelayMs = Math.Max(1, Math.Min(MaxDelayMs, GateThread.GateActivitiesPeriodMs));
338DelayStepMs = Math.Max(1, Math.Min(DelayStepMs, MaxDelayMs));
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.HillClimbing.cs (21)
200int sampleCount = ((int)Math.Min(_totalSamples - 1, _samplesToMeasure)) / _wavePeriod * _wavePeriod;
235throughputErrorEstimate = Math.Max(throughputErrorEstimate, (GetWaveComponent(_samples, sampleCount, adjacentPeriod2) / averageThroughput).Abs());
271double noiseForConfidence = Math.Max(_averageThroughputNoise, throughputErrorEstimate);
288double move = Math.Min(1.0, Math.Max(-1.0, ratio.Real));
293move *= Math.Min(1.0, Math.Max(0.0, confidence));
301move = Math.Pow(Math.Abs(move), _gainExponent) * (move >= 0.0 ? 1 : -1) * gain;
302move = Math.Min(move, _maxChangePerSample);
321newThreadWaveMagnitude = Math.Min(newThreadWaveMagnitude, _maxThreadWaveMagnitude);
322newThreadWaveMagnitude = Math.Max(newThreadWaveMagnitude, 1);
332_currentControlSetting = Math.Min(maxThreads - newThreadWaveMagnitude, _currentControlSetting);
333_currentControlSetting = Math.Max(minThreads, _currentControlSetting);
343newThreadCount = Math.Min(maxThreads, newThreadCount);
344newThreadCount = Math.Max(minThreads, newThreadCount);
377newSampleInterval = (int)(0.5 + _currentSampleMs * (10.0 * Math.Min(-ratio.Real, 1.0)));
413entry.lastHistoryCount = (int)(Math.Min(_totalSamples, _samplesToMeasure) / _wavePeriod) * _wavePeriod;
447double w = 2 * Math.PI / period;
448double cos = Math.Cos(w);
457return new Complex(q1 - q2 * cos, q2 * Math.Sin(w)) / numSamples;
src\libraries\System.Private.CoreLib\src\System\TimeSpan.cs (17)
479Int128 totalMicroseconds = Math.BigMul(days, MicrosecondsPerDay)
480+ Math.BigMul(hours, MicrosecondsPerHour)
481+ Math.BigMul(minutes, MicrosecondsPerMinute)
482+ Math.BigMul(seconds, MicrosecondsPerSecond)
483+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
515Int128 totalMicroseconds = Math.BigMul(hours, MicrosecondsPerHour)
516+ Math.BigMul(minutes, MicrosecondsPerMinute)
517+ Math.BigMul(seconds, MicrosecondsPerSecond)
518+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
549Int128 totalMicroseconds = Math.BigMul(minutes, MicrosecondsPerMinute)
550+ Math.BigMul(seconds, MicrosecondsPerSecond)
551+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
581Int128 totalMicroseconds = Math.BigMul(seconds, MicrosecondsPerSecond)
582+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
612Int128 totalMicroseconds = Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
923double ticks = Math.Round(timeSpan.Ticks * factor);
938double ticks = Math.Round(timeSpan.Ticks / divisor);
src\libraries\System.Private.CoreLib\src\System\UInt16.cs (4)
276public static (ushort Quotient, ushort Remainder) DivRem(ushort left, ushort right) => Math.DivRem(left, right);
544public static ushort Clamp(ushort value, ushort min, ushort max) => Math.Clamp(value, min, max);
550public static ushort Max(ushort x, ushort y) => Math.Max(x, y);
556public static ushort Min(ushort x, ushort y) => Math.Min(x, y);
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);
583public static uint Clamp(uint value, uint min, uint max) => Math.Clamp(value, min, max);
589public static uint Max(uint x, uint y) => Math.Max(x, y);
595public static uint Min(uint x, uint y) => Math.Min(x, y);
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);
582public static ulong Clamp(ulong value, ulong min, ulong max) => Math.Clamp(value, min, max);
588public static ulong Max(ulong x, ulong y) => Math.Max(x, y);
594public static ulong Min(ulong x, ulong y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (4)
295public static (nuint Quotient, nuint Remainder) DivRem(nuint left, nuint right) => Math.DivRem(left, right);
585public static nuint Clamp(nuint value, nuint min, nuint max) => Math.Clamp(value, min, max);
591public static nuint Max(nuint x, nuint y) => Math.Max(x, y);
597public static nuint Min(nuint x, nuint y) => Math.Min(x, y);
System.Private.CoreLib.Generators (3)
System.Private.DataContractSerialization (52)
System\Xml\XmlBaseReader.cs (6)
1148actual = Math.Min(count, value.Length);
1178return ReadBytes(DataContractSerializer.Base64Encoding, 3, 4, buffer, offset, Math.Min(count, 512), false);
1370return ReadBytes(DataContractSerializer.Base64Encoding, 3, 4, buffer, offset, Math.Min(count, 512), true);
1390return ReadBytes(DataContractSerializer.BinHexEncoding, 1, 2, buffer, offset, Math.Min(count, 512), true);
1425int actual = Math.Min(_trailByteCount, byteCount);
1493int actual = Math.Min(_trailByteCount, byteCount);
System\Xml\XmlBinaryReader.cs (15)
881int maxLength = Math.Max(_maxBytesPerRead - maxTextNodeLength, 0);
893int actual = Math.Max(maxLength - maxTextNodeLength, 0);
951int maxLength = Math.Max(_maxBytesPerRead - maxTextNodeLength, 0);
963int actual = Math.Max(maxLength - maxTextNodeLength, 0);
993int maxBytesPerRead = Math.Max(_maxBytesPerRead - nodeLength, 0);
1240int actual = Math.Min(count, _arrayCount);
1263int actual = Math.Min(count, _arrayCount);
1286int actual = Math.Min(count, _arrayCount);
1309int actual = Math.Min(count, _arrayCount);
1332int actual = Math.Min(count, _arrayCount);
1355int actual = Math.Min(count, _arrayCount);
1378int actual = Math.Min(count, _arrayCount);
1402int actual = Math.Min(count, _arrayCount);
1431int actual = Math.Min(count, _arrayCount);
1467int actual = Math.Min(count, _arrayCount);
System.Private.Uri (4)
System.Private.Windows.Core (7)
System.Private.Xml (28)
System.Reflection.Emit (3)
System.Reflection.Metadata (19)
System.Reflection.MetadataLoadContext (1)
System.Runtime (1)
System.Runtime.Caching (18)
System.Runtime.Extensions (1)
System.Runtime.Numerics (92)
System\Number.BigInteger.cs (9)
326ReadOnlySpan<byte> intDigits = number.Digits.Slice(0, Math.Min(number.Scale, number.DigitsCount));
381int totalDigitCount = Math.Min(number.DigitsCount, number.Scale);
406int powersOf1e9BufferLength = PowersOf1e9.GetBufferSize(Math.Max(valueDigits, trailingZeroCount + 1), out int maxIndex);
501int trailingPartialCount = Math.DivRem(trailingZeroCount, PowersOf1e9.MaxPartialDigits, out int remainingTrailingZeroCount);
665int charsIncludeDigits = Math.Max(digits, charsForBits);
809(ulong quo, ulong rem) = Math.DivRem(uuRes, TenPowMaxPartial);
815(uCarry, base1E9Buffer[cuDst++]) = Math.DivRem(uCarry, TenPowMaxPartial);
829int strDigits = Math.Max(digits, valueDigits);
1129int trailingPartialCount = Math.DivRem(trailingZeroCount, MaxPartialDigits, out int remainingTrailingZeroCount);
System\Numerics\BigInteger.cs (20)
364int wholeUInt32Count = Math.DivRem(byteCount, 4, out int unalignedBytes);
757(quotient, remainder) = Math.DivRem(dividend._sign, divisor._sign);
839return Log(value, Math.E);
851return Math.Log(value._sign, baseValue);
866return Math.Log(x, baseValue) + (b - 64) / Math.Log(baseValue, 2);
1611double significand = (double)highBits * Math.Pow(10, exponentLow - exponent);
1614double log10 = Math.Log10(significand);
1618significand /= Math.Pow(10, Math.Floor(log10));
1623significand = Math.Round(significand, 8);
2361size = Math.Max(x.Length, y.Length);
2417size = Math.Max(x.Length, y.Length);
2468size = Math.Max(x.Length, y.Length);
2505(int digitShift, int smallShift) = Math.DivRem(shift, kcbitUint);
2564(int digitShift, int smallShift) = Math.DivRem(shift, kcbitUint);
2597int zl = Math.Max(xl - digitShift, 0) + (trackSignBit ? 1 : 0);
3276(int digitShift, int smallShift) = Math.DivRem(rotateAmount, kcbitUint);
3431(int digitShift, int smallShift) = Math.DivRem(rotateAmount, kcbitUint);
5270(int digitShift, int smallShift) = Math.DivRem(shiftAmount, kcbitUint);
System\Numerics\Complex.cs (51)
42private static readonly double s_sqrtRescaleThreshold = double.MaxValue / (Math.Sqrt(2.0) + 1.0);
45private static readonly double s_asinOverflowThreshold = Math.Sqrt(double.MaxValue) / 2.0;
48private static readonly double s_log2 = Math.Log(2.0);
64public double Phase { get { return Math.Atan2(m_imaginary, m_real); } }
68(double sin, double cos) = Math.SinCos(phase);
229if (Math.Abs(d) < Math.Abs(c))
278if (Math.Abs(d) < Math.Abs(c))
312return x * Math.Log(xp1) / (xp1 - 1.0);
316return Math.Log(xp1);
379(double sin, double cos) = Math.SinCos(value.m_real);
380return new Complex(sin * Math.Cosh(value.m_imaginary), cos * Math.Sinh(value.m_imaginary));
397Asin_Internal(Math.Abs(value.Real), Math.Abs(value.Imaginary), out b, out bPrime, out v);
402u = Math.Asin(b);
406u = Math.Atan(bPrime);
417(double sin, double cos) = Math.SinCos(value.m_real);
418return 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 b, out bPrime, out 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 (25)
System.Security.Cryptography.Cose (2)
System.Security.Cryptography.Pkcs (4)
System.ServiceModel.Federation (1)
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.Syndication (1)
System.Text.Encodings.Web (6)
System.Text.Json (22)
System.Text.Json.SourceGeneration (4)
System.Text.RegularExpressions (40)
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\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (9)
114int reps = node.Kind is RegexNodeKind.One ? 1 : Math.Min(node.M, MaxPrefixLength);
164int reps = node.Kind is RegexNodeKind.Set ? 1 : Math.Min(node.M, MaxPrefixLength);
228int limit = Math.Min(node.M, MaxPrefixLength); // MaxPrefixLength here is somewhat arbitrary, as a single loop iteration could yield multiple chars
434int count = Math.Min(node.M, SingleCharIterationLimit);
442int limit = Math.Min(node.M, NodeIterationLimit);
612int minIterations = Math.Min(node.M, MaxLoopExpansion);
643int minIterations = Math.Min(node.M, MaxLoopExpansion);
856int c = Math.Max(s1CharsLength, s1RangeLength).CompareTo(Math.Max(s2CharsLength, s2RangeLength));
System.Threading (2)
System.Threading.Channels (1)
System.Threading.RateLimiting (3)
System.Threading.Tasks.Dataflow (1)
System.Threading.Tasks.Parallel (1)
System.Web.HttpUtility (2)
System.Windows.Controls.Ribbon (105)
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGalleryCategoriesPanel.cs (10)
386maxChildWidth = Math.Max(maxChildWidth, childSize.Width);
387maxChildHeight = Math.Max(maxChildHeight, childSize.Height);
461stackDesiredSize.Width = Math.Max(stackDesiredSize.Width, childDesiredSize.Width);
471stackDesiredSize.Width = Math.Min(stackDesiredSize.Width, constraint.Width);
472stackDesiredSize.Height = Math.Min(stackDesiredSize.Height, constraint.Height);
491logicalVisibleSpace = DoubleUtil.LessThanOrClose((viewportOffsetY + logicalVisibleSpace) - stackDesiredSize.Height, 0.0) ? 0.0 : Math.Min((viewportOffsetY + logicalVisibleSpace) - stackDesiredSize.Height, constraint.Height);
492viewportOffsetY = Math.Max(viewportOffsetY - logicalVisibleSpace, 0.0);
495offset.X = Math.Max(0, Math.Min(offset.X, extent.Width - viewport.Width));
601rcChild.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);
135maxStarColumnWidth = Math.Max(maxStarColumnWidth, child.MaxWidth);
140maxStarColumnWidth = Math.Max(maxStarColumnWidth, Math.Min(child.MaxWidth, child.DesiredSize.Width));
222desiredHeight = Math.Min(Math.Max(desiredHeight, columnHeight), availableSize.Height);
247columnWidth = Math.Max(columnWidth, GetStarChildMinWidth(child as FrameworkElement, ref maxStarColumnWidth));
251columnWidth = Math.Max(columnWidth, childDesiredSize.Width);
252maxStarColumnWidth = Math.Max(maxStarColumnWidth, columnWidth);
257desiredHeight = Math.Min(Math.Max(desiredHeight, columnHeight), availableSize.Height);
357columnDesiredWidth = Math.Max(columnDesiredWidth, child.DesiredSize.Width);
374desiredWidth += 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 (604)
System.Windows.Forms.Design (181)
System.Windows.Forms.Primitives (20)
System.Windows.Forms.Primitives.TestUtilities (2)
System.Windows.Forms.Tests (6)
System.Windows.Forms.UI.IntegrationTests (14)
System.Windows.Input.Manipulations (34)
System.Xaml (1)
Test.Utilities (3)
Text.Analyzers (22)
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)
WindowsBase.Tests (9)
System\Windows\VectorTests.cs (9)
50yield return new object[] { 1, 2, Math.Sqrt(5) };
51yield return new object[] { 1.1, 2.2, Math.Sqrt(6.05) };
52yield return new object[] { -1.1, -2.2, Math.Sqrt(6.05) };
53yield return new object[] { double.MaxValue, double.MaxValue, Math.Sqrt(double.PositiveInfinity) };
62Assert.Equal(Math.Sqrt(vector.LengthSquared), vector.Length, precision: 5);
323Assert.Equal(1 / Math.Sqrt(5), vector.X, precision: 5);
324Assert.Equal(2 / Math.Sqrt(5), vector.Y, precision: 5);
334Assert.Equal(-1 / Math.Sqrt(5), vector.X, precision: 5);
335Assert.Equal(-2 / Math.Sqrt(5), vector.Y, precision: 5);
WindowsFormsIntegration (13)
WinFormsControlsTest (10)
xunit.assert (36)
EqualityAsserts.cs (26)
280 var typeNameIndent = Math.Max(expectedTypeName.Length, actualTypeName.Length);
346 var expectedRounded = Math.Round(expected, precision);
347 var actualRounded = Math.Round(actual, precision);
372 var expectedRounded = Math.Round(expected, precision, rounding);
373 var actualRounded = Math.Round(actual, precision, rounding);
398 if (!(object.Equals(expected, actual) || Math.Abs(expected - actual) <= tolerance))
418 var expectedRounded = Math.Round(expected, precision);
419 var actualRounded = Math.Round(actual, precision);
444 var expectedRounded = Math.Round(expected, precision, rounding);
445 var actualRounded = Math.Round(actual, precision, rounding);
470 if (!(object.Equals(expected, actual) || Math.Abs(expected - actual) <= tolerance))
490 var expectedRounded = Math.Round(expected, precision);
491 var actualRounded = Math.Round(actual, precision);
794 var typeNameIndent = Math.Max(expectedTypeName.Length, actualTypeName.Length);
827 var expectedRounded = Math.Round(expected, precision);
828 var actualRounded = Math.Round(actual, precision);
853 var expectedRounded = Math.Round(expected, precision, rounding);
854 var actualRounded = Math.Round(actual, precision, rounding);
879 if (object.Equals(expected, actual) || Math.Abs(expected - actual) <= tolerance)
899 var expectedRounded = Math.Round(expected, precision);
900 var actualRounded = Math.Round(actual, precision);
925 var expectedRounded = Math.Round(expected, precision, rounding);
926 var actualRounded = Math.Round(actual, precision, rounding);
951 if (object.Equals(expected, actual) || Math.Abs(expected - actual) <= tolerance)
971 var expectedRounded = Math.Round(expected, precision);
972 var actualRounded = Math.Round(actual, precision);