7173 references to Math
AnalyzerRunner (1)
Aspire.Dashboard (17)
Aspire.Hosting (1)
Aspire.Playground.Tests (1)
BuildActionTelemetryTable (2)
CodeGenerator (8)
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 (10)
IIS.FunctionalTests (10)
IIS.LongTests (10)
IIS.NewHandler.FunctionalTests (10)
IIS.NewShim.FunctionalTests (10)
IIS.ShadowCopy.Tests (3)
IISExpress.FunctionalTests (10)
illink (2)
InMemory.FunctionalTests (2)
KeyManagementSimulator (2)
LocalizationSample (4)
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.Web (14)
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 (2)
Microsoft.AspNetCore.DataProtection.Tests (1)
Microsoft.AspNetCore.Diagnostics (1)
Microsoft.AspNetCore.Grpc.JsonTranscoding (1)
Microsoft.AspNetCore.Grpc.Swagger (1)
Microsoft.AspNetCore.Hosting (1)
Microsoft.AspNetCore.Http (3)
Microsoft.AspNetCore.Http.Abstractions (5)
Microsoft.AspNetCore.Http.Connections (1)
Microsoft.AspNetCore.Http.Connections.Tests (1)
Microsoft.AspNetCore.Http.Extensions (5)
Microsoft.AspNetCore.Http.Results (2)
Microsoft.AspNetCore.Http.Tests (1)
Microsoft.AspNetCore.HttpLogging (8)
Microsoft.AspNetCore.HttpOverrides (4)
Microsoft.AspNetCore.HttpsPolicy (1)
Microsoft.AspNetCore.Identity.FunctionalTests (1)
Microsoft.AspNetCore.InternalTesting (1)
Microsoft.AspNetCore.Mvc.Core (3)
Microsoft.AspNetCore.Mvc.Core.TestCommon (2)
Microsoft.AspNetCore.Mvc.TagHelpers (3)
Microsoft.AspNetCore.Mvc.ViewFeatures (5)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (2)
Microsoft.AspNetCore.OpenApi (1)
Microsoft.AspNetCore.OutputCaching (4)
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (4)
Microsoft.AspNetCore.ResponseCaching (1)
Microsoft.AspNetCore.Routing (10)
Microsoft.AspNetCore.Routing.Microbenchmarks (2)
Microsoft.AspNetCore.Server.HttpSys (1)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (10)
Microsoft.AspNetCore.Server.IIS (5)
Microsoft.AspNetCore.Server.Kestrel.Core (30)
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 (18)
Microsoft.AspNetCore.SignalR.Client.Core (2)
Microsoft.AspNetCore.SignalR.Client.Tests (1)
Microsoft.AspNetCore.SignalR.Common (1)
Microsoft.AspNetCore.SignalR.Common.Tests (1)
Microsoft.AspNetCore.SignalR.Core (2)
Microsoft.AspNetCore.SignalR.Microbenchmarks (1)
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (2)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (1)
Microsoft.AspNetCore.SignalR.Specification.Tests (1)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (1)
Microsoft.AspNetCore.StaticAssets (1)
Microsoft.AspNetCore.StaticFiles (1)
Microsoft.AspNetCore.StaticFiles.FunctionalTests (1)
Microsoft.AspNetCore.TestHost (2)
Microsoft.AspNetCore.WebSockets (5)
Microsoft.AspNetCore.WebSockets.Tests (2)
Microsoft.AspNetCore.WebUtilities (18)
MultipartReaderStream.cs (9)
177var slice = buffer.AsSpan(offset, Math.Min(count, index));
197read = _innerStream.Read(buffer, offset, Math.Min(count, matchOffset - bufferedData.Offset));
208read = _innerStream.Read(buffer, offset, Math.Min(count, bufferedData.Count));
257var slice = buffer[..Math.Min(buffer.Length, index)];
280var slice = buffer[..Math.Min(buffer.Length, matchOffset - bufferedData.Offset)];
294read = _innerStream.Read(buffer.Span[..Math.Min(buffer.Length, bufferedData.Count)]);
325matchOffset = Math.Max(segment1.Offset, segment1.Offset + segment1.Count - matchBytes.Length);
352bufferSize = Math.Max(4096, bufferSize);
361bufferSize = Math.Max(4096, bufferSize);
Microsoft.AspNetCore.WebUtilities.Tests (4)
Microsoft.Build (53)
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 (9)
Microsoft.Build.Tasks.UnitTests (6)
Microsoft.Build.UnitTests.Shared (2)
Microsoft.Build.Utilities.Core (4)
Microsoft.CodeAnalysis (111)
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\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.CodeStyle (83)
src\Dependencies\Collections\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)
575LineColumnRule.IndentationOperations.Absolute => Math.Max(0, rule.Indentation),
577LineColumnRule.IndentationOperations.Given => (trivia2.RawKind == 0) ? this.Spaces : Math.Max(0, _indentation),
578LineColumnRule.IndentationOperations.Follow => Math.Max(0, lineColumnBeforeTrivia1.Column),
587LineColumnRule.SpaceOperations.Preserve => Math.Max(rule.Spaces, existingWhitespaceBetween.Spaces),
588LineColumnRule.SpaceOperations.Force => Math.Max(rule.Spaces, 0),
595var adjustedRuleLines = Math.Max(0, rule.Lines - GetTrailingLinesAtEndOfTrivia1(lineColumnAfterTrivia1));
597return (rule.LineOperation == LineColumnRule.LineOperations.Preserve) ? Math.Max(adjustedRuleLines, existingWhitespaceBetween.Lines) : adjustedRuleLines;
746return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
Microsoft.CodeAnalysis.Collections.Package (12)
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 (10)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (3)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Features (27)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (8)
EditAndContinue\SyntaxComparerTests.cs (8)
96Assert.Equal(0.67, Math.Round(distance, 2));
106Assert.Equal(0.33, Math.Round(distance, 2));
113Assert.Equal(0.33, Math.Round(distance, 2));
120Assert.Equal(1, Math.Round(distance, 2));
130Assert.Equal(0, Math.Round(distance, 2));
136Assert.Equal(0, Math.Round(distance, 2));
142Assert.Equal(0, Math.Round(distance, 2));
148Assert.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 (7)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
Microsoft.CodeAnalysis.EditorFeatures.Wpf (11)
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (8)
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (8)
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (6)
Microsoft.CodeAnalysis.Features (29)
Microsoft.CodeAnalysis.Features.Test.Utilities (1)
Microsoft.CodeAnalysis.InteractiveHost (4)
Microsoft.CodeAnalysis.LanguageServer.Protocol (12)
Microsoft.CodeAnalysis.Remote.ServiceHub (3)
Microsoft.CodeAnalysis.Scripting (7)
Microsoft.CodeAnalysis.Test.Utilities (10)
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\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)
575LineColumnRule.IndentationOperations.Absolute => Math.Max(0, rule.Indentation),
577LineColumnRule.IndentationOperations.Given => (trivia2.RawKind == 0) ? this.Spaces : Math.Max(0, _indentation),
578LineColumnRule.IndentationOperations.Follow => Math.Max(0, lineColumnBeforeTrivia1.Column),
587LineColumnRule.SpaceOperations.Preserve => Math.Max(rule.Spaces, existingWhitespaceBetween.Spaces),
588LineColumnRule.SpaceOperations.Force => Math.Max(rule.Spaces, 0),
595var adjustedRuleLines = Math.Max(0, rule.Lines - GetTrailingLinesAtEndOfTrivia1(lineColumnAfterTrivia1));
597return (rule.LineOperation == LineColumnRule.LineOperations.Preserve) ? Math.Max(adjustedRuleLines, existingWhitespaceBetween.Lines) : adjustedRuleLines;
746return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0);
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (24)
src\Dependencies\Collections\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.VersionTools (1)
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.Caching.Hybrid (2)
Microsoft.Extensions.Caching.StackExchangeRedis (1)
Microsoft.Extensions.DependencyInjection (3)
Microsoft.Extensions.DependencyModel (1)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (9)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (10)
Microsoft.Extensions.FileProviders.Physical (1)
Microsoft.Extensions.Http.Diagnostics (1)
Microsoft.Extensions.Identity.Core (2)
Microsoft.Extensions.Logging.Abstractions (2)
Microsoft.Extensions.Logging.Console (2)
Microsoft.Extensions.Logging.Generators (1)
Microsoft.Extensions.Options.SourceGeneration (1)
Microsoft.Extensions.Telemetry (4)
Microsoft.Gen.Logging (1)
Microsoft.Interop.SourceGeneration (4)
Microsoft.JSInterop (2)
Microsoft.Maui (60)
Layouts\LayoutExtensions.cs (10)
46 consumedWidth = Math.Min(bounds.Width, view.MaximumWidth);
50 var frameWidth = Math.Max(0, consumedWidth - margin.HorizontalThickness);
60 consumedHeight = Math.Min(bounds.Height, view.MaximumHeight);
64 var frameHeight = Math.Max(0, consumedHeight - margin.VerticalThickness);
84 desiredWidth = IsExplicitSet(view.Width) ? desiredWidth : Math.Min(bounds.Width, view.MaximumWidth);
121 desiredHeight = IsExplicitSet(view.Height) ? desiredHeight : Math.Min(bounds.Height, view.MaximumHeight);
189 size.Width = Math.Max(bounds.Width, size.Width);
194 size.Height = Math.Max(bounds.Height, size.Height);
225 bounds.Width = Math.Max(bounds.Width, presentedContent.DesiredSize.Width + padding.HorizontalThickness);
226 bounds.Height = Math.Max(bounds.Height, presentedContent.DesiredSize.Height + padding.VerticalThickness);
Microsoft.Maui.Controls (165)
LegacyLayouts\GridCalc.cs (33)
201 actualHeight = Math.Max(actualHeight, sizeRequest.Request.Height - assignedHeight - grid.RowSpacing * (GetRowSpan(child) - 1));
202 minimumHeight = Math.Max(minimumHeight, sizeRequest.Minimum.Height - assignedHeight - grid.RowSpacing * (GetRowSpan(child) - 1));
234 actualWidth = Math.Max(actualWidth, sizeRequest.Request.Width - assignedWidth - (GetColumnSpan(child) - 1) * grid.ColumnSpacing);
235 minimumWidth = Math.Max(minimumWidth, sizeRequest.Minimum.Width - assignedWidth - (GetColumnSpan(child) - 1) * grid.ColumnSpacing);
272 columnwWidthSum += Math.Max(0, c.ActualWidth);
284 rowHeightSum += Math.Max(0, r.ActualHeight);
317 double contractionNeeded = Math.Min(contractionSpace, Math.Max(currentSize.Width - targetWidth, 0));
325 double availableSpace = col.ActualWidth - Math.Max(col.MinimumWidth, 0);
352 double contractionNeeded = Math.Min(contractionSpace, Math.Max(currentSize.Height - targetHeight, 0));
394 starColumnWidth = Math.Min(column.ActualWidth, starColumnWidth);
411 double contractionNeeded = Math.Min(contractionSpace, Math.Max(request.Width - targetWidth, 0));
457 starRowHeight = Math.Min(row.ActualHeight, starRowHeight);
473 double contractionNeeded = Math.Min(contractionSpace, Math.Max(request.Height - targetHeight, 0));
500 lastRow = Math.Max(lastRow, GetRow(w) + GetRowSpan(w) - 1);
502 lastRow = Math.Max(lastRow, grid.RowDefinitions.Count - 1);
508 lastCol = Math.Max(lastCol, GetColumn(w) + GetColumnSpan(w) - 1);
510 lastCol = Math.Max(lastCol, grid.ColumnDefinitions.Count - 1);
605 starColWidth = Math.Max(starColWidth, GetUnassignedWidth(width, columnSpacing) / totalStarsWidth);
635 starRowHeight = Math.Max(starRowHeight, GetUnassignedHeight(height, rowSpacing) / totalStarsHeight);
677 actualWidth = Math.Max(actualWidth, sizeRequest.Request.Width - assignedWidth - columnSpacing);
678 minimumWidth = Math.Max(minimumWidth, sizeRequest.Minimum.Width - assignedWidth - columnSpacing);
697 starColRequestWidth = Math.Max(starColRequestWidth, col.ActualWidth / col.Width.Value);
698 starColMinWidth = Math.Max(starColMinWidth, col.MinimumWidth / col.Width.Value);
706 return Math.Max(widthConstraint / totalStarsWidth, starColMinWidth);
738 actualHeight = Math.Max(actualHeight, sizeRequest.Request.Height - assignedHeight - rowSpacing);
739 minimumHeight = Math.Max(minimumHeight, sizeRequest.Minimum.Height - assignedHeight - rowSpacing);
758 starRowRequestHeight = Math.Max(starRowRequestHeight, row.ActualHeight / row.Height.Value);
759 starRowMinHeight = Math.Max(starRowMinHeight, row.MinimumHeight / row.Height.Value);
767 return Math.Max(heightConstraint / totalStarsHeight, starRowMinHeight);
Shapes\Matrix.cs (24)
95 this *= CreateRotationRadians(angle * (Math.PI / 180.0));
102 this = CreateRotationRadians(angle * (Math.PI / 180.0)) * this;
109 this *= CreateRotationRadians(angle * (Math.PI / 180.0), centerX, centerY);
116 this = CreateRotationRadians(angle * (Math.PI / 180.0), centerX, centerY) * this;
148 this *= CreateSkewRadians(skewX * (Math.PI / 180.0),
149 skewY * (Math.PI / 180.0));
157 this = CreateSkewRadians(skewX * (Math.PI / 180.0),
158 skewY * (Math.PI / 180.0)) * this;
560 double sin = Math.Sin(angle);
561 double cos = Math.Cos(angle);
599 matrix.SetMatrix(1.0, Math.Tan(skewY),
600 Math.Tan(skewX), 1.0,
744 rect.X = Math.Min(Math.Min(point0.X, point1.X), Math.Min(point2.X, point3.X));
745 rect.Y = Math.Min(Math.Min(point0.Y, point1.Y), Math.Min(point2.Y, point3.Y));
747 rect.Width = Math.Max(Math.Max(point0.X, point1.X), Math.Max(point2.X, point3.X)) - rect.X;
748 rect.Height = Math.Max(Math.Max(point0.Y, point1.Y), Math.Max(point2.Y, point3.Y)) - rect.Y;
Microsoft.Maui.Controls.BindingSourceGen (1)
Microsoft.Maui.Controls.Compatibility (4)
Microsoft.Maui.Essentials (11)
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 (121)
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 (14)
Microsoft.ML.Tokenizers.Data.Tests (1)
Microsoft.ML.Tokenizers.Tests (10)
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 (6)
MSBuildTaskHost (3)
mscorlib (1)
netstandard (1)
PresentationBuildTasks (4)
PresentationCore (524)
MS\Internal\Ink\StrokeRenderer.cs (27)
85double delta = Math.Abs(GetAngleDeltaFromLast(strokeNode.PreviousPosition, strokeNode.Position, ref lastAngle));
105if ((Math.Min(prevArea, currArea) / Math.Max(prevArea, currArea)) <= 0.70d)
245double maxExtent = Math.Max(drawingAttributes.Height, drawingAttributes.Width);
246percentIntersect += Math.Min(4.99999d, ((maxExtent / 20d) * 5d));
514bool directionChangedOverAbsoluteThreshold = Math.Abs(delta) > 90d && Math.Abs(delta) < (360d - 90d);
515bool directionChangedOverOverlapThreshold = overlap && !(ignorePressure || strokeNode.PressureFactor == 1f) && Math.Abs(delta) > 30d && Math.Abs(delta) < (360d - 30d);
524if ((Math.Min(prevArea, currArea) / Math.Max(prevArea, currArea)) <= 0.90d)
829double intersectLeft = Math.Max(rect1.Left, rect2.Left);
830double intersectTop = Math.Max(rect1.Top, rect2.Top);
831double intersectWidth = Math.Max((double)(Math.Min(rect1.Right, rect2.Right) - intersectLeft), (double)0);
832double intersectHeight = Math.Max((double)(Math.Min(rect1.Bottom, rect2.Bottom) - intersectTop), (double)0);
842double minArea = Math.Min(rect1Area, rect2Area);
1045angle = Math.PI / 2.0;
1049angle = Math.PI * 3.0 / 2.0;
1060angle = Math.PI;
1067angle = Math.Atan(dy / dx) + Math.PI;
1071angle = Math.Atan(dy / dx) + (2 * Math.PI);
1075angle = Math.Atan(dy / dx);
1080angle = angle * 180 / Math.PI;
MS\Internal\Media3D\GeneralTransform2DTo3DTo2D.cs (19)
500if (!((Math.Max(visEdgeStart.X, visEdgeEnd.X) < Math.Min(uv1.X, uv2.X)) ||
501(Math.Min(visEdgeStart.X, visEdgeEnd.X) > Math.Max(uv1.X, uv2.X)) ||
502(Math.Max(visEdgeStart.Y, visEdgeEnd.Y) < Math.Min(uv1.Y, uv2.Y)) ||
503(Math.Min(visEdgeStart.Y, visEdgeEnd.Y) > Math.Max(uv1.Y, uv2.Y))))
604if (Math.Abs(visUV1.X - visUV2.X) > Math.Abs(visUV1.Y - visUV2.Y))
918if (!((Math.Max(visEdgeStart.X, visEdgeEnd.X) < Math.Min(uv1.X, uv2.X)) ||
919(Math.Min(visEdgeStart.X, visEdgeEnd.X) > Math.Max(uv1.X, uv2.X)) ||
920(Math.Max(visEdgeStart.Y, visEdgeEnd.Y) < Math.Min(uv1.Y, uv2.Y)) ||
921(Math.Min(visEdgeStart.Y, visEdgeEnd.Y) > Math.Max(uv1.Y, uv2.Y))))
1088closestIntersection = ((currClosest - edges[i]._p1Transformed).Length / Math.Sqrt(denom) *
MS\Internal\TextFormatting\LineServicesCallbacks.cs (14)
437lstTextMetrics.dvAscent = (int)Math.Round(typeface.Baseline(store.Pap.EmSize, Constants.DefaultIdealToReal, store.Settings.TextSource.PixelsPerDip, fullText.TextFormattingMode));
438lstTextMetrics.dvMultiLineHeight = (int)Math.Round(typeface.LineSpacing(store.Pap.EmSize, Constants.DefaultIdealToReal, store.Settings.TextSource.PixelsPerDip, fullText.TextFormattingMode));
696ulInfo.dvpFirstUnderlineOffset = (int)Math.Round(lsrun.EmSize * -underlinePositionInEm);
697ulInfo.dvpFirstUnderlineSize = (int)Math.Round(lsrun.EmSize * underlineThicknessInEm);
750stInfo.dvpLowerStrikethroughOffset = (int)Math.Round(lsrun.EmSize * strikeThroughPositionInEm);
751stInfo.dvpLowerStrikethroughSize = (int)Math.Round(lsrun.EmSize * strikeThroughThicknessInEm);
945int baselineTop = ptOrigin.y + (int)Math.Round(lsrun.EmSize * strikeThroughPositionInEm);
946int overlineTop = baselineTop - (lsrun.BaselineOffset - (int)Math.Round(lsrun.EmSize * strikeThroughThicknessInEm));
1252penThickness = Math.Abs(penThickness);
1328drawingPenThickness = drawingPenThickness / Math.Abs(unitValue);
1997int expandedBy = Math.Max(0, interWordAdjustTo - adjustedCharWidth);
2004pplsAdjustRight[0][i] = Math.Max(0, adjustedCharWidth - interWordAdjustTo);
2130pplsCompressionRight[0][igi + i] = Math.Max(0, glyphAdvance - interWordCompressTo);
2263int expandedBy = Math.Max(0, interWordExpandTo - glyphAdvance);
MS\Internal\TextFormatting\SimpleTextLine.cs (10)
289realHeight = Math.Max(realHeight, run.Height);
290realAscent = Math.Max(realAscent, run.Baseline);
291realDescent = Math.Max(realDescent, run.Height - run.Baseline);
326_height = formatter.IdealToReal((int)Math.Round(pap.DefaultTypeface.LineSpacing(pap.EmSize, Constants.DefaultIdealToReal, PixelsPerDip, _settings.TextFormattingMode)), PixelsPerDip);
327_baselineOffset = formatter.IdealToReal((int)Math.Round(pap.DefaultTypeface.Baseline(pap.EmSize, Constants.DefaultIdealToReal, PixelsPerDip, _settings.TextFormattingMode)), PixelsPerDip);
361_idealOffsetUnRounded = (int)Math.Round((paragraphWidth - idealWidthAtTrailing) * 0.5);
844int first = Math.Max(ich, dcp) + _cpFirst;
845int afterLast = Math.Min(ich + run.Length, dcp + textLength) + _cpFirst;
1212cpVisible = Math.Max(cpRunStart, cp);
1244cpVisible = Math.Min(cpRunEnd, cp);
MS\Internal\TextFormatting\TextStore.cs (16)
509int effectedRangeStart = Math.Max(cpFetched - offset, bounds[0].Position);
510int effectedRangeEnd = Math.Min(cpFetched - offset + runInfo.Length, bounds[bounds.Length - 1].Position);
520int currentRangeEnd = Math.Min(bounds[i].Position, effectedRangeEnd);
554currentPosition = Math.Max(currentPosition, bounds[i + 1].Position);
1122int runLength = Math.Min(span.length, cchToAdd - ichRun);
1210int first = limit - Math.Min(charRange.Length, limitCp - firstCp);
1293int spanLength = Math.Min(runInfoSpanRider.Length, textEffectsSpanRider.Length);
1294int ichEnd = Math.Min(ichRun + spanLength, cchUniform);
1564(int)Math.Round(realToIdeal * runInfo.TextRun.Properties.FontRenderingEmSize),
1719(int)Math.Round(realToIdeal * runInfo.TextRun.Properties.FontRenderingEmSize),
1958textTop = Math.Max(textTop, lsrun.BaselineOffset);
1959textBottom = Math.Max(textBottom, lsrun.Descent);
1979textBottom = Math.Max(textBottom, lsrun.Height + top);
1983textBottom = Math.Max(textBottom, lsrun.Height + textTop);
2047cellAscent = Math.Max(cellAscent, lsrun.BaselineOffset - move);
2048cellDescent = Math.Max(cellDescent, lsrun.Descent + move);
System\Windows\Input\Stylus\Wisp\WispTabletDevice.cs (12)
272Size mouseDragDefault = new Size(Math.Max(1, SafeSystemMetrics.DragDeltaX / 2),
273Math.Max(1, SafeSystemMetrics.DragDeltaY / 2));
274Size mouseDoubleTapDefault = new Size(Math.Max(1, SafeSystemMetrics.DoubleClickDeltaX / 2),
275Math.Max(1, SafeSystemMetrics.DoubleClickDeltaY / 2));
285_cancelSize = new Size((int)Math.Round((ScreenSize.Width * stylusLogic.CancelDelta) / dwXValue),
286(int)Math.Round((ScreenSize.Height * stylusLogic.CancelDelta) / dwYValue));
290_cancelSize.Width = Math.Max(mouseDragDefault.Width, _cancelSize.Width);
291_cancelSize.Height = Math.Max(mouseDragDefault.Height, _cancelSize.Height);
293_doubleTapSize = new Size((int)Math.Round((ScreenSize.Width * stylusLogic.DoubleTapDelta) / dwXValue),
294(int)Math.Round((ScreenSize.Height * stylusLogic.DoubleTapDelta) / dwYValue));
298_doubleTapSize.Width = Math.Max(mouseDoubleTapDefault.Width, _doubleTapSize.Width);
299_doubleTapSize.Height = Math.Max(mouseDoubleTapDefault.Height, _doubleTapSize.Height);
System\Windows\Media\FormattedText.cs (21)
328i = Math.Min(limit, i + formatRider.Length);
402i = Math.Min(limit, i + formatRider.Length);
457i = Math.Min(limit, i + formatRider.Length);
510i = Math.Min(limit, i + formatRider.Length);
569i = Math.Min(limit, i + formatRider.Length);
628i = Math.Min(limit, i + formatRider.Length);
680i = Math.Min(limit, i + formatRider.Length);
733i = Math.Min(limit, i + formatRider.Length);
786i = Math.Min(limit, i + formatRider.Length);
838i = Math.Min(limit, i + formatRider.Length);
979return _that._maxTextWidths[Math.Min(line, _that._maxTextWidths.Length - 1)];
1123Math.Min(textSourcePosition + line.Length - 1, _that._text.Length - 1)
1634int x0 = Math.Max(enumerator.Position, startIndex);
1635int x1 = Math.Min(enumerator.Position + enumerator.Length, startIndex + count);
1786accBlackBoxLeft = Math.Min(accBlackBoxLeft, blackBoxLeft);
1787accBlackBoxRight = Math.Max(accBlackBoxRight, blackBoxRight);
1788accBlackBoxBottom = Math.Max(accBlackBoxBottom, blackBoxBottom);
1789accBlackBoxTop = Math.Min(accBlackBoxTop, blackBoxTop);
1795metrics.Width = Math.Max(metrics.Width, currentLine.Width);
1796metrics.WidthIncludingTrailingWhitespace = Math.Max(metrics.WidthIncludingTrailingWhitespace, currentLine.WidthIncludingTrailingWhitespace);
1797lineStartOfLongestLine = Math.Min(lineStartOfLongestLine, currentLine.Start);
System\Windows\Media3D\Quaternion.cs (34)
70double angleInRadians = angleInDegrees * (Math.PI / 180.0);
74Vector3D v = (axisOfRotation / length) * Math.Sin(0.5 * angleInRadians);
78_w = Math.Cos(0.5 * angleInRadians);
142double msin = Math.Sqrt(_x*_x + _y*_y + _z*_z);
151double maxcoeff = Math.Max(Math.Abs(_x),Math.Max(Math.Abs(_y),Math.Abs(_z)));
155msin = Math.Sqrt(x*x + y*y + z*z);
161return Math.Atan2(msin,mcos) * (360.0 / Math.PI);
241double rmax = 1.0/Max(Math.Abs(_x),
242Math.Abs(_y),
243Math.Abs(_z),
244Math.Abs(_w));
252double normInverse = 1.0 / Math.Sqrt(norm2);
426double max = Math.Max(Math.Max(Math.Abs(_x),Math.Abs(_y)),
427Math.Max(Math.Abs(_z),Math.Abs(_w)));
434double smallLength = Math.Sqrt(x*x+y*y+z*z+w*w);
438return Math.Sqrt(norm2);
542double theta = t * Math.PI;
544scaleFrom = Math.Cos(theta);
545scaleTo = Math.Sin(theta);
550double omega = Math.Acos(cosOmega);
551double sinOmega = Math.Sqrt(1.0 - cosOmega*cosOmega);
552scaleFrom = Math.Sin((1.0 - t) * omega) / sinOmega;
553scaleTo = Math.Sin(t * omega) / sinOmega;
561double lengthOut = lengthFrom * Math.Pow(lengthTo/lengthFrom, t);
System\Windows\Media3D\Rect3D.cs (18)
77_x = Math.Min(point1._x, point2._x);
78_y = Math.Min(point1._y, point2._y);
79_z = Math.Min(point1._z, point2._z);
80_sizeX = Math.Max(point1._x, point2._x) - _x;
81_sizeY = Math.Max(point1._y, point2._y) - _y;
82_sizeZ = Math.Max(point1._z, point2._z) - _z;
418double x = Math.Max(_x, rect._x);
419double y = Math.Max(_y, rect._y);
420double z = Math.Max(_z, rect._z);
421_sizeX = Math.Min(_x + _sizeX, rect._x + rect._sizeX) - x;
422_sizeY = Math.Min(_y + _sizeY, rect._y + rect._sizeY) - y;
423_sizeZ = Math.Min(_z + _sizeZ, rect._z + rect._sizeZ) - z;
456double x = Math.Min(_x, rect._x);
457double y = Math.Min(_y, rect._y);
458double z = Math.Min(_z, rect._z);
459_sizeX = Math.Max(_x + _sizeX, rect._x + rect._sizeX) - x;
460_sizeY = Math.Max(_y + _sizeY, rect._y + rect._sizeY) - y;
461_sizeZ = Math.Max(_z + _sizeZ, rect._z + rect._sizeZ) - z;
PresentationFramework (1131)
MS\Internal\Documents\DocumentGrid.cs (18)
316if (Math.Abs(pageNumber - _firstVisiblePageNumber) > 1)
577double clippedHorizontalOffset = Math.Min(_horizontalOffset, ExtentWidth - ViewportWidth);
578clippedHorizontalOffset = Math.Max(clippedHorizontalOffset, 0.0);
620double clippedVerticalOffset = Math.Min(_verticalOffset, ExtentHeight - ViewportHeight);
621clippedVerticalOffset = Math.Max(clippedVerticalOffset, 0.0);
1217pageOffset = new Point(Math.Max(ViewportWidth, ExtentWidth) - (xOffset + pageSize.Width), yOffset);
1445visiblePages.Add(_childrenCollection[_firstPageVisualIndex + j - Math.Max(0, firstPage)]);
1599double centerWidth = Math.Max(ViewportWidth, ExtentWidth);
2222(int)Math.Floor(ViewportWidth /
2227maxColumns = Math.Min(maxColumns, _pageCache.PageCount);
2228maxColumns = Math.Min(maxColumns, DocumentViewerConstants.MaximumMaxPagesAcross);
2239int rows = (int)Math.Floor((double)(_pageCache.PageCount / columns));
2251double aspectDiff = Math.Abs(layoutAspect - viewportAspect);
2363newScale = Math.Max(newScale, CurrentMinimumScale);
2364newScale = Math.Min(newScale, DocumentViewerConstants.MaximumScale);
2433scaleFactor = Math.Min(compensatedViewportWidth / rowWidth, compensatedViewportHeight / rowHeight);
2462scaleFactor = Math.Min(compensatedViewportWidth / rowWidth,
2692Math.Max(0.0, (ExtentWidth - row.RowSize.Width) / 2.0) : 0.0;
MS\Internal\Documents\RowCache.cs (13)
311double roundedOffset = Math.Round(offset, _findOffsetPrecision);
319double rowOffset = Math.Round(_rowCache[i].VerticalOffset, _findOffsetPrecision);
320double rowHeight = Math.Round(_rowCache[i].RowSize.Height, _findOffsetPrecision);
411startOffset = Math.Round(startOffset, _findOffsetPrecision);
412endOffset = Math.Round(endOffset, _findOffsetPrecision);
418double rowOffset = Math.Round(_rowCache[i].VerticalOffset, _findOffsetPrecision);
470_extentWidth = Math.Max(currentRow.RowSize.Width, _extentWidth);
537_layoutColumns = Math.Min(_layoutColumns, PageCache.PageCount);
538_layoutColumns = Math.Max(1, _layoutColumns);
652pivotPage = Math.Max(0, PageCache.PageCount - columns);
976_extentWidth = Math.Max(newRow.RowSize.Width, _extentWidth);
1104_extentWidth = Math.Max(row.RowSize.Width, _extentWidth);
1372_rowSize.Height = Math.Max(pageSize.Height, _rowSize.Height);
MS\Internal\Documents\TextBoxView.cs (32)
501desiredSize.Width = Math.Min(constraint.Width, desiredSize.Width);
502desiredSize.Height = Math.Min(constraint.Height, desiredSize.Height);
695int startOffset = Math.Min(_lineMetrics[_lineMetrics.Count - 1].EndOffset, startPosition.Offset);
696int endOffset = Math.Min(_lineMetrics[_lineMetrics.Count - 1].EndOffset, endPosition.Offset);
703firstLineIndex = Math.Max(firstLineIndex, GetLineIndexFromOffset(startOffset, LogicalDirection.Forward));
704lastLineIndex = Math.Min(lastLineIndex, GetLineIndexFromOffset(endOffset, LogicalDirection.Backward));
773int nextLineIndex = Math.Max(0, Math.Min(_lineMetrics.Count - 1, lineIndex + count));
1789Math.Max(0, Math.Min(_scrollData.ExtentWidth - _scrollData.ViewportWidth, _scrollData.HorizontalOffset)),
1790Math.Max(0, Math.Min(_scrollData.ExtentHeight - _scrollData.ViewportHeight, _scrollData.VerticalOffset)));
1936int endOffset = Math.Min(range.StartIndex + range.PositionsAdded, _host.TextContainer.SymbolCount);
2047int startOffset = Math.Max(_lineMetrics[lineIndex].Offset, unclippedStartOffset);
2048int endOffset = Math.Min(_lineMetrics[lineIndex].EndOffset, unclippedEndOffset);
2143int startOffset = Math.Max(lineStartOffset, unclippedStartOffset);
2144int endOffset = Math.Min(lineEndOffset, unclippedEndOffset);
2203lastLineIndex = (int)Math.Ceiling((viewport.Y + viewport.Height) / _lineHeight) - 1;
2206firstLineIndex = Math.Max(0, Math.Min(firstLineIndex, _lineMetrics.Count - 1));
2207lastLineIndex = Math.Max(0, Math.Min(lastLineIndex, _lineMetrics.Count - 1));
2279desiredSize.Width = Math.Max(desiredSize.Width, line.Width);
2553int lastCoveredCharOffset = range.StartIndex + Math.Max(range.PositionsAdded, range.PositionsRemoved);
2649desiredSize.Width = Math.Max(desiredSize.Width, _lineMetrics[i].Width);
2712int lineIndex = Math.Max(oldLineVisualsIndex, firstLineIndex);
2713int lineCount = Math.Min(oldLastLineIndex, firstLineIndex + count - 1) - lineIndex + 1;
2807count = Math.Max(0, count);
2813count = Math.Min(count, _viewportLineVisuals.Count - start);
2991int rangeStart = Math.Max(viewportStart, selectionStart);
2992int rangeSize = Math.Min(viewportEnd, selectionEnd) - rangeStart;
3128padding = Math.Max(0, viewport.Height - _contentSize.Height);
MS\Internal\Ink\LassoHelper.cs (6)
108double step = Math.Sqrt(MinDistanceSquared / distanceSquared);
232&& DoubleUtil.GreaterThanOrClose(point.X, Math.Min(prevLassoPoint.X, lassoPoint.X))
233&& DoubleUtil.LessThanOrClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
242if (DoubleUtil.GreaterThanOrClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
248if ((0 == i) && DoubleUtil.AreClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
253else if (DoubleUtil.GreaterThanOrClose(point.X, Math.Min(prevLassoPoint.X, lassoPoint.X)))
MS\Internal\PtsHost\ContainerParagraph.cs (13)
523fsrcToFillSubtrack.u = Math.Max(Math.Min(fsrcToFillSubtrack.u, fsrcToFill.u + fsrcToFill.du - 1), fsrcToFill.u);
524fsrcToFillSubtrack.du = Math.Max(fsrcToFillSubtrack.du, 0);
537fsrcToFillSubtrack.v = Math.Max(Math.Min(fsrcToFillSubtrack.v, fsrcToFill.v + fsrcToFill.dv - 1), fsrcToFill.v);
538fsrcToFillSubtrack.dv = Math.Max(fsrcToFillSubtrack.dv, 0);
598dvrUsed = Math.Min(fsrcToFill.dv, dvrUsed);
681urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack);
682durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
811urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack);
812durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
MS\Internal\PtsHost\SubpageParagraph.cs (16)
177subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
186subpageHeight = Math.Max(1, subpageHeight - (marginTop + mbp.BPTop));
240dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
241fsrcToFill.du = Math.Max(fsrcToFill.du, fsbbox.fsrc.du + fsbbox.fsrc.u);
284fsbbox.fsrc.du = Math.Max(fsrcToFill.du - (mbp.MarginLeft + mbp.MarginRight), 0);
285fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
364subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
436dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
437durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u);
447fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0);
448fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
524subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
595dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
596durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u);
606fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0);
607fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
MS\Internal\PtsHost\TextParaClient.cs (19)
739int dcpStart = Math.Max(cpStartTextPointer, cpParagraphStart) - cpParagraphStart;
743int dcpEnd = Math.Min(cpEndTextPointer, cpParagraphEnd) - cpParagraphStart;
1408int countVisualsShiftBeforeChange = Math.Min(Math.Max(lineIndexToBeginRemoval - _lineIndexFirstVisual, 0), lineVisuals.Count);
1425int actualLinesToRemove = Math.Min(Math.Max(lineIndexToBeginRemoval - _lineIndexFirstVisual + cLinesToRemove, 0), lineVisuals.Count);
1453int actualLinesToRemove = Math.Min(cLinesToRemove, lineVisuals.Count - (lineIndexToBeginRemoval - _lineIndexFirstVisual));
1873int dcpRangeStartForThisLine = Math.Max(lineDesc.dcpFirst, dcpStart);
1876int cchRangeForThisLine = Math.Max(Math.Min(lineDesc.dcpLim, dcpEnd) - dcpRangeStartForThisLine, 1);
1983int dcpRangeStartForThisElem = Math.Max(elemDesc.dcpFirst, dcpStart);
1986int cchRangeForThisElem = Math.Max(Math.Min(elemDesc.dcpLim, dcpEnd) - dcpRangeStartForThisElem, 1);
2078lineRect.Width = Math.Max(lineVisual.WidthIncludingTrailingWhitespace, 0);
2189elementRect.Width = Math.Max(lineVisual.WidthIncludingTrailingWhitespace, 0);
3127line.GetGlyphRuns(glyphRuns, Math.Max(dcpStart, lineDesc.dcpFirst), Math.Min(dcpEnd, lineDesc.dcpLim));
3189line.GetGlyphRuns(glyphRuns, Math.Max(dcpStart, element.dcpFirst), Math.Min(dcpEnd, element.dcpLim));
System\Windows\Controls\Border.cs (12)
230Size childConstraint = new Size(Math.Max(0.0, constraint.Width - combined.Width),
231Math.Max(0.0, constraint.Height - combined.Height));
635Math.Max(0.0, rt.Width - thick.Left - thick.Right),
636Math.Max(0.0, rt.Height - thick.Top - thick.Bottom));
979LeftTop = Math.Max(0.0, radii.TopLeft - left);
980TopLeft = Math.Max(0.0, radii.TopLeft - top);
981TopRight = Math.Max(0.0, radii.TopRight - top);
982RightTop = Math.Max(0.0, radii.TopRight - right);
983RightBottom = Math.Max(0.0, radii.BottomRight - right);
984BottomRight = Math.Max(0.0, radii.BottomRight - bottom);
985BottomLeft = Math.Max(0.0, radii.BottomLeft - bottom);
986LeftBottom = Math.Max(0.0, radii.BottomLeft - left);
System\Windows\Controls\DataGrid.cs (18)
2647indexToSelect = Math.Min(Items.Count - numSelected - 1, indexToSelect);
5070int newRowCount = Math.Abs(endIndex - startIndex) + 1;
5071int newColumnCount = Math.Abs(endColumnIndex - startColumnIndex) + 1;
5089int previousStartIndex = Math.Min(startIndex, currentCellIndex);
5090int previousRowCount = Math.Abs(currentCellIndex - startIndex) + 1;
5091int previousStartColumnIndex = Math.Min(startColumnIndex, currentCellColumnIndex);
5092int previousColumnCount = Math.Abs(currentCellColumnIndex - startColumnIndex) + 1;
5132_selectedCells.AddRegion(Math.Min(startIndex, endIndex), Math.Min(startColumnIndex, endColumnIndex), newRowCount, newColumnCount);
5730nextDisplayIndex = Math.Max(0, InternalColumns.LastVisibleDisplayIndex);
5811nextRowIndex = Math.Max(0, Items.Count - 1);
5996index = Math.Max(0, Math.Min(numItems - 1, index + (shiftModifier ? -1 : 1)));
6139int jumpDistance = Math.Max(1, (int)scrollHost.ViewportHeight - 1);
6141targetIndex = Math.Max(0, Math.Min(targetIndex, Items.Count - 1));
6584distance = Math.Abs(pt.Y - cellBounds.Top);
6592distance = Math.Abs(pt.X - cellBounds.Left);
System\Windows\Controls\DataGridColumnCollection.cs (24)
749int columnCount = Math.Min(newFrozenCount, Count);
757int columnCount = Math.Min(oldFrozenCount, Count);
947availableStarSpace = Math.Max(0.0, availableStarSpace - columnMinWidth);
1231double displayValue = Math.Max(width.DesiredValue, minWidth);
1271double displayValue = Math.Min(width.DesiredValue, maxWidth);
1339TakeAwayWidthFromColumns(null, Math.Abs(availableSpaceChange), false, newTotalAvailableSpace);
1363column.SetWidthInternal(new DataGridLength(width.Value, width.UnitType, width.DesiredValue, Math.Min(width.DesiredValue, maxWidth)));
1385Math.Max(width.DisplayValue - nonRetrievableSpace, changedColumn.MinWidth)));
1457return Math.Max(availableSpace - requiredSpace, 0.0);
1668column.UpdateWidthForStarColumn(Math.Max(columnDesiredWidth, column.MinWidth), columnDesiredWidth, columnDesiredWidth / perStarWidth);
1697double columnExcessWidth = onlyShrinkToDesiredWidth ? width.DisplayValue - Math.Max(width.DesiredValue, column.MinWidth) : width.DisplayValue - column.MinWidth;
1782double maxColumnResizeWidth = expandBeyondDesiredWidth ? column.MaxWidth : Math.Min(width.DesiredValue, column.MaxWidth);
1917column.UpdateWidthForStarColumn(Math.Min(columnDesiredWidth, column.MaxWidth), columnDesiredWidth, columnDesiredWidth / perStarWidth);
2004double usedStarSpace = ComputeStarColumnWidths(Math.Min(expectedStarSpace, sumOfStarMaxWidths));
2005giveAwayWidth = Math.Max(usedStarSpace - expectedStarSpace, 0.0);
2075double lagWidth = Math.Min(width.DesiredValue, columnMaxWidth) - width.DisplayValue;
2106if (DoubleUtil.LessThan(width.DisplayValue, Math.Min(width.DesiredValue, column.MaxWidth)))
2134giveAwayWidth -= Math.Min(contributingSpace, giveAwayWidth);
2141giveAwayWidth = Math.Min(giveAwayWidth, Math.Max(0d, totalSpace - usedSpace));
2188return Math.Min(usedSpace - totalAvailableWidth, takeAwayWidth);
2196takeAwayWidth = Math.Max(0.0, takeAwayWidth - unusedSpace);
2267double usedStarSpace = ComputeStarColumnWidths(Math.Max(expectedStarSpace, sumOfStarMinWidths));
2268takeAwayWidth = Math.Max(usedStarSpace - expectedStarSpace, 0.0);
System\Windows\Controls\DockPanel.cs (10)
220childConstraint = new Size(Math.Max(0.0, constraint.Width - accumulatedWidth),
221Math.Max(0.0, constraint.Height - accumulatedHeight));
241parentHeight = Math.Max(parentHeight, accumulatedHeight + childDesiredSize.Height);
247parentWidth = Math.Max(parentWidth, accumulatedWidth + childDesiredSize.Width);
254parentWidth = Math.Max(parentWidth, accumulatedWidth);
255parentHeight = Math.Max(parentHeight, accumulatedHeight);
285Math.Max(0.0, arrangeSize.Width - (accumulatedLeft + accumulatedRight)),
286Math.Max(0.0, arrangeSize.Height - (accumulatedTop + accumulatedBottom)) );
299rcChild.X = Math.Max(0.0, arrangeSize.Width - accumulatedRight);
310rcChild.Y = Math.Max(0.0, arrangeSize.Height - accumulatedBottom);
System\Windows\Controls\FlowDocumentScrollViewer.cs (8)
589Math.Max(ia.OriginWidth, pagePadding.Left),
590Math.Max(ia.OriginHeight, pagePadding.Top),
591Math.Max(ia.MediaSizeWidth - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right),
592Math.Max(ia.MediaSizeHeight - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom));
631Zoom = Math.Min(Zoom + ZoomIncrement, MaxZoom);
643Zoom = Math.Max(Zoom - ZoomIncrement, MinZoom);
709SetCurrentValueInternal(ZoomProperty, Math.Min(Zoom + ZoomIncrement, MaxZoom));
713SetCurrentValueInternal(ZoomProperty, Math.Max(Zoom - ZoomIncrement, MinZoom));
System\Windows\Controls\Grid.cs (69)
371gridDesiredSize.Width = Math.Max(gridDesiredSize.Width, child.DesiredSize.Width);
372gridDesiredSize.Height = Math.Max(gridDesiredSize.Height, child.DesiredSize.Height);
908cell.ColumnIndex = Math.Min(GetColumn(child), DefinitionsU.Length - 1);
911cell.RowIndex = Math.Min(GetRow(child), DefinitionsV.Length - 1);
916cell.ColumnSpan = Math.Min(GetColumnSpan(child), DefinitionsU.Length - cell.ColumnIndex);
920cell.RowSpan = Math.Min(GetRowSpan(child), DefinitionsV.Length - cell.RowIndex);
1097userMinSize = Math.Max(userMinSize, Math.Min(userSize, userMaxSize));
1121definitions[i].MeasureSize = Math.Max(userMinSize, Math.Min(userSize, userMaxSize));
1221DefinitionsU[PrivateCells[i].ColumnIndex].UpdateMinSize(Math.Min(children[i].DesiredSize.Width, DefinitionsU[PrivateCells[i].ColumnIndex].UserMaxSize));
1238DefinitionsV[PrivateCells[i].RowIndex].UpdateMinSize(Math.Min(children[i].DesiredSize.Height, DefinitionsV[PrivateCells[i].RowIndex].UserMaxSize));
1459double maxSize = Math.Max(definitions[i].UserMaxSize, minSize);
1511double newMinSize = Math.Min(sizeToDistribute / (count - i), tempDefinitions[i].PreferredSize);
1541tempDefinitions[i].UpdateMinSize(Math.Min(newMinSize, tempDefinitions[i].SizeCache));
1552tempDefinitions[i].UpdateMinSize(Math.Min(newMinSize, tempDefinitions[i].SizeCache));
1663starValue = Math.Min(starValue, c_starClip);
1667double maxSize = Math.Max(definitions[i].MinSize, definitions[i].UserMaxSize);
1668maxSize = Math.Min(maxSize, c_starClip);
1706double userSize = Math.Max(availableSize - takenSize, 0.0) * (starValue / tempDefinitions[i].SizeCache);
1707resolvedSize = Math.Min(userSize, tempDefinitions[i].UserMaxSize);
1708resolvedSize = Math.Max(tempDefinitions[i].MinSize, resolvedSize);
1769double power = Math.Floor(Math.Log(Double.MaxValue / maxStar / starCount, 2.0));
1772scale = Math.Pow(2.0, power - 4.0); // -4 is just for paranoia
1820double effectiveMaxSize = Math.Max(def.MinSize, def.UserMaxSize);
1892resolvedSize = Math.Max(resolvedDef.MinSize, resolvedDef.UserMaxSize);
2010double resolvedSize = (def.MeasureSize > 0.0) ? Math.Max(availableSize - takenSize, 0.0) * (def.MeasureSize / def.SizeCache) : 0.0;
2013resolvedSize = Math.Min(resolvedSize, def.UserMaxSize);
2014resolvedSize = Math.Max(def.MinSize, resolvedSize);
2103starValue = Math.Min(starValue, c_starClip);
2107double maxSize = Math.Max(definitions[i].MinSizeForArrange, definitions[i].UserMaxSize);
2108maxSize = Math.Min(maxSize, c_starClip);
2148definitions[i].SizeCache = Math.Max(definitions[i].MinSizeForArrange, Math.Min(userSize, userMaxSize));
2193double userSize = Math.Max(finalSize - allPreferredArrangeSize, 0.0) * (starValue / definitions[definitionIndices[i]].SizeCache);
2194resolvedSize = Math.Min(userSize, definitions[definitionIndices[i]].UserMaxSize);
2195resolvedSize = Math.Max(definitions[definitionIndices[i]].MinSizeForArrange, resolvedSize);
2220final = Math.Max(final, definitions[definitionIndex].MinSizeForArrange);
2221final = Math.Min(final, definitions[definitionIndex].SizeCache);
2227final = Math.Max(final, definitions[definitionIndex].MinSizeForArrange);
2228final = Math.Min(final, definitions[definitionIndex].SizeCache);
2261final = Math.Max(final, definition.MinSizeForArrange);
2277final = Math.Max(final, definition.MinSizeForArrange);
2348double power = Math.Floor(Math.Log(Double.MaxValue / maxStar / starCount, 2.0));
2351scale = Math.Pow(2.0, power - 4.0); // -4 is just for paranoia
2395double effectiveMaxSize = Math.Max(def.MinSizeForArrange, def.UserMaxSize);
2434def.SizeCache = Math.Max(def.MinSizeForArrange, Math.Min(userSize, userMaxSize));
2503resolvedSize = Math.Max(resolvedDef.MinSizeForArrange, resolvedDef.UserMaxSize);
2635double resolvedSize = (def.MeasureSize > 0.0) ? Math.Max(finalSize - takenSize, 0.0) * (def.MeasureSize / def.SizeCache) : 0.0;
2638resolvedSize = Math.Min(resolvedSize, def.UserMaxSize);
2639resolvedSize = Math.Max(def.MinSizeForArrange, resolvedSize);
2730final = Math.Max(final, definition.MinSizeForArrange);
2746final = Math.Max(final, definition.MinSizeForArrange);
2788double minPower = Math.Floor(Math.Log(minRatio, 2.0));
2789double maxPower = Math.Floor(Math.Log(maxRatio, 2.0));
2790double f = Math.Pow(2.0, Math.Floor((minPower + maxPower) / 2.0));
2869Array.Clear(extData.TempDefinitions, 0, Math.Max(DefinitionsU.Length, DefinitionsV.Length));
3074int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length) * 2;
3107int requiredLength = Math.Max(Math.Max(DefinitionsU.Length, DefinitionsV.Length), 1) * 2;
3125int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length);
3217return (Math.Abs(d) < c_epsilon);
3228return (Math.Abs(d1 - d2) < c_epsilon);
System\Windows\Controls\GridSplitter.cs (13)
498_resizeData.SplitterLength = Math.Min(ActualWidth, ActualHeight);
650horizontalChange = Math.Round(horizontalChange / dragIncrement) * dragIncrement;
651verticalChange = Math.Round(verticalChange / dragIncrement) * dragIncrement;
658_resizeData.Adorner.OffsetX = Math.Min(Math.Max(horizontalChange, _resizeData.MinChange), _resizeData.MaxChange);
662_resizeData.Adorner.OffsetY = Math.Min(Math.Max(verticalChange, _resizeData.MinChange), _resizeData.MaxChange);
796definition1Min = Math.Max(definition1Min, _resizeData.SplitterLength);
800definition2Min = Math.Max(definition2Min, _resizeData.SplitterLength);
806minDelta = -Math.Min(definition1Len - definition1Min, definition2Max - definition2Len);
807maxDelta = Math.Min(definition1Max - definition1Len, definition2Len - definition2Min);
915delta = Math.Min(Math.Max(delta, min), max);
System\Windows\Controls\GridViewHeaderRowPresenter.cs (8)
259double childConstraintWidth = Math.Max(0.0, constraint.Width - accumulatedWidth);
281childConstraintWidth = Math.Min(childConstraintWidth, column.DesiredWidth);
289childConstraintWidth = Math.Min(childConstraintWidth, column.Width);
296maxHeight = Math.Max(maxHeight, child.DesiredSize.Height);
303maxHeight = Math.Max(maxHeight, _paddingHeader.DesiredSize.Height);
352double childArrangeWidth = Math.Min(remainingWidth, ((column.State == ColumnMeasureState.SpecificWidth) ? column.Width : column.DesiredWidth));
386rect = new Rect(accumulatedWidth, 0.0, Math.Max(remainingWidth, 0.0), arrangeSize.Height);
1244return (DoubleUtil.GreaterThan(Math.Abs(currentPos.X - originalPos.X), c_thresholdX));
System\Windows\Controls\Primitives\DataGridColumnHeadersPresenter.cs (10)
117desiredSize.Width = Math.Max(desiredSize.Width, indicatorSize.Width);
118desiredSize.Height = Math.Max(desiredSize.Height, indicatorSize.Height);
125desiredSize.Width = Math.Max(desiredSize.Width, indicatorSize.Width);
126desiredSize.Height = Math.Max(desiredSize.Height, indicatorSize.Height);
129desiredSize.Width = Math.Min(availableSize.Width, desiredSize.Width);
149childRect.Width = Math.Max(finalSize.Width, dataGrid.CellsPanelActualWidth);
644return DoubleUtil.GreaterThan(Math.Abs(currentPos.X - originalPos.X), SystemParameters.MinimumHorizontalDragDistance);
693height = Math.Max(_draggingSrcColumnHeader.RenderSize.Height, _columnHeaderDragIndicator.Height);
917columnEstimatedWidth = Math.Max(averageColumnWidth, column.MinWidth);
918columnEstimatedWidth = Math.Min(columnEstimatedWidth, column.MaxWidth);
System\Windows\Controls\Primitives\Popup.cs (26)
2102if (Math.Abs(score - childArea) < Tolerance)
2128if (Math.Abs(intersection.Width - childBounds.Width) > Tolerance ||
2129Math.Abs(intersection.Height - childBounds.Height) > Tolerance)
2143if (!IsTransparent || double.IsNaN(horizontalAxis.Y) || Math.Abs(horizontalAxis.Y) < Tolerance)
2155else if (IsTransparent && Math.Abs(horizontalAxis.X) < Tolerance)
2178if (!IsTransparent || double.IsNaN(verticalAxis.X) || Math.Abs(verticalAxis.X) < Tolerance)
2189else if (IsTransparent && Math.Abs(verticalAxis.Y) < Tolerance)
2244if (!IsTransparent || double.IsNaN(verticalAxis.X) || Math.Abs(verticalAxis.X) < Tolerance)
2246limitSize.Height = Math.Max(0.0, Math.Max(screenBounds.Bottom - targetBounds.Bottom, targetBounds.Top - screenBounds.Top));
2248else if (IsTransparent && Math.Abs(verticalAxis.Y) < Tolerance)
2250limitSize.Width = Math.Max(0.0, Math.Max(screenBounds.Right - targetBounds.Right, targetBounds.Left - screenBounds.Left));
2266if (!IsTransparent || double.IsNaN(horizontalAxis.X) || Math.Abs(horizontalAxis.Y) < Tolerance)
2268limitSize.Width = Math.Max(0.0, Math.Max(screenBounds.Right - targetBounds.Right, targetBounds.Left - screenBounds.Left));
2270else if (IsTransparent && Math.Abs(horizontalAxis.X) < Tolerance)
2272limitSize.Height = Math.Max(0.0, Math.Max(screenBounds.Bottom - targetBounds.Bottom, targetBounds.Top - screenBounds.Top));
2622desiredSize.Width = Math.Min(desiredSize.Width, screenBounds.Width);
2623desiredSize.Width = Math.Min(desiredSize.Width, limitSize.Width);
2627desiredSize.Height = Math.Min(desiredSize.Height, screenBounds.Height);
2628desiredSize.Height = Math.Min(desiredSize.Height, maxHeight);
2629desiredSize.Height = Math.Min(desiredSize.Height, limitSize.Height);
2701return new Rect(mousePoint.x, mousePoint.y - 1, Math.Max(0, cursorWidth - hotX), Math.Max(0, cursorHeight - hotY + 2));
System\Windows\Controls\ScrollViewer.cs (17)
401get { return Math.Max(0.0, ExtentWidth - ViewportWidth); }
409get { return Math.Max(0.0, ExtentHeight - ViewportHeight); }
1749DoubleUtil.LessThan(Math.Abs(unusedX), PanningInfo.PreFeedbackTranslationX))
1757DoubleUtil.LessThan(Math.Abs(unusedY), PanningInfo.PreFeedbackTranslationY))
1802double newUnused = Math.Max(unused + delta, 0);
1811double newUnused = Math.Min(unused + delta, 0);
1822Math.Round(PanningRatio * cumulativeTranslation / _panningInfo.DeltaPerHorizontalOffet));
1832Math.Round(PanningRatio * cumulativeTranslation / _panningInfo.DeltaPerVerticalOffset));
1845if (Math.Abs(Environment.TickCount - _panningInfo.InertiaBoundaryBeginTimestamp) < PanningInfo.InertiaBoundryMinimumTicks)
1850return (DoubleUtil.GreaterThanOrClose(Math.Abs(_panningInfo.UnusedTranslation.X), PanningInfo.MaxInertiaBoundaryTranslation) ||
1851DoubleUtil.GreaterThanOrClose(Math.Abs(_panningInfo.UnusedTranslation.Y), PanningInfo.MaxInertiaBoundaryTranslation));
1870bool validX = (DoubleUtil.GreaterThan(Math.Abs(translation.X), PanningInfo.PrePanTranslation));
1871bool validY = (DoubleUtil.GreaterThan(Math.Abs(translation.Y), PanningInfo.PrePanTranslation));
1881bool biggerX = (DoubleUtil.GreaterThanOrClose(Math.Abs(translation.X), Math.Abs(translation.Y)));
1894bool biggerY = (DoubleUtil.GreaterThanOrClose(Math.Abs(translation.Y), Math.Abs(translation.X)));
System\Windows\Controls\SinglePageViewer.cs (6)
701Math.Max(ia.OriginWidth, pagePadding.Left),
702Math.Max(ia.OriginHeight, pagePadding.Top),
703Math.Max(ia.MediaSizeWidth - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right),
704Math.Max(ia.MediaSizeHeight - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom));
742SetCurrentValueInternal(ZoomProperty, Math.Min(Zoom + ZoomIncrement, MaxZoom));
754SetCurrentValueInternal(ZoomProperty, Math.Max(Zoom - ZoomIncrement, MinZoom));
System\Windows\Controls\Slider.cs (15)
1007valueToSize = Math.Max(0.0, (trackSize.Width - thumbSize.Width) / range);
1013Canvas.SetLeft(rangeElement, (thumbSize.Width * 0.5) + Math.Max(Maximum - SelectionEnd, 0) * valueToSize);
1017Canvas.SetLeft(rangeElement, (thumbSize.Width * 0.5) + Math.Max(SelectionStart - Minimum, 0) * valueToSize);
1029valueToSize = Math.Max(0.0, (trackSize.Height - thumbSize.Height) / range);
1035Canvas.SetTop(rangeElement, (thumbSize.Height * 0.5) + Math.Max(SelectionStart - Minimum, 0) * valueToSize);
1039Canvas.SetTop(rangeElement, (thumbSize.Height * 0.5) + Math.Max(Maximum - SelectionEnd,0) * valueToSize);
1072valueToSize = Math.Max(0.0, (trackSize.Width - thumbSize.Width) / range);
1096valueToSize = Math.Max(0.0, (trackSize.Height - thumbSize.Height) / range);
1204previous = Minimum + (Math.Round(((value - Minimum) / TickFrequency)) * TickFrequency);
1205next = Math.Min(Maximum, previous + TickFrequency);
1225double next = SnapToTick(Math.Max(this.Minimum, Math.Min(this.Maximum, value + direction)));
1263double tickNumber = Math.Round((value - Minimum) / TickFrequency);
1424this.SetCurrentValueInternal(ValueProperty, Math.Max(this.Minimum, Math.Min(this.Maximum, snappedValue)));
System\Windows\Controls\Stack.cs (15)
598stackDesiredSize.Height = Math.Max(stackDesiredSize.Height, childDesiredSize.Height);
603stackDesiredSize.Width = Math.Max(stackDesiredSize.Width, childDesiredSize.Width);
663offset.Y = Math.Max(0, Math.Min(offset.Y, extent.Height - viewport.Height));
671offset.X = Math.Max(0, Math.Min(offset.X, extent.Width - viewport.Width));
676stackDesiredSize.Width = Math.Min(stackDesiredSize.Width, constraint.Width);
677stackDesiredSize.Height = Math.Min(stackDesiredSize.Height, constraint.Height);
755rcChild.Height = Math.Max(arrangeSize.Height, child.DesiredSize.Height);
762rcChild.Width = Math.Max(arrangeSize.Width, child.DesiredSize.Width);
896double left = Math.Max(targetRectOffset, minPhysicalOffset);
897targetRectSize = Math.Max(Math.Min(targetRectSize + targetRectOffset, minPhysicalOffset + viewportSize) - left, 0);
995iNewOffset = Math.Max(Math.Min(numberOfItems - 1, iNewOffset), 0);
System\Windows\Controls\TextBlock.cs (12)
1265Size contentSize = new Size(Math.Max(0.0, constraint.Width - (padding.Left + padding.Right)),
1266Math.Max(0.0, constraint.Height - (padding.Top + padding.Bottom)));
1305desiredSize.Width = Math.Max(desiredSize.Width, line.GetCollapsedWidth());
1531double contentBottom = Math.Max(0.0, RenderSize.Height - Padding.Bottom);
1968Size contentSize = new Size(Math.Max(0.0, _referenceSize.Width - (padding.Left + padding.Right)),
1969Math.Max(0.0, _referenceSize.Height - (padding.Top + padding.Bottom)));
2321int dcpStart = Math.Max(dcpLineStart, dcpPositionStart);
2322int dcpEnd = Math.Min(dcpLineEnd, dcpPositionEnd);
3106Size contentSize = new Size(Math.Max(0.0, computedSize.Width - (padding.Left + padding.Right)),
3107Math.Max(0.0, computedSize.Height - (padding.Top + padding.Bottom)));
3156double contentBottom = Math.Max(0.0, RenderSize.Height - Padding.Bottom);
3186width = Math.Max(0.0, width - paddingWidth);
System\Windows\Controls\VirtualizedCellInfoCollection.cs (12)
609int left = Math.Max(Left, region.Left);
610int top = Math.Max(Top, region.Top);
611int right = Math.Min(Right, region.Right);
612int bottom = Math.Min(Bottom, region.Bottom);
682Left = Math.Min(Left, region.Left);
683Top = Math.Min(Top, region.Top);
684Right = Math.Max(prevRight, region.Right);
685Bottom = Math.Max(prevBottom, region.Bottom);
725int top = Math.Max(Top, region.Top);
726int bottom = Math.Min(Bottom, region.Bottom);
733int top = Math.Max(Top, region.Top);
734int bottom = Math.Min(Bottom, region.Bottom);
System\Windows\Controls\VirtualizingStackPanel.cs (185)
511double delta = Math.Abs(scrollX - oldViewportOffset.X);
524_scrollData._offset.X = Math.Floor(_scrollData._offset.X);
525_scrollData._computedOffset.X = Math.Floor(_scrollData._computedOffset.X);
639double delta = Math.Abs(scrollY - oldViewportOffset.Y);
652_scrollData._offset.Y = Math.Floor(_scrollData._offset.Y);
653_scrollData._computedOffset.Y = Math.Floor(_scrollData._computedOffset.Y);
2331double factor = Math.Min(1.0, isHorizontal ? viewport.Width / extendedViewport.Width : viewport.Height / extendedViewport.Height);
2332int calcItemsInViewportCount = (int)Math.Ceiling(factor * _itemsInExtendedViewportCount);
2333excludeCount = Math.Max(excludeCount,
2627double spanBeforeViewport = Math.Max(isHorizontal ? viewport.X : viewport.Y, 0.0);
2684_firstItemInExtendedViewportIndex = Math.Max(_firstItemInExtendedViewportIndex - 1, 0);
2686_firstItemInExtendedViewportChildIndex = Math.Max(_firstItemInExtendedViewportChildIndex, 0);
3384arrangeLength = Math.Max(isHorizontal ? arrangeSize.Height : arrangeSize.Width, arrangeLength);
4762pixelSizeBeforeViewport = Math.Max(pixelSizeBeforeViewport, Math.Abs(_viewport.X - _extendedViewport.X));
4766logicalSizeBeforeViewport = Math.Max(logicalSizeBeforeViewport, Math.Abs(_viewport.X - _extendedViewport.X));
4798extendedViewport.Width = Math.Max(extendedViewport.Width + extendedViewport.X, 0.0);
4809extendedViewport.Width = Math.Max(_scrollData._extent.Width - extendedViewport.X, 0.0);
4838extendedViewport.Width = Math.Max(extendedViewport.Width / approxSizeOfLogicalUnit + extendedViewport.X, 0.0) * approxSizeOfLogicalUnit;
4849extendedViewport.Width = Math.Max(_scrollData._extent.Width - extendedViewport.X, 0.0) * approxSizeOfLogicalUnit;
4878pixelSizeBeforeViewport = Math.Max(pixelSizeBeforeViewport, Math.Abs(_viewport.Y - _extendedViewport.Y));
4882logicalSizeBeforeViewport = Math.Max(logicalSizeBeforeViewport, Math.Abs(_viewport.Y - _extendedViewport.Y));
4914extendedViewport.Height = Math.Max(extendedViewport.Height + extendedViewport.Y, 0.0);
4925extendedViewport.Height = Math.Max(_scrollData._extent.Height - extendedViewport.Y, 0.0);
4954extendedViewport.Height = Math.Max(extendedViewport.Height / approxSizeOfLogicalUnit + extendedViewport.Y, 0.0) * approxSizeOfLogicalUnit;
4965extendedViewport.Height = Math.Max(_scrollData._extent.Height - extendedViewport.Y, 0.0) * approxSizeOfLogicalUnit;
4977double factor = Math.Max(1.0, isHorizontal ? extendedViewport.Width / viewport.Width : extendedViewport.Height / viewport.Height);
4978int calcItemsInExtendedViewportCount = (int)Math.Ceiling(factor * _actualItemsInExtendedViewportCount);
4979itemsInExtendedViewportCount = Math.Max(calcItemsInExtendedViewportCount, itemsInExtendedViewportCount);
5090viewport.Width = Math.Max(viewport.Width - sizeAfterStartViewportEdge, 0);
5094cacheBeforeSize = Math.Max(cacheBeforeSize - sizeBeforeStartViewportEdge, 0);
5098cacheBeforeSize = Math.Max(cacheBeforeSize - Math.Floor(logicalSize.Width * sizeBeforeStartViewportEdge / pixelSize.Width), 0);
5125viewport.Width = Math.Max(0, parentViewport.Width - pixelSize.Width);
5140cacheAfterSize = Math.Max(cacheAfterSize - sizeAfterEndViewportEdge, 0);
5144cacheAfterSize = Math.Max(cacheAfterSize - Math.Floor(logicalSize.Width * sizeAfterEndViewportEdge / pixelSize.Width), 0);
5156cacheAfterSize = Math.Max(cacheAfterSize - pixelSize.Width, 0);
5160cacheAfterSize = Math.Max(cacheAfterSize - logicalSize.Width, 0);
5189viewport.Height = Math.Max(viewport.Height - sizeAfterStartViewportEdge, 0);
5193cacheBeforeSize = Math.Max(cacheBeforeSize - sizeBeforeStartViewportEdge, 0);
5197cacheBeforeSize = Math.Max(cacheBeforeSize - Math.Floor(logicalSize.Height * sizeBeforeStartViewportEdge / pixelSize.Height), 0);
5224viewport.Height = Math.Max(0, parentViewport.Height - pixelSize.Height);
5239cacheAfterSize = Math.Max(cacheAfterSize - sizeAfterEndViewportEdge, 0);
5243cacheAfterSize = Math.Max(cacheAfterSize - Math.Floor(logicalSize.Height * sizeAfterEndViewportEdge / pixelSize.Height), 0);
5255cacheAfterSize = Math.Max(cacheAfterSize - pixelSize.Height, 0);
5259cacheAfterSize = Math.Max(cacheAfterSize - logicalSize.Height, 0);
5324cacheBeforeSize = Math.Max(0, cacheBeforeSize - parentViewport.X);
5329viewport.Width = Math.Max(0, viewport.Width + viewport.X);
5349cacheBeforeSize = Math.Max(0, cacheBeforeSize - inset.Right);
5353cacheBeforeSize = Math.Max(0, cacheBeforeSize - 1);
5368viewport.Width = Math.Max(0, viewport.Width - inset.Left);
5379cacheAfterSize = Math.Max(0, cacheAfterSize - (inset.Left - viewport.Width));
5396cacheAfterSize = Math.Max(0, cacheAfterSize - inset.Left);
5400cacheAfterSize = Math.Max(0, cacheAfterSize - 1);
5427cacheBeforeSize = Math.Max(0, cacheBeforeSize - parentViewport.Y);
5432viewport.Height = Math.Max(0, viewport.Height + viewport.Y);
5452cacheBeforeSize = Math.Max(0, cacheBeforeSize - inset.Bottom);
5456cacheBeforeSize = Math.Max(0, cacheBeforeSize - 1);
5471viewport.Height = Math.Max(0, viewport.Height - inset.Top);
5482cacheAfterSize = Math.Max(0, cacheAfterSize - (inset.Top - viewport.Height));
5499cacheAfterSize = Math.Max(0, cacheAfterSize - inset.Top);
5503cacheAfterSize = Math.Max(0, cacheAfterSize - 1);
5559double spanBeforeViewport = Math.Max(isHorizontal ? viewport.X : viewport.Y, 0.0);
5571firstItemInViewportIndex = (int)Math.Floor(spanBeforeViewport / childSize);
6547double eps = (Math.Abs(value1) + Math.Abs(value2)) * Tolerance;
6728childViewport.X = Math.Min(childViewport.X, 0) -
6731childViewport.Width = Math.Max(childViewport.Width - stackPixelSizeInViewport.Width, 0.0);
6736childViewport.Width = Math.Max(childViewport.Width - stackPixelSizeInViewport.Width, 0.0);
6744Math.Max(parentCacheSize.CacheBeforeViewport - stackLogicalSizeInCacheBeforeViewport.Width, 0.0),
6747Math.Max(parentCacheSize.CacheAfterViewport - stackLogicalSizeInCacheAfterViewport.Width, 0.0));
6755Math.Max(parentCacheSize.CacheBeforeViewport - stackPixelSizeInCacheBeforeViewport.Width, 0.0),
6758Math.Max(parentCacheSize.CacheAfterViewport - stackPixelSizeInCacheAfterViewport.Width, 0.0));
6773childViewport.Y = Math.Min(childViewport.Y, 0) -
6777childViewport.Height = Math.Max(childViewport.Height - stackPixelSizeInViewport.Height, 0.0);
6782childViewport.Height = Math.Max(childViewport.Height - stackPixelSizeInViewport.Height, 0.0);
6790Math.Max(parentCacheSize.CacheBeforeViewport - stackLogicalSizeInCacheBeforeViewport.Height, 0.0),
6793Math.Max(parentCacheSize.CacheAfterViewport - stackLogicalSizeInCacheAfterViewport.Height, 0.0));
6801Math.Max(parentCacheSize.CacheBeforeViewport - stackPixelSizeInCacheBeforeViewport.Height, 0.0),
6804Math.Max(parentCacheSize.CacheAfterViewport - stackPixelSizeInCacheAfterViewport.Height, 0.0));
6909childLogicalSize.Width = Math.Max(itemDesiredSizes.LogicalSize.Width, logicalHeaderSize.Width);
6914childLogicalSize.Height = Math.Max(itemDesiredSizes.LogicalSize.Height, logicalHeaderSize.Height);
7113Size frontPixelSize = isHorizontal ? new Size(Math.Max(inset.Left,0), childDesiredSize.Height)
7114: new Size(childDesiredSize.Width, Math.Max(inset.Top, 0));
7127Size backPixelSize = isHorizontal ? new Size(Math.Max(inset.Right,0), childDesiredSize.Height)
7128: new Size(childDesiredSize.Width, Math.Max(inset.Bottom,0));
7141adjustedChildViewport.Width = Math.Max(0, adjustedChildViewport.Width - childPixelSizeInViewport.Width);
7147adjustedChildViewport.Height = Math.Max(0, adjustedChildViewport.Height - childPixelSizeInViewport.Height);
7232pixelSizeBeforeViewport = DoubleUtil.LessThan(childViewport.X, childPixelSize.Width) ? Math.Max(childViewport.X, 0.0) : childPixelSize.Width;
7233pixelSizeInViewport = Math.Min(childViewport.Width, childPixelSize.Width - pixelSizeBeforeViewport);
7234pixelSizeAfterViewport = 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
7279logicalSizeBeforeViewport = Math.Floor(childLogicalSize.Width * pixelSizeBeforeViewport / childPixelSize.Width);
7280logicalSizeAfterViewport = Math.Floor(childLogicalSize.Width * pixelSizeAfterViewport / childPixelSize.Width);
7288double childPixelHeightInViewport = Math.Min(childViewport.Height, childPixelSize.Height - Math.Max(childViewport.Y, 0.0));
7291childPixelSizeInViewport.Height = Math.Max(childPixelSizeInViewport.Height, childPixelHeightInViewport);
7293childPixelSizeInCacheBeforeViewport.Height = Math.Max(childPixelSizeInCacheBeforeViewport.Height, childPixelHeightInViewport);
7295childPixelSizeInCacheAfterViewport.Height = Math.Max(childPixelSizeInCacheAfterViewport.Height, childPixelHeightInViewport);
7298childLogicalSizeInViewport.Height = Math.Max(childLogicalSizeInViewport.Height, childLogicalSize.Height);
7300childLogicalSizeInCacheBeforeViewport.Height = Math.Max(childLogicalSizeInCacheBeforeViewport.Height, childLogicalSize.Height);
7302childLogicalSizeInCacheAfterViewport.Height = Math.Max(childLogicalSizeInCacheAfterViewport.Height, childLogicalSize.Height);
7324pixelSizeBeforeViewport = DoubleUtil.LessThan(childViewport.Y, childPixelSize.Height) ? Math.Max(childViewport.Y, 0.0) : childPixelSize.Height;
7325pixelSizeInViewport = Math.Min(childViewport.Height, childPixelSize.Height - pixelSizeBeforeViewport);
7326pixelSizeAfterViewport = 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
7371logicalSizeBeforeViewport = Math.Floor(childLogicalSize.Height * pixelSizeBeforeViewport / childPixelSize.Height);
7372logicalSizeAfterViewport = Math.Floor(childLogicalSize.Height * pixelSizeAfterViewport / childPixelSize.Height);
7380double childPixelWidthInViewport = Math.Min(childViewport.Width, childPixelSize.Width - Math.Max(childViewport.X, 0.0));
7383childPixelSizeInViewport.Width = Math.Max(childPixelSizeInViewport.Width, childPixelWidthInViewport);
7385childPixelSizeInCacheBeforeViewport.Width = Math.Max(childPixelSizeInCacheBeforeViewport.Width, childPixelWidthInViewport);
7387childPixelSizeInCacheAfterViewport.Width = Math.Max(childPixelSizeInCacheAfterViewport.Width, childPixelWidthInViewport);
7390childLogicalSizeInViewport.Width = Math.Max(childLogicalSizeInViewport.Width, childLogicalSize.Width);
7392childLogicalSizeInCacheBeforeViewport.Width = Math.Max(childLogicalSizeInCacheBeforeViewport.Width, childLogicalSize.Width);
7394childLogicalSizeInCacheAfterViewport.Width = Math.Max(childLogicalSizeInCacheAfterViewport.Width, childLogicalSize.Width);
7437sz1.Height = Math.Max(sz1.Height, sz2.Height);
7442sz1.Width = Math.Max(sz1.Width, sz2.Width);
7492childSize = new Size(Math.Max(headerDesiredSizes.PixelSize.Width, itemDesiredSizes.PixelSize.Width),
7497childSize = new Size(Math.Max(headerDesiredSizes.LogicalSize.Width, itemDesiredSizes.LogicalSize.Width),
7581uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes);
7665Math.Max(1, itemDesiredSizes.LogicalSize.Height))
7666: new Size(Math.Max(1, itemDesiredSizes.LogicalSize.Width),
7807Math.Max(uniformOrAverageContainerPixelSize, dpiScale), // don't round down to 0
7817uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes);
8480rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8505previousChildSize.Width = Math.Max(previousChildSize.Width, pixelHeaderSize.Width);
8512rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
8537previousChildSize.Height = Math.Max(previousChildSize.Height, pixelHeaderSize.Height);
8567rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8573rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
8611rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8664rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
9539return Math.Max(0, _firstItemInExtendedViewportIndex);
9547return Math.Min(ItemCount, _firstItemInExtendedViewportIndex + _actualItemsInExtendedViewportCount);
9665_scrollData._maxDesiredSize.Height = Math.Max(_scrollData._maxDesiredSize.Height, stackPixelSize.Height);
9692_scrollData._maxDesiredSize.Width = Math.Max(_scrollData._maxDesiredSize.Width, stackPixelSize.Width);
9718Math.Min(stackPixelSize.Width, constraint.Width) : constraint.Width;
9723Math.Min(stackPixelSize.Height, constraint.Height) : constraint.Height;
9733Debug.Assert(DoubleUtil.AreClose(viewportSize.Width - Math.Floor(viewportSize.Width), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
9734Debug.Assert(DoubleUtil.AreClose(extentSize.Width - Math.Floor(extentSize.Width), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
9738Debug.Assert(DoubleUtil.AreClose(viewportSize.Height - Math.Floor(viewportSize.Height), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
9739Debug.Assert(DoubleUtil.AreClose(extentSize.Height - Math.Floor(extentSize.Height), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
9992double proposedViewportSize = Math.Floor(viewport.Width / approxSizeOfLogicalUnit);
10085if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.X)/extentSize.Width, Math.Floor(_scrollData._offset.X)/_scrollData._extent.Width))
10088viewportOffset.X = Math.Floor((extentSize.Width * Math.Floor(_scrollData._offset.X)) / _scrollData._extent.Width);
10209double proposedViewportSize = Math.Floor(viewport.Height / approxSizeOfLogicalUnit);
10302if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.Y)/extentSize.Height, Math.Floor(_scrollData._offset.Y)/_scrollData._extent.Height))
10305viewportOffset.Y = Math.Floor((extentSize.Height * Math.Floor(_scrollData._offset.Y)) / _scrollData._extent.Height);
10517_scrollData._maxDesiredSize.Height = Math.Max(_scrollData._maxDesiredSize.Height, stackPixelSize.Height);
10544_scrollData._maxDesiredSize.Width = Math.Max(_scrollData._maxDesiredSize.Width, stackPixelSize.Width);
10570Math.Min(stackPixelSize.Width, constraint.Width) : constraint.Width;
10575Math.Min(stackPixelSize.Height, constraint.Height) : constraint.Height;
10585Debug.Assert(DoubleUtil.AreClose(viewportSize.Width - Math.Floor(viewportSize.Width), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
10586Debug.Assert(DoubleUtil.AreClose(extentSize.Width - Math.Floor(extentSize.Width), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
10590Debug.Assert(DoubleUtil.AreClose(viewportSize.Height - Math.Floor(viewportSize.Height), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
10591Debug.Assert(DoubleUtil.AreClose(extentSize.Height - Math.Floor(extentSize.Height), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
10671lastPageSafeOffset = lastPageSafeOffset.HasValue ? Math.Min(computedViewportOffset.X, (double)lastPageSafeOffset) : computedViewportOffset.X;
10674double proposedViewportSize = Math.Floor(viewport.Width / approxSizeOfLogicalUnit);
10756if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.X)/extentSize.Width, Math.Floor(_scrollData._offset.X)/_scrollData._extent.Width))
10759viewportOffset.X = Math.Floor((extentSize.Width * Math.Floor(_scrollData._offset.X)) / _scrollData._extent.Width);
10802lastPageSafeOffset = lastPageSafeOffset.HasValue ? Math.Min(computedViewportOffset.Y, (double)lastPageSafeOffset) : computedViewportOffset.Y;
10805double proposedViewportSize = Math.Floor(viewport.Height / approxSizeOfLogicalUnit);
10887if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.Y)/extentSize.Height, Math.Floor(_scrollData._offset.Y)/_scrollData._extent.Height))
10890viewportOffset.Y = Math.Floor((extentSize.Height * Math.Floor(_scrollData._offset.Y)) / _scrollData._extent.Height);
11188double visibleStart = Math.Max(start, 0);
11189double visibleEnd = Math.Max(Math.Min(end, viewportSize), visibleStart);
11234else if (childIndex > firstChildInView + Math.Max(viewportSize - 1, 0))
11280maxChildLength = Math.Max(maxChildLength, childSize.Height);
11284maxChildLength = Math.Max(maxChildLength, childSize.Width);
11876else if (DoubleUtil.GreaterThan(Math.Abs(newOffset - oldOffset), _viewport.Width))
11892else if (DoubleUtil.GreaterThan(Math.Abs(newOffset - oldOffset), _viewport.Height))
System\Windows\Documents\TextStore.cs (12)
989milPointTopLeft = new Point(Math.Min(rectPrev.Left, rectCur.Left), Math.Min(rectPrev.Top, rectCur.Top));
990milPointBottomRight = new Point(Math.Max(rectPrev.Left, rectCur.Left), Math.Max(rectPrev.Bottom, rectCur.Bottom));
2459runCount = TextPointerBase.GetTextWithLimit(navigator, LogicalDirection.Forward, text, charsCopied, Math.Min(cchReq, text.Length - charsCopied), limit);
2860double radSin = Math.Asin(tf.M12 / Math.Sqrt((tf.M11 * tf.M11) + (tf.M12 * tf.M12)));
2861double radCos = Math.Acos(tf.M11 / Math.Sqrt((tf.M11 * tf.M11) + (tf.M12 * tf.M12)));
2863double angleCos = Math.Round((radCos * 180) / Math.PI, 0);
3826int extraCharsAllowed = Math.Max(0, this.TextEditor.MaxLength - currentLength);
System\Windows\FrameworkElement.cs (59)
4055maxHeight = Math.Max(Math.Min(height, maxHeight), minHeight);
4058minHeight = Math.Max(Math.Min(maxHeight, height), minHeight);
4065maxWidth = Math.Max(Math.Min(width, maxWidth), minWidth);
4068minWidth = Math.Max(Math.Min(maxWidth, width), minWidth);
4170Double yCoverD = (yConstrInfinite ? Double.PositiveInfinity : Math.Abs(yConstr/d));
4171Double xCoverA = (xConstrInfinite ? Double.PositiveInfinity : Math.Abs(xConstr/a));
4191h = Math.Min(0.5*Math.Abs(xConstr/c), yCoverD);
4202w = Math.Min( 0.5*Math.Abs(yConstr/b), xCoverA);
4210Double yCoverB = Math.Abs(yConstr/b);
4211Double xCoverC = Math.Abs(xConstr/c);
4231h = Math.Min(0.5*Math.Abs(yConstr/d), xCoverC);
4242w = Math.Min( 0.5*Math.Abs(xConstr/a), yCoverB);
4248Double xCoverA = Math.Abs(xConstr / a); // w-intercept of x-constraint line.
4249Double xCoverC = Math.Abs(xConstr / c); // h-intercept of x-constraint line.
4251Double yCoverB = Math.Abs(yConstr / b); // w-intercept of y-constraint line.
4252Double yCoverD = Math.Abs(yConstr / d); // h-intercept of y-constraint line.
4259w = Math.Min(yCoverB, xCoverA) * 0.5;
4260h = Math.Min(xCoverC, yCoverD) * 0.5;
4277Double expandFactor = Math.Min(xConstr / childBoundsTr.Width,
4336Math.Max(availableSize.Width - marginWidth, 0),
4337Math.Max(availableSize.Height - marginHeight, 0));
4385frameworkAvailableSize.Width = Math.Max(mm.minWidth, Math.Min(frameworkAvailableSize.Width, mm.maxWidth));
4386frameworkAvailableSize.Height = Math.Max(mm.minHeight, Math.Min(frameworkAvailableSize.Height, mm.maxHeight));
4399Math.Max(desiredSize.Width, mm.minWidth),
4400Math.Max(desiredSize.Height, mm.minHeight));
4466ltd.TransformedUnroundedDS = new Size(Math.Max(0, clippedDesiredWidth), Math.Max(0, clippedDesiredHeight));
4513return new Size(Math.Max(0, clippedDesiredWidth), Math.Max(0, clippedDesiredHeight));
4575arrangeSize.Width = Math.Max(0, arrangeSize.Width - marginWidth);
4576arrangeSize.Height = Math.Max(0, arrangeSize.Height - marginHeight);
4585transformedUnroundedDS.Width = Math.Max(0, transformedUnroundedDS.Width - marginWidth);
4586transformedUnroundedDS.Height = Math.Max(0, transformedUnroundedDS.Height- marginHeight);
4595unclippedDesiredSize = new Size(Math.Max(0, this.DesiredSize.Width - marginWidth),
4596Math.Max(0, this.DesiredSize.Height - marginHeight));
4601unclippedDesiredSize.Width = Math.Max(transformedUnroundedDS.Width, unclippedDesiredSize.Width);
4602unclippedDesiredSize.Height = Math.Max(transformedUnroundedDS.Height, unclippedDesiredSize.Height);
4689double effectiveMaxWidth = Math.Max(unclippedDesiredSize.Width, mm.maxWidth);
4696double effectiveMaxHeight = Math.Max(unclippedDesiredSize.Height, mm.maxHeight);
4727Size clippedInkSize = new Size(Math.Min(innerInkSize.Width, mm.maxWidth),
4728Math.Min(innerInkSize.Height, mm.maxHeight));
4760Size clientSize = new Size(Math.Max(0, finalRect.Width - marginWidth),
4761Math.Max(0, finalRect.Height - marginHeight));
4910inkSize.Width = Math.Min(inkSize.Width, mm.maxWidth);
4911inkSize.Height = Math.Min(inkSize.Height, mm.maxHeight);
4928Size clippingSize = new Size(Math.Max(0, layoutSlotSize.Width - marginWidth),
4929Math.Max(0, layoutSlotSize.Height - marginHeight));
5241inkSize.Width = Math.Min(inkSize.Width, mm.maxWidth);
5242inkSize.Height = Math.Min(inkSize.Height, mm.maxHeight);
System\Windows\Shell\WindowChromeWorker.cs (23)
815double shortestDimension = Math.Min(windowSize.Width, windowSize.Height);
818topLeftRadius = Math.Min(topLeftRadius, shortestDimension / 2);
834topRightRadius = Math.Min(topRightRadius, shortestDimension / 2);
842bottomLeftRadius = Math.Min(bottomLeftRadius, shortestDimension / 2);
850bottomRightRadius = Math.Min(bottomRightRadius, shortestDimension / 2);
877(int)Math.Floor(region.Left),
878(int)Math.Floor(region.Top),
879(int)Math.Ceiling(region.Right),
880(int)Math.Ceiling(region.Bottom));
885(int)Math.Floor(region.Left),
886(int)Math.Floor(region.Top),
887(int)Math.Ceiling(region.Right) + 1,
888(int)Math.Ceiling(region.Bottom) + 1,
889(int)Math.Ceiling(radius),
890(int)Math.Ceiling(radius));
978deviceGlassThickness.Top = Math.Max(0, deviceGlassThickness.Top);
983deviceGlassThickness.Left = Math.Max(0, deviceGlassThickness.Left);
988deviceGlassThickness.Bottom = Math.Max(0, deviceGlassThickness.Bottom);
993deviceGlassThickness.Right = Math.Max(0, deviceGlassThickness.Right);
1000cxLeftWidth = (int)Math.Ceiling(deviceGlassThickness.Left),
1001cxRightWidth = (int)Math.Ceiling(deviceGlassThickness.Right),
1002cyTopHeight = (int)Math.Ceiling(deviceGlassThickness.Top),
1003cyBottomHeight = (int)Math.Ceiling(deviceGlassThickness.Bottom),
System\Windows\Window.cs (30)
1828frameworkAvailableSize.Width = Math.Max(mm.minWidth, Math.Min(frameworkAvailableSize.Width, mm.maxWidth));
1829frameworkAvailableSize.Height = Math.Max(mm.minHeight, Math.Min(frameworkAvailableSize.Height, mm.maxHeight));
1836Math.Max(desiredSize.Width, mm.minWidth),
1837Math.Max(desiredSize.Height, mm.minHeight));
1858arrangeBounds.Width = Math.Max(mm.minWidth, Math.Min(arrangeBounds.Width, mm.maxWidth));
1859arrangeBounds.Height = Math.Max(mm.minHeight, Math.Min(arrangeBounds.Height, mm.maxHeight));
1893childArrangeBounds.Width = Math.Max(0.0, arrangeBounds.Width - frameSize.Width);
1894childArrangeBounds.Height = Math.Max(0.0, arrangeBounds.Height - frameSize.Height);
3429childConstraint.Width = ((constraint.Width == Double.PositiveInfinity) ? Double.PositiveInfinity : Math.Max(0.0, (constraint.Width - frameSize.Width)));
3430childConstraint.Height = ((constraint.Height == Double.PositiveInfinity) ? Double.PositiveInfinity : Math.Max(0.0, (constraint.Height - frameSize.Height)));
3474maxWidthDeviceUnits = Math.Max(_trackMaxWidthDeviceUnits, _windowMaxWidthDeviceUnits);
3475maxHeightDeviceUnits = Math.Max(_trackMaxHeightDeviceUnits, _windowMaxHeightDeviceUnits);
3484mm.minWidth = Math.Max(this.MinWidth, minSizeLogicalUnits.X);
3489mm.maxWidth = Math.Min(MinWidth, maxSizeLogicalUnits.X);
3495mm.maxWidth = Math.Min(MaxWidth, maxSizeLogicalUnits.X);
3506mm.minHeight = Math.Max(this.MinHeight, minSizeLogicalUnits.Y);
3511mm.maxHeight = Math.Min(this.MinHeight, maxSizeLogicalUnits.Y);
3517mm.maxHeight = Math.Min(MaxHeight, maxSizeLogicalUnits.Y);
3874leftDeviceUnits = Math.Min(leftDeviceUnits, workAreaRectDeviceUnits.right - currentSizeDeviceUnits.Width);
3875leftDeviceUnits = Math.Max(leftDeviceUnits, workAreaRectDeviceUnits.left);
3876topDeviceUnits = Math.Min(topDeviceUnits, workAreaRectDeviceUnits.bottom - currentSizeDeviceUnits.Height);
3877topDeviceUnits = Math.Max(topDeviceUnits, workAreaRectDeviceUnits.top);
4737_windowMaxWidthDeviceUnits = Math.Max(_windowMaxWidthDeviceUnits, windowSize.X);
4738_windowMaxHeightDeviceUnits = Math.Max(_windowMaxHeightDeviceUnits, windowSize.Y);
7635return 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)
236float min = Math.Min(rgbColor.Red, Math.Min(rgbColor.Green, rgbColor.Blue));
237float max = Math.Max(rgbColor.Red, Math.Max(rgbColor.Green, rgbColor.Blue));
269saturation = Math.Max(0.0f, Math.Min(saturation, 1.0f));
324float hue = (float)((hlsColor.Hue - Math.Floor(hlsColor.Hue)) * 6);
600Math.Max(0.0, rt.Width - thick.Left - thick.Right),
601Math.Max(0.0, rt.Height - thick.Top - thick.Bottom));
689desired = 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);
1912double length = Math.Sqrt(dx * dx + dy * dy);
1926stopDistance = Math.Max(b.RadiusX, b.RadiusY) * (second.Offset - first.Offset);
1944int stopCount = (int)Math.Ceiling(-6.297427 + 4.591693 * Math.Log(stopDistance));
2283double height = Math.Abs(start.Y - end.Y) * multiplier;
2292double width = Math.Abs(start.X - end.X) * multiplier;
2573if (Utility.AreClose(new Vector(Math.Abs(rbA.RadiusX), Math.Abs(rbA.RadiusY)) * rbA.Transform.Value,
2574new Vector(Math.Abs(rbB.RadiusX), Math.Abs(rbB.RadiusY)) * rbB.Transform.Value))
3742min = Math.Min(min, offset);
3743max = Math.Max(max, offset);
3869return Math.Sqrt(sum);
3898return (int)Math.Ceiling(Math.Max(5, step)); // At least five. Radials look bad with less steps.
3947if (Math.Abs(di) < Double.Epsilon)
4041double right = Math.Ceiling(_bounds.Right / _bandDelta);
4042double left = Math.Floor(_bounds.Left / _bandDelta);
4141double rotateAngle = Math.Atan2(-gradientVector.Y, gradientVector.X) * 180.0 / Math.PI;
4186_rx = Math.Abs(b.RadiusX);
4187_ry = Math.Abs(b.RadiusY);
4268double right = Math.Ceiling(maxt * _bandSteps);
4269double left = Math.Floor(mint * _bandSteps);
4384double root = Math.Sqrt(B4AC);
4393maxt = Math.Max(maxt, one);
4394mint = Math.Min(mint, one);
4401maxt = Math.Max(maxt, two);
4402mint = Math.Min(mint, two);
4427double len = Math.Sqrt(dx * dx + dy * dy);
Serialization\VisualSerializer.cs (10)
468scalex = Math.Min(dstwidth / srcwidth, dstheight / srcheight);
473scalex = 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.VisualStudio.DiagnosticsWindow (1)
Roslyn.VisualStudio.Next.UnitTests (1)
ScenarioTests.Common.Tests (1)
SemanticSearch.BuildTask (1)
SignalRSamples (2)
Sockets.FunctionalTests (3)
Stress.ApiService (1)
Swaggatherer (2)
System.Collections (5)
System.Collections.Concurrent (8)
System.Collections.Immutable (11)
System.ComponentModel.TypeConverter (6)
System.Console (3)
System.Data.Common (88)
System\Data\SQLTypes\SQLDecimal.cs (26)
414precision = Math.Max(precision, _bScale);
680double dInt = Math.Floor(dVal);
687dVal = Math.Floor(dInt / s_DUINT_BASE);
693dVal = Math.Floor(dInt / s_DUINT_BASE);
700dVal = Math.Floor(dInt / s_DUINT_BASE);
707dVal = Math.Floor(dInt / s_DUINT_BASE);
766dFrac -= Math.Floor(dFrac);
1138dRet /= System.Math.Pow(10.0, _bScale);
1251ResInteger = Math.Max(x._bPrec - MyScale, y._bPrec - OpScale);
1255ResScale = Math.Max(MyScale, OpScale);
1261ResPrec = Math.Min(MaxPrecision, ResPrec);
1465ResScale = Math.Min((ResPrec - ResInteger), ResScale);
1467ResScale = Math.Max(ResScale, Math.Min(ActualScale, s_cNumeDivScaleMin));
1688ResScale = Math.Max(x._bScale + y._bPrec + 1, s_cNumeDivScaleMin);
1691MinScale = Math.Min(ResScale, s_cNumeDivScaleMin);
1693ResInteger = Math.Min(ResInteger, s_NUMERIC_MAX_PRECISION);
1700ResScale = Math.Min((ResPrec - ResInteger), ResScale);
1701ResScale = Math.Max(ResScale, MinScale);
2297bNewPrec = (byte)(Math.Min(s_NUMERIC_MAX_PRECISION, Math.Max(1, lAdjust + _bPrec)));
3168lPosition = Math.Min(s_NUMERIC_MAX_PRECISION, lPosition);
3175lPosition = Math.Max(-s_NUMERIC_MAX_PRECISION, lPosition);
3186int lAdjust = Math.Abs(lPosition - n._bScale); // Precision adjustment
3225lAdjust = Math.Abs(lPosition - n._bScale);
3261n = new SqlDecimal(Math.Pow(dBaseNum, exp));
System.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 (16)
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 (6)
System.IO.FileSystem.Watcher (2)
System.IO.Hashing (1)
System.IO.Pipelines (8)
System.IO.Ports (5)
System.Linq (15)
System.Linq.Expressions (8)
System.Linq.Parallel (5)
System.Memory (4)
System.Memory.Data (1)
System.Net.Http (51)
System.Net.HttpListener (10)
System.Net.Mail (7)
System.Net.NameResolution (1)
System.Net.NetworkInformation (1)
System.Net.Ping (4)
System.Net.Primitives (8)
System.Net.Quic (5)
System.Net.Requests (4)
System.Net.Security (6)
System.Net.ServerSentEvents (3)
System.Net.Sockets (8)
System.Net.WebClient (6)
System.Net.WebSockets (8)
System.Numerics.Tensors (19)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IAggregationOperator.cs (6)
236(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector128<T>.Count);
418(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector256<T>.Count);
600(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector512<T>.Count);
1375(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector128<T>.Count);
1582(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector256<T>.Count);
1789(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector512<T>.Count);
System.Private.CoreLib (531)
src\libraries\System.Private.CoreLib\src\System\Byte.cs (4)
279public static (byte Quotient, byte Remainder) DivRem(byte left, byte right) => Math.DivRem(left, right);
525public static byte Clamp(byte value, byte min, byte max) => Math.Clamp(value, min, max);
531public static byte Max(byte x, byte y) => Math.Max(x, y);
537public static byte Min(byte x, byte y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (63)
182ulong high = Math.BigMul(a, b, out ulong low);
334(ulong quo64, bufNum.Low64) = Math.DivRem(num, den);
376ulong prod = Math.BigMul(quo, (uint)den); // quo * lo divisor
422ulong prod1 = Math.BigMul(quo, bufDen.U0); // quo * lo divisor
423ulong prod2 = Math.BigMul(quo, bufDen.U1); // quo * mid divisor
482ulong tmp = Math.BigMul(bufNum.U0, power);
485tmp += Math.BigMul(bufNum.U1, power);
488tmp += Math.BigMul(bufNum.U2, power);
495ulong tmp = Math.BigMul(bufNum.U0, power);
498tmp += Math.BigMul(bufNum.U1, power);
674(quotient, remainder) = Math.DivRem(high, power);
914low64 = Math.BigMul((uint)low64, UInt32Powers10[scale]);
918low64 = Math.BigMul((uint)low64, TenToPowerNine);
927tmpLow = Math.BigMul((uint)low64, power);
928tmp64 = Math.BigMul((uint)(low64 >> 32), power) + (tmpLow >> 32);
943tmpLow = Math.BigMul((uint)low64, power);
944tmp64 = Math.BigMul((uint)(low64 >> 32), power) + (tmpLow >> 32);
947tmp64 += Math.BigMul(high, power);
979tmp64 += Math.BigMul(rgulNum[cur], power);
1182ulong high = Math.BigMul(pwr, pdecIn.Mid);
1185ulong low = Math.BigMul(pwr, pdecIn.Low);
1270ulong tmpLow = Math.BigMul((uint)low64, power);
1271ulong tmp = Math.BigMul((uint)(low64 >> 32), power) + (tmpLow >> 32);
1274tmp += Math.BigMul(high, power);
1317ulong low64 = Math.BigMul(d1.Low, d2.Low);
1330(low64, ulong remainder) = Math.DivRem(low64, power);
1348tmp = Math.BigMul(d1.Low, d2.Low);
1351tmp = Math.BigMul(d1.Low, d2.Mid) + (tmp >> 32);
1357tmp += Math.BigMul(d1.Low, d2.High);
1372tmp = Math.BigMul(d2.Low, d1.Low);
1375tmp = Math.BigMul(d2.Low, d1.Mid) + (tmp >> 32);
1381tmp += Math.BigMul(d2.Low, d1.High);
1416tmp = Math.BigMul(d1.Low, d2.Low);
1419ulong tmp2 = Math.BigMul(d1.Low, d2.Mid) + (tmp >> 32);
1421tmp = Math.BigMul(d1.Mid, d2.Low);
1429tmp = Math.BigMul(d1.Mid, d2.Mid) + tmp2;
1435tmp2 = Math.BigMul(d1.Low, d2.High);
1441tmp2 = Math.BigMul(d1.High, d2.Low);
1448tmp = Math.BigMul(d1.Mid, d2.High);
1454tmp2 = Math.BigMul(d1.High, d2.Mid);
1461bufProd.High64 = Math.BigMul(d1.High, d2.High) + tmp;
1565mant = (uint)(int)Math.Round(dbl);
1584result.Low64 = Math.BigMul(mant, UInt32Powers10[power]);
1592ulong low64 = Math.BigMul(mant, UInt32Powers10[power - 18]);
1597ulong low64 = Math.BigMul(mant, UInt32Powers10[power - 9]);
1598ulong hi64 = Math.BigMul(TenToPowerNine, (uint)(low64 >> 32));
1599low64 = Math.BigMul(TenToPowerNine, (uint)low64);
1624(uint div, uint rem) = Math.DivRem(mant, 10000);
1635(uint div, uint rem) = Math.DivRem(mant, 100);
1646(uint div, uint rem) = Math.DivRem(mant, 10);
1729mant = (ulong)(long)Math.Round(dbl);
1749ulong low64 = Math.BigMul((uint)mant, pow10);
1750ulong hi64 = Math.BigMul((uint)(mant >> 32), pow10);
1910curScale = Math.Min(9, -scale);
1954ulong num = Math.BigMul(remainder, power);
2005curScale = Math.Min(9, -scale);
2067curScale = Math.Min(9, -scale);
2187ulong tmp = Math.BigMul(d2.Low, power);
2214ulong tmp = Math.BigMul(bufQuo.U0, power);
2275ulong tmp64 = Math.BigMul(b.Buf24.U0, power);
2280tmp64 += Math.BigMul(buf[i], power);
2364(d.uhi, remainder) = Math.DivRem(n, divisor);
2405(d.uhi, remainder) = Math.DivRem(n, power);
src\libraries\System.Private.CoreLib\src\System\Double.cs (57)
67public const double E = Math.E;
71public const double Pi = Math.PI;
75public const double Tau = Math.Tau;
579public static double Log2(double value) => Math.Log2(value);
633public static double Exp(double x) => Math.Exp(x);
636public static double ExpM1(double x) => Math.Exp(x) - 1;
639public static double Exp2(double x) => Math.Pow(2, x);
642public static double Exp2M1(double x) => Math.Pow(2, x) - 1;
645public static double Exp10(double x) => Math.Pow(10, x);
648public static double Exp10M1(double x) => Math.Pow(10, x) - 1;
656public static double Ceiling(double x) => Math.Ceiling(x);
682public static double Floor(double x) => Math.Floor(x);
686public static double Round(double x) => Math.Round(x);
689public static double Round(double x, int digits) => Math.Round(x, digits);
692public static double Round(double x, MidpointRounding mode) => Math.Round(x, mode);
695public static double Round(double x, int digits, MidpointRounding mode) => Math.Round(x, digits, mode);
699public static double Truncate(double x) => Math.Truncate(x);
782static double IFloatingPointConstants<double>.E => Math.E;
811public static double Atan2(double y, double x) => Math.Atan2(y, x);
817public static double BitDecrement(double x) => Math.BitDecrement(x);
820public static double BitIncrement(double x) => Math.BitIncrement(x);
824public static double FusedMultiplyAdd(double left, double right, double addend) => Math.FusedMultiplyAdd(left, right, addend);
827public static double Ieee754Remainder(double left, double right) => Math.IEEERemainder(left, right);
830public static int ILogB(double x) => Math.ILogB(x);
837public static double ReciprocalEstimate(double x) => Math.ReciprocalEstimate(x);
841public static double ReciprocalSqrtEstimate(double x) => Math.ReciprocalSqrtEstimate(x);
844public static double ScaleB(double x, int n) => Math.ScaleB(x, n);
855public static double Acosh(double x) => Math.Acosh(x);
859public static double Asinh(double x) => Math.Asinh(x);
863public static double Atanh(double x) => Math.Atanh(x);
867public static double Cosh(double x) => Math.Cosh(x);
871public static double Sinh(double x) => Math.Sinh(x);
875public static double Tanh(double x) => Math.Tanh(x);
890public static double Log(double x) => Math.Log(x);
893public static double Log(double x, double newBase) => Math.Log(x, newBase);
896public static double LogP1(double x) => Math.Log(x + 1);
899public static double Log2P1(double x) => Math.Log2(x + 1);
903public static double Log10(double x) => Math.Log10(x);
906public static double Log10P1(double x) => Math.Log10(x + 1);
944public static double Clamp(double value, double min, double max) => Math.Clamp(value, min, max);
947public static double CopySign(double value, double sign) => Math.CopySign(value, sign);
951public static double Max(double x, double y) => Math.Max(x, y);
978public static double Min(double x, double y) => Math.Min(x, y);
1004public static int Sign(double value) => Math.Sign(value);
1021public static double Abs(double value) => Math.Abs(value);
1117public static double MaxMagnitude(double x, double y) => Math.MaxMagnitude(x, y);
1147public static double MinMagnitude(double x, double y) => Math.MinMagnitude(x, y);
1453public static double Pow(double x, double y) => Math.Pow(x, y);
1461public static double Cbrt(double x) => Math.Cbrt(x);
1745public static double Sqrt(double x) => Math.Sqrt(x);
1777public static double Acos(double x) => Math.Acos(x);
1787public static double Asin(double x) => Math.Asin(x);
1797public static double Atan(double x) => Math.Atan(x);
1807public static double Cos(double x) => Math.Cos(x);
1918public static double Sin(double x) => Math.Sin(x);
1921public static (double Sin, double Cos) SinCos(double x) => Math.SinCos(x);
2126public static double Tan(double x) => Math.Tan(x);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (8)
464FormatDigits(ref result, hour12, Math.Min(tokenLen, 2));
469FormatDigits(ref result, dateTime.Hour, Math.Min(tokenLen, 2));
474FormatDigits(ref result, dateTime.Minute, Math.Min(tokenLen, 2));
479FormatDigits(ref result, dateTime.Second, Math.Min(tokenLen, 2));
638FormatDigits(ref result, year, Math.Min(tokenLen, 2));
824(int tens, int ones) = Math.DivRem(offset.Hours, 10);
1499(int offsetHours, int offsetMinutes) = Math.DivRem(offsetTotalMinutes, 60);
1703(int offsetHours, offsetMinutes) = Math.DivRem(offsetMinutes, 60);
src\libraries\System.Private.CoreLib\src\System\Int16.cs (7)
282public static (short Quotient, short Remainder) DivRem(short left, short right) => Math.DivRem(left, right);
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)
605nMaxDigits = Math.Max(number.DigitsCount, TNumber.MaxRoundTripDigits);
1391int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length;
1417int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length;
1446int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value));
1465int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value));
1502int bufferLength = Math.Max(digits, 32 - (int)uint.LeadingZeroCount(value));
1521int bufferLength = Math.Max(digits, 32 - (int)uint.LeadingZeroCount(value));
1596(value, uint remainder) = Math.DivRem(value, 100);
1638(value, uint remainder) = Math.DivRem(value, 100);
1666(value, remainder) = Math.DivRem(value, 100);
1673(value, remainder) = Math.DivRem(value, 10);
1720int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
1756int bufferLength = Math.Max(digits, countedDigits);
1824int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length;
1850int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length;
1879int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value));
1898int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value));
1951int bufferLength = Math.Max(digits, 64 - (int)ulong.LeadingZeroCount(value));
1970int bufferLength = Math.Max(digits, 64 - (int)ulong.LeadingZeroCount(value));
2067(value, ulong remainder) = Math.DivRem(value, 100);
2106(value, remainder) = Math.DivRem(value, 100);
2113(value, remainder) = Math.DivRem(value, 10);
2148int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
2183int bufferLength = Math.Max(digits, countedDigits);
2252int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length;
2280int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length;
2311int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits(uValue));
2332int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits(uValue));
2361return Int64ToHexChars(buffer, lower, hexBase, Math.Max(digits, 1));
2374int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value));
2395int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value));
2424return UInt64ToBinaryChars(buffer, lower, Math.Max(digits, 1));
2510int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
2524int 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 (6)
System.Private.Xml (28)
System.Reflection.Emit (3)
System.Reflection.Metadata (25)
System.Reflection.MetadataLoadContext (1)
System.Runtime (1)
System.Runtime.Caching (18)
System.Runtime.Extensions (1)
System.Runtime.Numerics (90)
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);
3256(int digitShift, int smallShift) = Math.DivRem(rotateAmount, kcbitUint);
3391(int digitShift, int smallShift) = Math.DivRem(rotateAmount, kcbitUint);
5238(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 (24)
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 (1)
System.Text.RegularExpressions (39)
System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (9)
114int reps = node.Kind is RegexNodeKind.One ? 1 : Math.Min(node.M, MaxPrefixLength);
164int reps = node.Kind is RegexNodeKind.Set ? 1 : Math.Min(node.M, MaxPrefixLength);
228int limit = Math.Min(node.M, MaxPrefixLength); // MaxPrefixLength here is somewhat arbitrary, as a single loop iteration could yield multiple chars
434int count = Math.Min(node.M, SingleCharIterationLimit);
442int limit = Math.Min(node.M, NodeIterationLimit);
612int minIterations = Math.Min(node.M, MaxLoopExpansion);
643int minIterations = Math.Min(node.M, MaxLoopExpansion);
856int c = Math.Max(s1CharsLength, s1RangeLength).CompareTo(Math.Max(s2CharsLength, s2RangeLength));
System.Text.RegularExpressions.Generator (26)
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (9)
114int reps = node.Kind is RegexNodeKind.One ? 1 : Math.Min(node.M, MaxPrefixLength);
164int reps = node.Kind is RegexNodeKind.Set ? 1 : Math.Min(node.M, MaxPrefixLength);
228int limit = Math.Min(node.M, MaxPrefixLength); // MaxPrefixLength here is somewhat arbitrary, as a single loop iteration could yield multiple chars
434int count = Math.Min(node.M, SingleCharIterationLimit);
442int limit = Math.Min(node.M, NodeIterationLimit);
612int minIterations = Math.Min(node.M, MaxLoopExpansion);
643int minIterations = Math.Min(node.M, MaxLoopExpansion);
856int c = Math.Max(s1CharsLength, s1RangeLength).CompareTo(Math.Max(s2CharsLength, s2RangeLength));
System.Threading (2)
System.Threading.Channels (1)
System.Threading.RateLimiting (3)
System.Threading.Tasks.Dataflow (1)
System.Threading.Tasks.Parallel (1)
System.Web.HttpUtility (2)
System.Windows.Controls.Ribbon (105)
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGalleryCategoriesPanel.cs (10)
387maxChildWidth = Math.Max(maxChildWidth, childSize.Width);
388maxChildHeight = Math.Max(maxChildHeight, childSize.Height);
462stackDesiredSize.Width = Math.Max(stackDesiredSize.Width, childDesiredSize.Width);
472stackDesiredSize.Width = Math.Min(stackDesiredSize.Width, constraint.Width);
473stackDesiredSize.Height = Math.Min(stackDesiredSize.Height, constraint.Height);
492logicalVisibleSpace = DoubleUtil.LessThanOrClose((viewportOffsetY + logicalVisibleSpace) - stackDesiredSize.Height, 0.0) ? 0.0 : Math.Min((viewportOffsetY + logicalVisibleSpace) - stackDesiredSize.Height, constraint.Height);
493viewportOffsetY = Math.Max(viewportOffsetY - logicalVisibleSpace, 0.0);
496offset.X = Math.Max(0, Math.Min(offset.X, extent.Width - viewport.Width));
602rcChild.Width = Math.Max(finalSize.Width, child.DesiredSize.Width);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGalleryItemsPanel.cs (25)
341maxColumnWidth = Math.Max(maxColumnWidth, childSize.Width);
342maxItemHeight = Math.Max(maxItemHeight, childSize.Height);
363columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount);
375columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount);
376arrangeWidth = Math.Max(availableSize.Width / columnCount, maxColumnWidth);
382columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / arrangeWidth), childrenCount)), maxColumnCount);
391columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount);
392_arrangeWidth = Math.Max(availableSize.Width / columnCount, maxColumnWidth);
398columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / _arrangeWidth), childrenCount)), maxColumnCount);
405columnCount = Math.Max(minColumnCount, Math.Min(childrenCount, maxColumnCount));
414maxRowHeight = Math.Max(maxRowHeight, childSize.Height);
567finalColumnCount = Math.Max(minColumnCount, Math.Min((int)(finalSize.Width / arrangeWidth), maxColumnCount));
576maxRowHeight = Math.Max(maxRowHeight, children[i].DesiredSize.Height);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGroupItemsPanel.cs (14)
83remainingHeightInColumn = Math.Max(0, finalSize.Height - childDesiredSize.Height);
105columnWidth = Math.Max(columnWidth, arrangeWidth);
136maxStarColumnWidth = Math.Max(maxStarColumnWidth, child.MaxWidth);
141maxStarColumnWidth = Math.Max(maxStarColumnWidth, Math.Min(child.MaxWidth, child.DesiredSize.Width));
223desiredHeight = Math.Min(Math.Max(desiredHeight, columnHeight), availableSize.Height);
248columnWidth = Math.Max(columnWidth, GetStarChildMinWidth(child as FrameworkElement, ref maxStarColumnWidth));
252columnWidth = Math.Max(columnWidth, childDesiredSize.Width);
253maxStarColumnWidth = Math.Max(maxStarColumnWidth, columnWidth);
258desiredHeight = Math.Min(Math.Max(desiredHeight, columnHeight), availableSize.Height);
358columnDesiredWidth = Math.Max(columnDesiredWidth, child.DesiredSize.Width);
375desiredWidth += Math.Max((columnDesiredWidth - starLayoutInfo.RequestedStarMinWidth), 0);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonTabHeadersPanel.cs (11)
90_separatorOpacity = Math.Max(0.0, reducePaddingRegularTabHeader * 0.2);
123double availableExtraWidth = Math.Min(desiredExtraPaddingPerTab, availableExtraWidthPerTab);
143if (Math.Abs(desiredSize.Width - availableSize.Width) < _desiredWidthEpsilon)
396desiredSize.Height = Math.Max(desiredSize.Height, ribbonTabHeader.DesiredSize.Height);
413desiredSize.Height = Math.Max(desiredSize.Height, child.DesiredSize.Height);
444double leftPadding = Math.Max(0, ribbonTabHeader.DefaultPadding.Left - (isContextualTab ? reducePaddingContextualTabHeader : reducePaddingRegularTabHeader));
445double rightPadding = Math.Max(0, ribbonTabHeader.DefaultPadding.Right - (isContextualTab ? reducePaddingContextualTabHeader : reducePaddingRegularTabHeader));
451desiredSize.Height = Math.Max(desiredSize.Height, ribbonTabHeader.DesiredSize.Height);
462desiredSize.Height = Math.Max(desiredSize.Height, child.DesiredSize.Height);
527return Math.Max(_tabHeaderMinWidth, maxTabHeaderWidth);
1064return Math.Max(0.0, offset);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonTitlePanel.cs (14)
77startContextualTabX = Math.Min(CalculateContextualTabGroupStartX(firstContextualTab), availableSize.Width);
83endContextualTabX = Math.Min(CalculateContextualTabGroupEndX(lastContextualTab), availableSize.Width);
86groupHeaderItemsControl.Measure(new Size(Math.Max(endContextualTabX - startContextualTabX, 0), availableSize.Height));
88desiredSize.Height = Math.Max(desiredSize.Height, groupHeaderItemsControl.DesiredSize.Height);
123availableToQat = Math.Max(availableToQat, 0);
130desiredSize.Height = Math.Max(desiredSize.Height, qat.DesiredSize.Height);
135endContextualTabX = Math.Max(endContextualTabX, availableToQat);
148availableToTitle = Math.Max(leftSpace, rightSpace);
154availableToTitle = Math.Max(availableToTitle, 0);
158desiredSize.Height = Math.Max(desiredSize.Height, titleHost.DesiredSize.Height);
161desiredSize.Width = Math.Min(desiredSize.Width, availableSize.Width); // Prevent clipping
186startContextualTabX = Math.Min(CalculateContextualTabGroupStartX(firstContextualTab), finalSize.Width);
189endContextualTabX = Math.Min(startContextualTabX + tabGroups.DesiredSize.Width, finalSize.Width);
202endContextualTabX = Math.Max(endContextualTabX, qatDesiredWidth);
System.Windows.Forms (604)
System.Windows.Forms.Design (176)
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)
UIAutomationClientSideProviders (27)
MS\Internal\AutomationProxies\WindowsEditBoxRange.cs (13)
131End = Math.Min(Math.Max(End, Start + 1), text.Length);
165End = Math.Min(Math.Max(End, Start + 1), text.Length);
299return text.Substring(Start, maxLength >= 0 ? Math.Min(Length, maxLength) : Length);
473Math.Max(0, _provider.LineFromChar(End) - _provider.LinesPerPage() + 1);
658int height = Math.Abs(_provider.GetLogfont().lfHeight);;
685ArrayList rects = new ArrayList(Math.Max(endLine - startLine + 1, 0));
780return Math.Round((double)(-logfont.lfHeight) * 72 / lpy);
827moved = Math.Min(count, limit - index);
872moved = Math.Min(count, lineMax - line - 1);
940moved = Math.Max(count, -oneBasedIndex);
985int actualCount = Math.Max(count, -line);
UIAutomationTypes (3)
VBCSCompiler (1)
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);