7201 references to Math
AnalyzerRunner (1)
Aspire.Dashboard (17)
Aspire.Hosting (2)
Aspire.Hosting.Azure.ServiceBus (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 (19)
MultipartReaderStream.cs (9)
187var slice = buffer.AsSpan(offset, Math.Min(count, index));
207read = _innerStream.Read(buffer, offset, Math.Min(count, matchOffset - bufferedData.Offset));
218read = _innerStream.Read(buffer, offset, Math.Min(count, bufferedData.Count));
267var slice = buffer[..Math.Min(buffer.Length, index)];
290var slice = buffer[..Math.Min(buffer.Length, matchOffset - bufferedData.Offset)];
304read = _innerStream.Read(buffer.Span[..Math.Min(buffer.Length, bufferedData.Count)]);
335matchOffset = Math.Max(segment1.Offset, segment1.Offset + segment1.Count - matchBytes.Length);
362bufferSize = Math.Max(4096, bufferSize);
371bufferSize = Math.Max(4096, bufferSize);
Microsoft.AspNetCore.WebUtilities.Tests (4)
Microsoft.Build (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 (25)
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 (30)
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 (112)
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.AI (1)
Microsoft.Extensions.AI.Integration.Tests (1)
Microsoft.Extensions.AI.OpenAI (3)
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 (11)
Microsoft.Extensions.FileProviders.Physical (1)
Microsoft.Extensions.Http.Diagnostics (1)
Microsoft.Extensions.Http.Diagnostics.Tests (1)
Microsoft.Extensions.Identity.Core (2)
Microsoft.Extensions.Logging.Abstractions (2)
Microsoft.Extensions.Logging.Console (2)
Microsoft.Extensions.Logging.Generators (1)
Microsoft.Extensions.Telemetry (4)
Microsoft.Gen.Logging (1)
Microsoft.Interop.SourceGeneration (4)
Microsoft.JSInterop (2)
Microsoft.Maui (60)
Layouts\LayoutExtensions.cs (10)
46 consumedWidth = Math.Min(bounds.Width, view.MaximumWidth);
50 var frameWidth = Math.Max(0, consumedWidth - margin.HorizontalThickness);
60 consumedHeight = Math.Min(bounds.Height, view.MaximumHeight);
64 var frameHeight = Math.Max(0, consumedHeight - margin.VerticalThickness);
84 desiredWidth = IsExplicitSet(view.Width) ? desiredWidth : Math.Min(bounds.Width, view.MaximumWidth);
121 desiredHeight = IsExplicitSet(view.Height) ? desiredHeight : Math.Min(bounds.Height, view.MaximumHeight);
189 size.Width = Math.Max(bounds.Width, size.Width);
194 size.Height = Math.Max(bounds.Height, size.Height);
225 bounds.Width = Math.Max(bounds.Width, presentedContent.DesiredSize.Width + padding.HorizontalThickness);
226 bounds.Height = Math.Max(bounds.Height, presentedContent.DesiredSize.Height + padding.VerticalThickness);
Microsoft.Maui.Controls (165)
LegacyLayouts\GridCalc.cs (33)
201 actualHeight = Math.Max(actualHeight, sizeRequest.Request.Height - assignedHeight - grid.RowSpacing * (GetRowSpan(child) - 1));
202 minimumHeight = Math.Max(minimumHeight, sizeRequest.Minimum.Height - assignedHeight - grid.RowSpacing * (GetRowSpan(child) - 1));
234 actualWidth = Math.Max(actualWidth, sizeRequest.Request.Width - assignedWidth - (GetColumnSpan(child) - 1) * grid.ColumnSpacing);
235 minimumWidth = Math.Max(minimumWidth, sizeRequest.Minimum.Width - assignedWidth - (GetColumnSpan(child) - 1) * grid.ColumnSpacing);
272 columnwWidthSum += Math.Max(0, c.ActualWidth);
284 rowHeightSum += Math.Max(0, r.ActualHeight);
317 double contractionNeeded = Math.Min(contractionSpace, Math.Max(currentSize.Width - targetWidth, 0));
325 double availableSpace = col.ActualWidth - Math.Max(col.MinimumWidth, 0);
352 double contractionNeeded = Math.Min(contractionSpace, Math.Max(currentSize.Height - targetHeight, 0));
394 starColumnWidth = Math.Min(column.ActualWidth, starColumnWidth);
411 double contractionNeeded = Math.Min(contractionSpace, Math.Max(request.Width - targetWidth, 0));
457 starRowHeight = Math.Min(row.ActualHeight, starRowHeight);
473 double contractionNeeded = Math.Min(contractionSpace, Math.Max(request.Height - targetHeight, 0));
500 lastRow = Math.Max(lastRow, GetRow(w) + GetRowSpan(w) - 1);
502 lastRow = Math.Max(lastRow, grid.RowDefinitions.Count - 1);
508 lastCol = Math.Max(lastCol, GetColumn(w) + GetColumnSpan(w) - 1);
510 lastCol = Math.Max(lastCol, grid.ColumnDefinitions.Count - 1);
605 starColWidth = Math.Max(starColWidth, GetUnassignedWidth(width, columnSpacing) / totalStarsWidth);
635 starRowHeight = Math.Max(starRowHeight, GetUnassignedHeight(height, rowSpacing) / totalStarsHeight);
677 actualWidth = Math.Max(actualWidth, sizeRequest.Request.Width - assignedWidth - columnSpacing);
678 minimumWidth = Math.Max(minimumWidth, sizeRequest.Minimum.Width - assignedWidth - columnSpacing);
697 starColRequestWidth = Math.Max(starColRequestWidth, col.ActualWidth / col.Width.Value);
698 starColMinWidth = Math.Max(starColMinWidth, col.MinimumWidth / col.Width.Value);
706 return Math.Max(widthConstraint / totalStarsWidth, starColMinWidth);
738 actualHeight = Math.Max(actualHeight, sizeRequest.Request.Height - assignedHeight - rowSpacing);
739 minimumHeight = Math.Max(minimumHeight, sizeRequest.Minimum.Height - assignedHeight - rowSpacing);
758 starRowRequestHeight = Math.Max(starRowRequestHeight, row.ActualHeight / row.Height.Value);
759 starRowMinHeight = Math.Max(starRowMinHeight, row.MinimumHeight / row.Height.Value);
767 return Math.Max(heightConstraint / totalStarsHeight, starRowMinHeight);
Shapes\Matrix.cs (24)
95 this *= CreateRotationRadians(angle * (Math.PI / 180.0));
102 this = CreateRotationRadians(angle * (Math.PI / 180.0)) * this;
109 this *= CreateRotationRadians(angle * (Math.PI / 180.0), centerX, centerY);
116 this = CreateRotationRadians(angle * (Math.PI / 180.0), centerX, centerY) * this;
148 this *= CreateSkewRadians(skewX * (Math.PI / 180.0),
149 skewY * (Math.PI / 180.0));
157 this = CreateSkewRadians(skewX * (Math.PI / 180.0),
158 skewY * (Math.PI / 180.0)) * this;
560 double sin = Math.Sin(angle);
561 double cos = Math.Cos(angle);
599 matrix.SetMatrix(1.0, Math.Tan(skewY),
600 Math.Tan(skewX), 1.0,
744 rect.X = Math.Min(Math.Min(point0.X, point1.X), Math.Min(point2.X, point3.X));
745 rect.Y = Math.Min(Math.Min(point0.Y, point1.Y), Math.Min(point2.Y, point3.Y));
747 rect.Width = Math.Max(Math.Max(point0.X, point1.X), Math.Max(point2.X, point3.X)) - rect.X;
748 rect.Height = Math.Max(Math.Max(point0.Y, point1.Y), Math.Max(point2.Y, point3.Y)) - rect.Y;
Microsoft.Maui.Controls.BindingSourceGen (1)
Microsoft.Maui.Essentials (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 (16)
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)
87double delta = Math.Abs(GetAngleDeltaFromLast(strokeNode.PreviousPosition, strokeNode.Position, ref lastAngle));
107if ((Math.Min(prevArea, currArea) / Math.Max(prevArea, currArea)) <= 0.70d)
249double maxExtent = Math.Max(drawingAttributes.Height, drawingAttributes.Width);
250percentIntersect += Math.Min(4.99999d, ((maxExtent / 20d) * 5d));
518bool directionChangedOverAbsoluteThreshold = Math.Abs(delta) > 90d && Math.Abs(delta) < (360d - 90d);
519bool directionChangedOverOverlapThreshold = overlap && !(ignorePressure || strokeNode.PressureFactor == 1f) && Math.Abs(delta) > 30d && Math.Abs(delta) < (360d - 30d);
528if ((Math.Min(prevArea, currArea) / Math.Max(prevArea, currArea)) <= 0.90d)
833double intersectLeft = Math.Max(rect1.Left, rect2.Left);
834double intersectTop = Math.Max(rect1.Top, rect2.Top);
835double intersectWidth = Math.Max((double)(Math.Min(rect1.Right, rect2.Right) - intersectLeft), (double)0);
836double intersectHeight = Math.Max((double)(Math.Min(rect1.Bottom, rect2.Bottom) - intersectTop), (double)0);
846double minArea = Math.Min(rect1Area, rect2Area);
1049angle = Math.PI / 2.0;
1053angle = Math.PI * 3.0 / 2.0;
1064angle = Math.PI;
1071angle = Math.Atan(dy / dx) + Math.PI;
1075angle = Math.Atan(dy / dx) + (2 * Math.PI);
1079angle = Math.Atan(dy / dx);
1084angle = angle * 180 / Math.PI;
MS\Internal\Media3D\GeneralTransform2DTo3DTo2D.cs (19)
496if (!((Math.Max(visEdgeStart.X, visEdgeEnd.X) < Math.Min(uv1.X, uv2.X)) ||
497(Math.Min(visEdgeStart.X, visEdgeEnd.X) > Math.Max(uv1.X, uv2.X)) ||
498(Math.Max(visEdgeStart.Y, visEdgeEnd.Y) < Math.Min(uv1.Y, uv2.Y)) ||
499(Math.Min(visEdgeStart.Y, visEdgeEnd.Y) > Math.Max(uv1.Y, uv2.Y))))
600if (Math.Abs(visUV1.X - visUV2.X) > Math.Abs(visUV1.Y - visUV2.Y))
914if (!((Math.Max(visEdgeStart.X, visEdgeEnd.X) < Math.Min(uv1.X, uv2.X)) ||
915(Math.Min(visEdgeStart.X, visEdgeEnd.X) > Math.Max(uv1.X, uv2.X)) ||
916(Math.Max(visEdgeStart.Y, visEdgeEnd.Y) < Math.Min(uv1.Y, uv2.Y)) ||
917(Math.Min(visEdgeStart.Y, visEdgeEnd.Y) > Math.Max(uv1.Y, uv2.Y))))
1084closestIntersection = ((currClosest - edges[i]._p1Transformed).Length / Math.Sqrt(denom) *
MS\Internal\TextFormatting\LineServicesCallbacks.cs (14)
426lstTextMetrics.dvAscent = (int)Math.Round(typeface.Baseline(store.Pap.EmSize, Constants.DefaultIdealToReal, store.Settings.TextSource.PixelsPerDip, fullText.TextFormattingMode));
427lstTextMetrics.dvMultiLineHeight = (int)Math.Round(typeface.LineSpacing(store.Pap.EmSize, Constants.DefaultIdealToReal, store.Settings.TextSource.PixelsPerDip, fullText.TextFormattingMode));
687ulInfo.dvpFirstUnderlineOffset = (int)Math.Round(lsrun.EmSize * -underlinePositionInEm);
688ulInfo.dvpFirstUnderlineSize = (int)Math.Round(lsrun.EmSize * underlineThicknessInEm);
741stInfo.dvpLowerStrikethroughOffset = (int)Math.Round(lsrun.EmSize * strikeThroughPositionInEm);
742stInfo.dvpLowerStrikethroughSize = (int)Math.Round(lsrun.EmSize * strikeThroughThicknessInEm);
936int baselineTop = ptOrigin.y + (int)Math.Round(lsrun.EmSize * strikeThroughPositionInEm);
937int overlineTop = baselineTop - (lsrun.BaselineOffset - (int)Math.Round(lsrun.EmSize * strikeThroughThicknessInEm));
1243penThickness = Math.Abs(penThickness);
1319drawingPenThickness = drawingPenThickness / Math.Abs(unitValue);
1988int expandedBy = Math.Max(0, interWordAdjustTo - adjustedCharWidth);
1995pplsAdjustRight[0][i] = Math.Max(0, adjustedCharWidth - interWordAdjustTo);
2121pplsCompressionRight[0][igi + i] = Math.Max(0, glyphAdvance - interWordCompressTo);
2254int 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);
838int first = Math.Max(ich, dcp) + _cpFirst;
839int afterLast = Math.Min(ich + run.Length, dcp + textLength) + _cpFirst;
1206cpVisible = Math.Max(cpRunStart, cp);
1238cpVisible = 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)
325i = Math.Min(limit, i + formatRider.Length);
398i = Math.Min(limit, i + formatRider.Length);
452i = Math.Min(limit, i + formatRider.Length);
504i = Math.Min(limit, i + formatRider.Length);
562i = Math.Min(limit, i + formatRider.Length);
620i = Math.Min(limit, i + formatRider.Length);
670i = Math.Min(limit, i + formatRider.Length);
721i = Math.Min(limit, i + formatRider.Length);
772i = Math.Min(limit, i + formatRider.Length);
822i = Math.Min(limit, i + formatRider.Length);
961return _that._maxTextWidths[Math.Min(line, _that._maxTextWidths.Length - 1)];
1103Math.Min(textSourcePosition + line.Length - 1, _that._text.Length - 1)
1614int x0 = Math.Max(enumerator.Position, startIndex);
1615int x1 = Math.Min(enumerator.Position + enumerator.Length, startIndex + count);
1766accBlackBoxLeft = Math.Min(accBlackBoxLeft, blackBoxLeft);
1767accBlackBoxRight = Math.Max(accBlackBoxRight, blackBoxRight);
1768accBlackBoxBottom = Math.Max(accBlackBoxBottom, blackBoxBottom);
1769accBlackBoxTop = Math.Min(accBlackBoxTop, blackBoxTop);
1775metrics.Width = Math.Max(metrics.Width, currentLine.Width);
1776metrics.WidthIncludingTrailingWhitespace = Math.Max(metrics.WidthIncludingTrailingWhitespace, currentLine.WidthIncludingTrailingWhitespace);
1777lineStartOfLongestLine = 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);
1447visiblePages.Add(_childrenCollection[_firstPageVisualIndex + j - Math.Max(0, firstPage)]);
1601double 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);
2360newScale = Math.Max(newScale, CurrentMinimumScale);
2361newScale = Math.Min(newScale, DocumentViewerConstants.MaximumScale);
2430scaleFactor = Math.Min(compensatedViewportWidth / rowWidth, compensatedViewportHeight / rowHeight);
2459scaleFactor = Math.Min(compensatedViewportWidth / rowWidth,
2685Math.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);
980_extentWidth = Math.Max(newRow.RowSize.Width, _extentWidth);
1110_extentWidth = Math.Max(row.RowSize.Width, _extentWidth);
1380_rowSize.Height = Math.Max(pageSize.Height, _rowSize.Height);
MS\Internal\Documents\TextBoxView.cs (32)
459desiredSize.Width = Math.Min(constraint.Width, desiredSize.Width);
460desiredSize.Height = Math.Min(constraint.Height, desiredSize.Height);
653int startOffset = Math.Min(_lineMetrics[_lineMetrics.Count - 1].EndOffset, startPosition.Offset);
654int endOffset = Math.Min(_lineMetrics[_lineMetrics.Count - 1].EndOffset, endPosition.Offset);
661firstLineIndex = Math.Max(firstLineIndex, GetLineIndexFromOffset(startOffset, LogicalDirection.Forward));
662lastLineIndex = Math.Min(lastLineIndex, GetLineIndexFromOffset(endOffset, LogicalDirection.Backward));
731int nextLineIndex = Math.Max(0, Math.Min(_lineMetrics.Count - 1, lineIndex + count));
1749Math.Max(0, Math.Min(_scrollData.ExtentWidth - _scrollData.ViewportWidth, _scrollData.HorizontalOffset)),
1750Math.Max(0, Math.Min(_scrollData.ExtentHeight - _scrollData.ViewportHeight, _scrollData.VerticalOffset)));
1896int endOffset = Math.Min(range.StartIndex + range.PositionsAdded, _host.TextContainer.SymbolCount);
2007int startOffset = Math.Max(_lineMetrics[lineIndex].Offset, unclippedStartOffset);
2008int endOffset = Math.Min(_lineMetrics[lineIndex].EndOffset, unclippedEndOffset);
2103int startOffset = Math.Max(lineStartOffset, unclippedStartOffset);
2104int endOffset = Math.Min(lineEndOffset, unclippedEndOffset);
2163lastLineIndex = (int)Math.Ceiling((viewport.Y + viewport.Height) / _lineHeight) - 1;
2166firstLineIndex = Math.Max(0, Math.Min(firstLineIndex, _lineMetrics.Count - 1));
2167lastLineIndex = Math.Max(0, Math.Min(lastLineIndex, _lineMetrics.Count - 1));
2239desiredSize.Width = Math.Max(desiredSize.Width, line.Width);
2513int lastCoveredCharOffset = range.StartIndex + Math.Max(range.PositionsAdded, range.PositionsRemoved);
2609desiredSize.Width = Math.Max(desiredSize.Width, _lineMetrics[i].Width);
2672int lineIndex = Math.Max(oldLineVisualsIndex, firstLineIndex);
2673int lineCount = Math.Min(oldLastLineIndex, firstLineIndex + count - 1) - lineIndex + 1;
2767count = Math.Max(0, count);
2773count = Math.Min(count, _viewportLineVisuals.Count - start);
2951int rangeStart = Math.Max(viewportStart, selectionStart);
2952int rangeSize = Math.Min(viewportEnd, selectionEnd) - rangeStart;
3088padding = Math.Max(0, viewport.Height - _contentSize.Height);
MS\Internal\Ink\LassoHelper.cs (6)
108double step = Math.Sqrt(MinDistanceSquared / distanceSquared);
228&& DoubleUtil.GreaterThanOrClose(point.X, Math.Min(prevLassoPoint.X, lassoPoint.X))
229&& DoubleUtil.LessThanOrClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
238if (DoubleUtil.GreaterThanOrClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
244if ((0 == i) && DoubleUtil.AreClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X)))
249else if (DoubleUtil.GreaterThanOrClose(point.X, Math.Min(prevLassoPoint.X, lassoPoint.X)))
MS\Internal\PtsHost\ContainerParagraph.cs (13)
505fsrcToFillSubtrack.u = Math.Max(Math.Min(fsrcToFillSubtrack.u, fsrcToFill.u + fsrcToFill.du - 1), fsrcToFill.u);
506fsrcToFillSubtrack.du = Math.Max(fsrcToFillSubtrack.du, 0);
519fsrcToFillSubtrack.v = Math.Max(Math.Min(fsrcToFillSubtrack.v, fsrcToFill.v + fsrcToFill.dv - 1), fsrcToFill.v);
520fsrcToFillSubtrack.dv = Math.Max(fsrcToFillSubtrack.dv, 0);
580dvrUsed = Math.Min(fsrcToFill.dv, dvrUsed);
663urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack);
664durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
793urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack);
794durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
MS\Internal\PtsHost\SubpageParagraph.cs (16)
167subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
176subpageHeight = Math.Max(1, subpageHeight - (marginTop + mbp.BPTop));
230dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
231fsrcToFill.du = Math.Max(fsrcToFill.du, fsbbox.fsrc.du + fsbbox.fsrc.u);
274fsbbox.fsrc.du = Math.Max(fsrcToFill.du - (mbp.MarginLeft + mbp.MarginRight), 0);
275fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
354subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
426dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
427durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u);
437fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0);
438fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
514subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight));
585dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v);
586durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u);
596fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0);
597fsbbox.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));
643Math.Max(0.0, rt.Width - thick.Left - thick.Right),
644Math.Max(0.0, rt.Height - thick.Top - thick.Bottom));
987LeftTop = Math.Max(0.0, radii.TopLeft - left);
988TopLeft = Math.Max(0.0, radii.TopLeft - top);
989TopRight = Math.Max(0.0, radii.TopRight - top);
990RightTop = Math.Max(0.0, radii.TopRight - right);
991RightBottom = Math.Max(0.0, radii.BottomRight - right);
992BottomRight = Math.Max(0.0, radii.BottomRight - bottom);
993BottomLeft = Math.Max(0.0, radii.BottomLeft - bottom);
994LeftBottom = Math.Max(0.0, radii.BottomLeft - left);
System\Windows\Controls\DataGrid.cs (18)
2630indexToSelect = Math.Min(Items.Count - numSelected - 1, indexToSelect);
5032int newRowCount = Math.Abs(endIndex - startIndex) + 1;
5033int newColumnCount = Math.Abs(endColumnIndex - startColumnIndex) + 1;
5051int previousStartIndex = Math.Min(startIndex, currentCellIndex);
5052int previousRowCount = Math.Abs(currentCellIndex - startIndex) + 1;
5053int previousStartColumnIndex = Math.Min(startColumnIndex, currentCellColumnIndex);
5054int previousColumnCount = Math.Abs(currentCellColumnIndex - startColumnIndex) + 1;
5094_selectedCells.AddRegion(Math.Min(startIndex, endIndex), Math.Min(startColumnIndex, endColumnIndex), newRowCount, newColumnCount);
5692nextDisplayIndex = Math.Max(0, InternalColumns.LastVisibleDisplayIndex);
5773nextRowIndex = Math.Max(0, Items.Count - 1);
5958index = Math.Max(0, Math.Min(numItems - 1, index + (shiftModifier ? -1 : 1)));
6098int jumpDistance = Math.Max(1, (int)scrollHost.ViewportHeight - 1);
6100targetIndex = Math.Max(0, Math.Min(targetIndex, Items.Count - 1));
6543distance = Math.Abs(pt.Y - cellBounds.Top);
6551distance = 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);
1228double displayValue = Math.Max(width.DesiredValue, minWidth);
1268double displayValue = Math.Min(width.DesiredValue, maxWidth);
1336TakeAwayWidthFromColumns(null, Math.Abs(availableSpaceChange), false, newTotalAvailableSpace);
1360column.SetWidthInternal(new DataGridLength(width.Value, width.UnitType, width.DesiredValue, Math.Min(width.DesiredValue, maxWidth)));
1382Math.Max(width.DisplayValue - nonRetrievableSpace, changedColumn.MinWidth)));
1454return Math.Max(availableSpace - requiredSpace, 0.0);
1665column.UpdateWidthForStarColumn(Math.Max(columnDesiredWidth, column.MinWidth), columnDesiredWidth, columnDesiredWidth / perStarWidth);
1694double columnExcessWidth = onlyShrinkToDesiredWidth ? width.DisplayValue - Math.Max(width.DesiredValue, column.MinWidth) : width.DisplayValue - column.MinWidth;
1779double maxColumnResizeWidth = expandBeyondDesiredWidth ? column.MaxWidth : Math.Min(width.DesiredValue, column.MaxWidth);
1914column.UpdateWidthForStarColumn(Math.Min(columnDesiredWidth, column.MaxWidth), columnDesiredWidth, columnDesiredWidth / perStarWidth);
2001double usedStarSpace = ComputeStarColumnWidths(Math.Min(expectedStarSpace, sumOfStarMaxWidths));
2002giveAwayWidth = Math.Max(usedStarSpace - expectedStarSpace, 0.0);
2072double lagWidth = Math.Min(width.DesiredValue, columnMaxWidth) - width.DisplayValue;
2103if (DoubleUtil.LessThan(width.DisplayValue, Math.Min(width.DesiredValue, column.MaxWidth)))
2131giveAwayWidth -= Math.Min(contributingSpace, giveAwayWidth);
2138giveAwayWidth = Math.Min(giveAwayWidth, Math.Max(0d, totalSpace - usedSpace));
2185return Math.Min(usedSpace - totalAvailableWidth, takeAwayWidth);
2193takeAwayWidth = Math.Max(0.0, takeAwayWidth - unusedSpace);
2264double usedStarSpace = ComputeStarColumnWidths(Math.Max(expectedStarSpace, sumOfStarMinWidths));
2265takeAwayWidth = Math.Max(usedStarSpace - expectedStarSpace, 0.0);
System\Windows\Controls\DockPanel.cs (10)
217childConstraint = new Size(Math.Max(0.0, constraint.Width - accumulatedWidth),
218Math.Max(0.0, constraint.Height - accumulatedHeight));
238parentHeight = Math.Max(parentHeight, accumulatedHeight + childDesiredSize.Height);
244parentWidth = Math.Max(parentWidth, accumulatedWidth + childDesiredSize.Width);
251parentWidth = Math.Max(parentWidth, accumulatedWidth);
252parentHeight = Math.Max(parentHeight, accumulatedHeight);
282Math.Max(0.0, arrangeSize.Width - (accumulatedLeft + accumulatedRight)),
283Math.Max(0.0, arrangeSize.Height - (accumulatedTop + accumulatedBottom)) );
296rcChild.X = Math.Max(0.0, arrangeSize.Width - accumulatedRight);
307rcChild.Y = Math.Max(0.0, arrangeSize.Height - accumulatedBottom);
System\Windows\Controls\FlowDocumentScrollViewer.cs (8)
588Math.Max(ia.OriginWidth, pagePadding.Left),
589Math.Max(ia.OriginHeight, pagePadding.Top),
590Math.Max(ia.MediaSizeWidth - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right),
591Math.Max(ia.MediaSizeHeight - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom));
627Zoom = Math.Min(Zoom + ZoomIncrement, MaxZoom);
639Zoom = Math.Max(Zoom - ZoomIncrement, MinZoom);
705SetCurrentValueInternal(ZoomProperty, Math.Min(Zoom + ZoomIncrement, MaxZoom));
709SetCurrentValueInternal(ZoomProperty, Math.Max(Zoom - ZoomIncrement, MinZoom));
System\Windows\Controls\Grid.cs (69)
369gridDesiredSize.Width = Math.Max(gridDesiredSize.Width, child.DesiredSize.Width);
370gridDesiredSize.Height = Math.Max(gridDesiredSize.Height, child.DesiredSize.Height);
900ColumnIndex = Math.Min(GetColumn(child), DefinitionsU.Length - 1),
903RowIndex = Math.Min(GetRow(child), DefinitionsV.Length - 1)
909cell.ColumnSpan = Math.Min(GetColumnSpan(child), DefinitionsU.Length - cell.ColumnIndex);
913cell.RowSpan = Math.Min(GetRowSpan(child), DefinitionsV.Length - cell.RowIndex);
1090userMinSize = Math.Max(userMinSize, Math.Min(userSize, userMaxSize));
1114definitions[i].MeasureSize = Math.Max(userMinSize, Math.Min(userSize, userMaxSize));
1214DefinitionsU[PrivateCells[i].ColumnIndex].UpdateMinSize(Math.Min(children[i].DesiredSize.Width, DefinitionsU[PrivateCells[i].ColumnIndex].UserMaxSize));
1231DefinitionsV[PrivateCells[i].RowIndex].UpdateMinSize(Math.Min(children[i].DesiredSize.Height, DefinitionsV[PrivateCells[i].RowIndex].UserMaxSize));
1452double maxSize = Math.Max(definitions[i].UserMaxSize, minSize);
1504double newMinSize = Math.Min(sizeToDistribute / (count - i), tempDefinitions[i].PreferredSize);
1534tempDefinitions[i].UpdateMinSize(Math.Min(newMinSize, tempDefinitions[i].SizeCache));
1545tempDefinitions[i].UpdateMinSize(Math.Min(newMinSize, tempDefinitions[i].SizeCache));
1656starValue = Math.Min(starValue, c_starClip);
1660double maxSize = Math.Max(definitions[i].MinSize, definitions[i].UserMaxSize);
1661maxSize = Math.Min(maxSize, c_starClip);
1699double userSize = Math.Max(availableSize - takenSize, 0.0) * (starValue / tempDefinitions[i].SizeCache);
1700resolvedSize = Math.Min(userSize, tempDefinitions[i].UserMaxSize);
1701resolvedSize = Math.Max(tempDefinitions[i].MinSize, resolvedSize);
1762double power = Math.Floor(Math.Log(Double.MaxValue / maxStar / starCount, 2.0));
1765scale = Math.Pow(2.0, power - 4.0); // -4 is just for paranoia
1813double effectiveMaxSize = Math.Max(def.MinSize, def.UserMaxSize);
1885resolvedSize = Math.Max(resolvedDef.MinSize, resolvedDef.UserMaxSize);
2003double resolvedSize = (def.MeasureSize > 0.0) ? Math.Max(availableSize - takenSize, 0.0) * (def.MeasureSize / def.SizeCache) : 0.0;
2006resolvedSize = Math.Min(resolvedSize, def.UserMaxSize);
2007resolvedSize = Math.Max(def.MinSize, resolvedSize);
2096starValue = Math.Min(starValue, c_starClip);
2100double maxSize = Math.Max(definitions[i].MinSizeForArrange, definitions[i].UserMaxSize);
2101maxSize = Math.Min(maxSize, c_starClip);
2141definitions[i].SizeCache = Math.Max(definitions[i].MinSizeForArrange, Math.Min(userSize, userMaxSize));
2186double userSize = Math.Max(finalSize - allPreferredArrangeSize, 0.0) * (starValue / definitions[definitionIndices[i]].SizeCache);
2187resolvedSize = Math.Min(userSize, definitions[definitionIndices[i]].UserMaxSize);
2188resolvedSize = Math.Max(definitions[definitionIndices[i]].MinSizeForArrange, resolvedSize);
2213final = Math.Max(final, definitions[definitionIndex].MinSizeForArrange);
2214final = Math.Min(final, definitions[definitionIndex].SizeCache);
2220final = Math.Max(final, definitions[definitionIndex].MinSizeForArrange);
2221final = Math.Min(final, definitions[definitionIndex].SizeCache);
2254final = Math.Max(final, definition.MinSizeForArrange);
2270final = Math.Max(final, definition.MinSizeForArrange);
2341double power = Math.Floor(Math.Log(Double.MaxValue / maxStar / starCount, 2.0));
2344scale = Math.Pow(2.0, power - 4.0); // -4 is just for paranoia
2388double effectiveMaxSize = Math.Max(def.MinSizeForArrange, def.UserMaxSize);
2427def.SizeCache = Math.Max(def.MinSizeForArrange, Math.Min(userSize, userMaxSize));
2496resolvedSize = Math.Max(resolvedDef.MinSizeForArrange, resolvedDef.UserMaxSize);
2628double resolvedSize = (def.MeasureSize > 0.0) ? Math.Max(finalSize - takenSize, 0.0) * (def.MeasureSize / def.SizeCache) : 0.0;
2631resolvedSize = Math.Min(resolvedSize, def.UserMaxSize);
2632resolvedSize = Math.Max(def.MinSizeForArrange, resolvedSize);
2723final = Math.Max(final, definition.MinSizeForArrange);
2739final = Math.Max(final, definition.MinSizeForArrange);
2781double minPower = Math.Floor(Math.Log(minRatio, 2.0));
2782double maxPower = Math.Floor(Math.Log(maxRatio, 2.0));
2783double f = Math.Pow(2.0, Math.Floor((minPower + maxPower) / 2.0));
2862Array.Clear(extData.TempDefinitions, 0, Math.Max(DefinitionsU.Length, DefinitionsV.Length));
3067int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length) * 2;
3100int requiredLength = Math.Max(Math.Max(DefinitionsU.Length, DefinitionsV.Length), 1) * 2;
3118int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length);
3210return (Math.Abs(d) < c_epsilon);
3221return (Math.Abs(d1 - d2) < c_epsilon);
System\Windows\Controls\GridSplitter.cs (13)
504_resizeData.SplitterLength = Math.Min(ActualWidth, ActualHeight);
656horizontalChange = Math.Round(horizontalChange / dragIncrement) * dragIncrement;
657verticalChange = Math.Round(verticalChange / dragIncrement) * dragIncrement;
664_resizeData.Adorner.OffsetX = Math.Min(Math.Max(horizontalChange, _resizeData.MinChange), _resizeData.MaxChange);
668_resizeData.Adorner.OffsetY = Math.Min(Math.Max(verticalChange, _resizeData.MinChange), _resizeData.MaxChange);
802definition1Min = Math.Max(definition1Min, _resizeData.SplitterLength);
806definition2Min = Math.Max(definition2Min, _resizeData.SplitterLength);
812minDelta = -Math.Min(definition1Len - definition1Min, definition2Max - definition2Len);
813maxDelta = Math.Min(definition1Max - definition1Len, definition2Len - definition2Min);
921delta = Math.Min(Math.Max(delta, min), max);
System\Windows\Controls\GridViewHeaderRowPresenter.cs (8)
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);
1249return (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);
638return DoubleUtil.GreaterThan(Math.Abs(currentPos.X - originalPos.X), SystemParameters.MinimumHorizontalDragDistance);
687height = Math.Max(_draggingSrcColumnHeader.RenderSize.Height, _columnHeaderDragIndicator.Height);
912columnEstimatedWidth = Math.Max(averageColumnWidth, column.MinWidth);
913columnEstimatedWidth = Math.Min(columnEstimatedWidth, column.MaxWidth);
System\Windows\Controls\Primitives\Popup.cs (26)
2115if (Math.Abs(score - childArea) < Tolerance)
2141if (Math.Abs(intersection.Width - childBounds.Width) > Tolerance ||
2142Math.Abs(intersection.Height - childBounds.Height) > Tolerance)
2156if (!IsTransparent || double.IsNaN(horizontalAxis.Y) || Math.Abs(horizontalAxis.Y) < Tolerance)
2168else if (IsTransparent && Math.Abs(horizontalAxis.X) < Tolerance)
2191if (!IsTransparent || double.IsNaN(verticalAxis.X) || Math.Abs(verticalAxis.X) < Tolerance)
2202else if (IsTransparent && Math.Abs(verticalAxis.Y) < Tolerance)
2257if (!IsTransparent || double.IsNaN(verticalAxis.X) || Math.Abs(verticalAxis.X) < Tolerance)
2259limitSize.Height = Math.Max(0.0, Math.Max(screenBounds.Bottom - targetBounds.Bottom, targetBounds.Top - screenBounds.Top));
2261else if (IsTransparent && Math.Abs(verticalAxis.Y) < Tolerance)
2263limitSize.Width = Math.Max(0.0, Math.Max(screenBounds.Right - targetBounds.Right, targetBounds.Left - screenBounds.Left));
2279if (!IsTransparent || double.IsNaN(horizontalAxis.X) || Math.Abs(horizontalAxis.Y) < Tolerance)
2281limitSize.Width = Math.Max(0.0, Math.Max(screenBounds.Right - targetBounds.Right, targetBounds.Left - screenBounds.Left));
2283else if (IsTransparent && Math.Abs(horizontalAxis.X) < Tolerance)
2285limitSize.Height = Math.Max(0.0, Math.Max(screenBounds.Bottom - targetBounds.Bottom, targetBounds.Top - screenBounds.Top));
2635desiredSize.Width = Math.Min(desiredSize.Width, screenBounds.Width);
2636desiredSize.Width = Math.Min(desiredSize.Width, limitSize.Width);
2640desiredSize.Height = Math.Min(desiredSize.Height, screenBounds.Height);
2641desiredSize.Height = Math.Min(desiredSize.Height, maxHeight);
2642desiredSize.Height = Math.Min(desiredSize.Height, limitSize.Height);
2715return 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); }
1748DoubleUtil.LessThan(Math.Abs(unusedX), PanningInfo.PreFeedbackTranslationX))
1756DoubleUtil.LessThan(Math.Abs(unusedY), PanningInfo.PreFeedbackTranslationY))
1801double newUnused = Math.Max(unused + delta, 0);
1810double newUnused = Math.Min(unused + delta, 0);
1821Math.Round(PanningRatio * cumulativeTranslation / _panningInfo.DeltaPerHorizontalOffet));
1831Math.Round(PanningRatio * cumulativeTranslation / _panningInfo.DeltaPerVerticalOffset));
1844if (Math.Abs(Environment.TickCount - _panningInfo.InertiaBoundaryBeginTimestamp) < PanningInfo.InertiaBoundryMinimumTicks)
1849return (DoubleUtil.GreaterThanOrClose(Math.Abs(_panningInfo.UnusedTranslation.X), PanningInfo.MaxInertiaBoundaryTranslation) ||
1850DoubleUtil.GreaterThanOrClose(Math.Abs(_panningInfo.UnusedTranslation.Y), PanningInfo.MaxInertiaBoundaryTranslation));
1869bool validX = (DoubleUtil.GreaterThan(Math.Abs(translation.X), PanningInfo.PrePanTranslation));
1870bool validY = (DoubleUtil.GreaterThan(Math.Abs(translation.Y), PanningInfo.PrePanTranslation));
1880bool biggerX = (DoubleUtil.GreaterThanOrClose(Math.Abs(translation.X), Math.Abs(translation.Y)));
1893bool biggerY = (DoubleUtil.GreaterThanOrClose(Math.Abs(translation.Y), Math.Abs(translation.X)));
System\Windows\Controls\SinglePageViewer.cs (6)
703Math.Max(ia.OriginWidth, pagePadding.Left),
704Math.Max(ia.OriginHeight, pagePadding.Top),
705Math.Max(ia.MediaSizeWidth - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right),
706Math.Max(ia.MediaSizeHeight - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom));
744SetCurrentValueInternal(ZoomProperty, Math.Min(Zoom + ZoomIncrement, MaxZoom));
756SetCurrentValueInternal(ZoomProperty, Math.Max(Zoom - ZoomIncrement, MinZoom));
System\Windows\Controls\Slider.cs (15)
991valueToSize = Math.Max(0.0, (trackSize.Width - thumbSize.Width) / range);
997Canvas.SetLeft(rangeElement, (thumbSize.Width * 0.5) + Math.Max(Maximum - SelectionEnd, 0) * valueToSize);
1001Canvas.SetLeft(rangeElement, (thumbSize.Width * 0.5) + Math.Max(SelectionStart - Minimum, 0) * valueToSize);
1013valueToSize = Math.Max(0.0, (trackSize.Height - thumbSize.Height) / range);
1019Canvas.SetTop(rangeElement, (thumbSize.Height * 0.5) + Math.Max(SelectionStart - Minimum, 0) * valueToSize);
1023Canvas.SetTop(rangeElement, (thumbSize.Height * 0.5) + Math.Max(Maximum - SelectionEnd,0) * valueToSize);
1056valueToSize = Math.Max(0.0, (trackSize.Width - thumbSize.Width) / range);
1080valueToSize = Math.Max(0.0, (trackSize.Height - thumbSize.Height) / range);
1188previous = Minimum + (Math.Round(((value - Minimum) / TickFrequency)) * TickFrequency);
1189next = Math.Min(Maximum, previous + TickFrequency);
1209double next = SnapToTick(Math.Max(this.Minimum, Math.Min(this.Maximum, value + direction)));
1247double tickNumber = Math.Round((value - Minimum) / TickFrequency);
1408this.SetCurrentValueInternal(ValueProperty, Math.Max(this.Minimum, Math.Min(this.Maximum, snappedValue)));
System\Windows\Controls\Stack.cs (15)
594stackDesiredSize.Height = Math.Max(stackDesiredSize.Height, childDesiredSize.Height);
599stackDesiredSize.Width = Math.Max(stackDesiredSize.Width, childDesiredSize.Width);
659offset.Y = Math.Max(0, Math.Min(offset.Y, extent.Height - viewport.Height));
667offset.X = Math.Max(0, Math.Min(offset.X, extent.Width - viewport.Width));
672stackDesiredSize.Width = Math.Min(stackDesiredSize.Width, constraint.Width);
673stackDesiredSize.Height = Math.Min(stackDesiredSize.Height, constraint.Height);
751rcChild.Height = Math.Max(arrangeSize.Height, child.DesiredSize.Height);
758rcChild.Width = Math.Max(arrangeSize.Width, child.DesiredSize.Width);
892double left = Math.Max(targetRectOffset, minPhysicalOffset);
893targetRectSize = Math.Max(Math.Min(targetRectSize + targetRectOffset, minPhysicalOffset + viewportSize) - left, 0);
991iNewOffset = Math.Max(Math.Min(numberOfItems - 1, iNewOffset), 0);
System\Windows\Controls\TextBlock.cs (12)
1260Size contentSize = new Size(Math.Max(0.0, constraint.Width - (padding.Left + padding.Right)),
1261Math.Max(0.0, constraint.Height - (padding.Top + padding.Bottom)));
1300desiredSize.Width = Math.Max(desiredSize.Width, line.GetCollapsedWidth());
1523double contentBottom = Math.Max(0.0, RenderSize.Height - Padding.Bottom);
1957Size contentSize = new Size(Math.Max(0.0, _referenceSize.Width - (padding.Left + padding.Right)),
1958Math.Max(0.0, _referenceSize.Height - (padding.Top + padding.Bottom)));
2310int dcpStart = Math.Max(dcpLineStart, dcpPositionStart);
2311int dcpEnd = Math.Min(dcpLineEnd, dcpPositionEnd);
3097Size contentSize = new Size(Math.Max(0.0, computedSize.Width - (padding.Left + padding.Right)),
3098Math.Max(0.0, computedSize.Height - (padding.Top + padding.Bottom)));
3147double contentBottom = Math.Max(0.0, RenderSize.Height - Padding.Bottom);
3177width = 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);
2320double factor = Math.Min(1.0, isHorizontal ? viewport.Width / extendedViewport.Width : viewport.Height / extendedViewport.Height);
2321int calcItemsInViewportCount = (int)Math.Ceiling(factor * _itemsInExtendedViewportCount);
2322excludeCount = Math.Max(excludeCount,
2616double spanBeforeViewport = Math.Max(isHorizontal ? viewport.X : viewport.Y, 0.0);
2673_firstItemInExtendedViewportIndex = Math.Max(_firstItemInExtendedViewportIndex - 1, 0);
2675_firstItemInExtendedViewportChildIndex = Math.Max(_firstItemInExtendedViewportChildIndex, 0);
3370arrangeLength = Math.Max(isHorizontal ? arrangeSize.Height : arrangeSize.Width, arrangeLength);
4739pixelSizeBeforeViewport = Math.Max(pixelSizeBeforeViewport, Math.Abs(_viewport.X - _extendedViewport.X));
4743logicalSizeBeforeViewport = Math.Max(logicalSizeBeforeViewport, Math.Abs(_viewport.X - _extendedViewport.X));
4775extendedViewport.Width = Math.Max(extendedViewport.Width + extendedViewport.X, 0.0);
4786extendedViewport.Width = Math.Max(_scrollData._extent.Width - extendedViewport.X, 0.0);
4815extendedViewport.Width = Math.Max(extendedViewport.Width / approxSizeOfLogicalUnit + extendedViewport.X, 0.0) * approxSizeOfLogicalUnit;
4826extendedViewport.Width = Math.Max(_scrollData._extent.Width - extendedViewport.X, 0.0) * approxSizeOfLogicalUnit;
4855pixelSizeBeforeViewport = Math.Max(pixelSizeBeforeViewport, Math.Abs(_viewport.Y - _extendedViewport.Y));
4859logicalSizeBeforeViewport = Math.Max(logicalSizeBeforeViewport, Math.Abs(_viewport.Y - _extendedViewport.Y));
4891extendedViewport.Height = Math.Max(extendedViewport.Height + extendedViewport.Y, 0.0);
4902extendedViewport.Height = Math.Max(_scrollData._extent.Height - extendedViewport.Y, 0.0);
4931extendedViewport.Height = Math.Max(extendedViewport.Height / approxSizeOfLogicalUnit + extendedViewport.Y, 0.0) * approxSizeOfLogicalUnit;
4942extendedViewport.Height = Math.Max(_scrollData._extent.Height - extendedViewport.Y, 0.0) * approxSizeOfLogicalUnit;
4954double factor = Math.Max(1.0, isHorizontal ? extendedViewport.Width / viewport.Width : extendedViewport.Height / viewport.Height);
4955int calcItemsInExtendedViewportCount = (int)Math.Ceiling(factor * _actualItemsInExtendedViewportCount);
4956itemsInExtendedViewportCount = Math.Max(calcItemsInExtendedViewportCount, itemsInExtendedViewportCount);
5067viewport.Width = Math.Max(viewport.Width - sizeAfterStartViewportEdge, 0);
5071cacheBeforeSize = Math.Max(cacheBeforeSize - sizeBeforeStartViewportEdge, 0);
5075cacheBeforeSize = Math.Max(cacheBeforeSize - Math.Floor(logicalSize.Width * sizeBeforeStartViewportEdge / pixelSize.Width), 0);
5102viewport.Width = Math.Max(0, parentViewport.Width - pixelSize.Width);
5117cacheAfterSize = Math.Max(cacheAfterSize - sizeAfterEndViewportEdge, 0);
5121cacheAfterSize = Math.Max(cacheAfterSize - Math.Floor(logicalSize.Width * sizeAfterEndViewportEdge / pixelSize.Width), 0);
5133cacheAfterSize = Math.Max(cacheAfterSize - pixelSize.Width, 0);
5137cacheAfterSize = Math.Max(cacheAfterSize - logicalSize.Width, 0);
5166viewport.Height = Math.Max(viewport.Height - sizeAfterStartViewportEdge, 0);
5170cacheBeforeSize = Math.Max(cacheBeforeSize - sizeBeforeStartViewportEdge, 0);
5174cacheBeforeSize = Math.Max(cacheBeforeSize - Math.Floor(logicalSize.Height * sizeBeforeStartViewportEdge / pixelSize.Height), 0);
5201viewport.Height = Math.Max(0, parentViewport.Height - pixelSize.Height);
5216cacheAfterSize = Math.Max(cacheAfterSize - sizeAfterEndViewportEdge, 0);
5220cacheAfterSize = Math.Max(cacheAfterSize - Math.Floor(logicalSize.Height * sizeAfterEndViewportEdge / pixelSize.Height), 0);
5232cacheAfterSize = Math.Max(cacheAfterSize - pixelSize.Height, 0);
5236cacheAfterSize = Math.Max(cacheAfterSize - logicalSize.Height, 0);
5301cacheBeforeSize = Math.Max(0, cacheBeforeSize - parentViewport.X);
5306viewport.Width = Math.Max(0, viewport.Width + viewport.X);
5326cacheBeforeSize = Math.Max(0, cacheBeforeSize - inset.Right);
5330cacheBeforeSize = Math.Max(0, cacheBeforeSize - 1);
5345viewport.Width = Math.Max(0, viewport.Width - inset.Left);
5356cacheAfterSize = Math.Max(0, cacheAfterSize - (inset.Left - viewport.Width));
5373cacheAfterSize = Math.Max(0, cacheAfterSize - inset.Left);
5377cacheAfterSize = Math.Max(0, cacheAfterSize - 1);
5404cacheBeforeSize = Math.Max(0, cacheBeforeSize - parentViewport.Y);
5409viewport.Height = Math.Max(0, viewport.Height + viewport.Y);
5429cacheBeforeSize = Math.Max(0, cacheBeforeSize - inset.Bottom);
5433cacheBeforeSize = Math.Max(0, cacheBeforeSize - 1);
5448viewport.Height = Math.Max(0, viewport.Height - inset.Top);
5459cacheAfterSize = Math.Max(0, cacheAfterSize - (inset.Top - viewport.Height));
5476cacheAfterSize = Math.Max(0, cacheAfterSize - inset.Top);
5480cacheAfterSize = Math.Max(0, cacheAfterSize - 1);
5536double spanBeforeViewport = Math.Max(isHorizontal ? viewport.X : viewport.Y, 0.0);
5548firstItemInViewportIndex = (int)Math.Floor(spanBeforeViewport / childSize);
6524double eps = (Math.Abs(value1) + Math.Abs(value2)) * Tolerance;
6705childViewport.X = Math.Min(childViewport.X, 0) -
6708childViewport.Width = Math.Max(childViewport.Width - stackPixelSizeInViewport.Width, 0.0);
6713childViewport.Width = Math.Max(childViewport.Width - stackPixelSizeInViewport.Width, 0.0);
6721Math.Max(parentCacheSize.CacheBeforeViewport - stackLogicalSizeInCacheBeforeViewport.Width, 0.0),
6724Math.Max(parentCacheSize.CacheAfterViewport - stackLogicalSizeInCacheAfterViewport.Width, 0.0));
6732Math.Max(parentCacheSize.CacheBeforeViewport - stackPixelSizeInCacheBeforeViewport.Width, 0.0),
6735Math.Max(parentCacheSize.CacheAfterViewport - stackPixelSizeInCacheAfterViewport.Width, 0.0));
6750childViewport.Y = Math.Min(childViewport.Y, 0) -
6754childViewport.Height = Math.Max(childViewport.Height - stackPixelSizeInViewport.Height, 0.0);
6759childViewport.Height = Math.Max(childViewport.Height - stackPixelSizeInViewport.Height, 0.0);
6767Math.Max(parentCacheSize.CacheBeforeViewport - stackLogicalSizeInCacheBeforeViewport.Height, 0.0),
6770Math.Max(parentCacheSize.CacheAfterViewport - stackLogicalSizeInCacheAfterViewport.Height, 0.0));
6778Math.Max(parentCacheSize.CacheBeforeViewport - stackPixelSizeInCacheBeforeViewport.Height, 0.0),
6781Math.Max(parentCacheSize.CacheAfterViewport - stackPixelSizeInCacheAfterViewport.Height, 0.0));
6888childLogicalSize.Width = Math.Max(itemDesiredSizes.LogicalSize.Width, logicalHeaderSize.Width);
6893childLogicalSize.Height = Math.Max(itemDesiredSizes.LogicalSize.Height, logicalHeaderSize.Height);
7092Size frontPixelSize = isHorizontal ? new Size(Math.Max(inset.Left,0), childDesiredSize.Height)
7093: new Size(childDesiredSize.Width, Math.Max(inset.Top, 0));
7106Size backPixelSize = isHorizontal ? new Size(Math.Max(inset.Right,0), childDesiredSize.Height)
7107: new Size(childDesiredSize.Width, Math.Max(inset.Bottom,0));
7120adjustedChildViewport.Width = Math.Max(0, adjustedChildViewport.Width - childPixelSizeInViewport.Width);
7126adjustedChildViewport.Height = Math.Max(0, adjustedChildViewport.Height - childPixelSizeInViewport.Height);
7211pixelSizeBeforeViewport = DoubleUtil.LessThan(childViewport.X, childPixelSize.Width) ? Math.Max(childViewport.X, 0.0) : childPixelSize.Width;
7212pixelSizeInViewport = Math.Min(childViewport.Width, childPixelSize.Width - pixelSizeBeforeViewport);
7213pixelSizeAfterViewport = 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
7258logicalSizeBeforeViewport = Math.Floor(childLogicalSize.Width * pixelSizeBeforeViewport / childPixelSize.Width);
7259logicalSizeAfterViewport = Math.Floor(childLogicalSize.Width * pixelSizeAfterViewport / childPixelSize.Width);
7267double childPixelHeightInViewport = Math.Min(childViewport.Height, childPixelSize.Height - Math.Max(childViewport.Y, 0.0));
7270childPixelSizeInViewport.Height = Math.Max(childPixelSizeInViewport.Height, childPixelHeightInViewport);
7272childPixelSizeInCacheBeforeViewport.Height = Math.Max(childPixelSizeInCacheBeforeViewport.Height, childPixelHeightInViewport);
7274childPixelSizeInCacheAfterViewport.Height = Math.Max(childPixelSizeInCacheAfterViewport.Height, childPixelHeightInViewport);
7277childLogicalSizeInViewport.Height = Math.Max(childLogicalSizeInViewport.Height, childLogicalSize.Height);
7279childLogicalSizeInCacheBeforeViewport.Height = Math.Max(childLogicalSizeInCacheBeforeViewport.Height, childLogicalSize.Height);
7281childLogicalSizeInCacheAfterViewport.Height = Math.Max(childLogicalSizeInCacheAfterViewport.Height, childLogicalSize.Height);
7303pixelSizeBeforeViewport = DoubleUtil.LessThan(childViewport.Y, childPixelSize.Height) ? Math.Max(childViewport.Y, 0.0) : childPixelSize.Height;
7304pixelSizeInViewport = Math.Min(childViewport.Height, childPixelSize.Height - pixelSizeBeforeViewport);
7305pixelSizeAfterViewport = 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
7350logicalSizeBeforeViewport = Math.Floor(childLogicalSize.Height * pixelSizeBeforeViewport / childPixelSize.Height);
7351logicalSizeAfterViewport = Math.Floor(childLogicalSize.Height * pixelSizeAfterViewport / childPixelSize.Height);
7359double childPixelWidthInViewport = Math.Min(childViewport.Width, childPixelSize.Width - Math.Max(childViewport.X, 0.0));
7362childPixelSizeInViewport.Width = Math.Max(childPixelSizeInViewport.Width, childPixelWidthInViewport);
7364childPixelSizeInCacheBeforeViewport.Width = Math.Max(childPixelSizeInCacheBeforeViewport.Width, childPixelWidthInViewport);
7366childPixelSizeInCacheAfterViewport.Width = Math.Max(childPixelSizeInCacheAfterViewport.Width, childPixelWidthInViewport);
7369childLogicalSizeInViewport.Width = Math.Max(childLogicalSizeInViewport.Width, childLogicalSize.Width);
7371childLogicalSizeInCacheBeforeViewport.Width = Math.Max(childLogicalSizeInCacheBeforeViewport.Width, childLogicalSize.Width);
7373childLogicalSizeInCacheAfterViewport.Width = Math.Max(childLogicalSizeInCacheAfterViewport.Width, childLogicalSize.Width);
7416sz1.Height = Math.Max(sz1.Height, sz2.Height);
7421sz1.Width = Math.Max(sz1.Width, sz2.Width);
7471childSize = new Size(Math.Max(headerDesiredSizes.PixelSize.Width, itemDesiredSizes.PixelSize.Width),
7476childSize = new Size(Math.Max(headerDesiredSizes.LogicalSize.Width, itemDesiredSizes.LogicalSize.Width),
7560uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes);
7644Math.Max(1, itemDesiredSizes.LogicalSize.Height))
7645: new Size(Math.Max(1, itemDesiredSizes.LogicalSize.Width),
7786Math.Max(uniformOrAverageContainerPixelSize, dpiScale), // don't round down to 0
7796uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes);
8459rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8484previousChildSize.Width = Math.Max(previousChildSize.Width, pixelHeaderSize.Width);
8491rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
8516previousChildSize.Height = Math.Max(previousChildSize.Height, pixelHeaderSize.Height);
8546rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8552rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
8590rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height);
8643rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width);
9520return Math.Max(0, _firstItemInExtendedViewportIndex);
9528return Math.Min(ItemCount, _firstItemInExtendedViewportIndex + _actualItemsInExtendedViewportCount);
9646_scrollData._maxDesiredSize.Height = Math.Max(_scrollData._maxDesiredSize.Height, stackPixelSize.Height);
9673_scrollData._maxDesiredSize.Width = Math.Max(_scrollData._maxDesiredSize.Width, stackPixelSize.Width);
9699Math.Min(stackPixelSize.Width, constraint.Width) : constraint.Width;
9704Math.Min(stackPixelSize.Height, constraint.Height) : constraint.Height;
9714Debug.Assert(DoubleUtil.AreClose(viewportSize.Width - Math.Floor(viewportSize.Width), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
9715Debug.Assert(DoubleUtil.AreClose(extentSize.Width - Math.Floor(extentSize.Width), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
9719Debug.Assert(DoubleUtil.AreClose(viewportSize.Height - Math.Floor(viewportSize.Height), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
9720Debug.Assert(DoubleUtil.AreClose(extentSize.Height - Math.Floor(extentSize.Height), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
9970double proposedViewportSize = Math.Floor(viewport.Width / approxSizeOfLogicalUnit);
10063if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.X)/extentSize.Width, Math.Floor(_scrollData._offset.X)/_scrollData._extent.Width))
10066viewportOffset.X = Math.Floor((extentSize.Width * Math.Floor(_scrollData._offset.X)) / _scrollData._extent.Width);
10187double proposedViewportSize = Math.Floor(viewport.Height / approxSizeOfLogicalUnit);
10280if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.Y)/extentSize.Height, Math.Floor(_scrollData._offset.Y)/_scrollData._extent.Height))
10283viewportOffset.Y = Math.Floor((extentSize.Height * Math.Floor(_scrollData._offset.Y)) / _scrollData._extent.Height);
10495_scrollData._maxDesiredSize.Height = Math.Max(_scrollData._maxDesiredSize.Height, stackPixelSize.Height);
10522_scrollData._maxDesiredSize.Width = Math.Max(_scrollData._maxDesiredSize.Width, stackPixelSize.Width);
10548Math.Min(stackPixelSize.Width, constraint.Width) : constraint.Width;
10553Math.Min(stackPixelSize.Height, constraint.Height) : constraint.Height;
10563Debug.Assert(DoubleUtil.AreClose(viewportSize.Width - Math.Floor(viewportSize.Width), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
10564Debug.Assert(DoubleUtil.AreClose(extentSize.Width - Math.Floor(extentSize.Width), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
10568Debug.Assert(DoubleUtil.AreClose(viewportSize.Height - Math.Floor(viewportSize.Height), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
10569Debug.Assert(DoubleUtil.AreClose(extentSize.Height - Math.Floor(extentSize.Height), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
10649lastPageSafeOffset = lastPageSafeOffset.HasValue ? Math.Min(computedViewportOffset.X, (double)lastPageSafeOffset) : computedViewportOffset.X;
10652double proposedViewportSize = Math.Floor(viewport.Width / approxSizeOfLogicalUnit);
10734if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.X)/extentSize.Width, Math.Floor(_scrollData._offset.X)/_scrollData._extent.Width))
10737viewportOffset.X = Math.Floor((extentSize.Width * Math.Floor(_scrollData._offset.X)) / _scrollData._extent.Width);
10780lastPageSafeOffset = lastPageSafeOffset.HasValue ? Math.Min(computedViewportOffset.Y, (double)lastPageSafeOffset) : computedViewportOffset.Y;
10783double proposedViewportSize = Math.Floor(viewport.Height / approxSizeOfLogicalUnit);
10865if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.Y)/extentSize.Height, Math.Floor(_scrollData._offset.Y)/_scrollData._extent.Height))
10868viewportOffset.Y = Math.Floor((extentSize.Height * Math.Floor(_scrollData._offset.Y)) / _scrollData._extent.Height);
11166double visibleStart = Math.Max(start, 0);
11167double visibleEnd = Math.Max(Math.Min(end, viewportSize), visibleStart);
11212else if (childIndex > firstChildInView + Math.Max(viewportSize - 1, 0))
11258maxChildLength = Math.Max(maxChildLength, childSize.Height);
11262maxChildLength = Math.Max(maxChildLength, childSize.Width);
11854else if (DoubleUtil.GreaterThan(Math.Abs(newOffset - oldOffset), _viewport.Width))
11870else if (DoubleUtil.GreaterThan(Math.Abs(newOffset - oldOffset), _viewport.Height))
System\Windows\Documents\TextStore.cs (12)
986milPointTopLeft = new Point(Math.Min(rectPrev.Left, rectCur.Left), Math.Min(rectPrev.Top, rectCur.Top));
987milPointBottomRight = new Point(Math.Max(rectPrev.Left, rectCur.Left), Math.Max(rectPrev.Bottom, rectCur.Bottom));
2453runCount = TextPointerBase.GetTextWithLimit(navigator, LogicalDirection.Forward, text, charsCopied, Math.Min(cchReq, text.Length - charsCopied), limit);
2856double radSin = Math.Asin(tf.M12 / Math.Sqrt((tf.M11 * tf.M11) + (tf.M12 * tf.M12)));
2857double radCos = Math.Acos(tf.M11 / Math.Sqrt((tf.M11 * tf.M11) + (tf.M12 * tf.M12)));
2859double angleCos = Math.Round((radCos * 180) / Math.PI, 0);
3819int extraCharsAllowed = Math.Max(0, this.TextEditor.MaxLength - currentLength);
System\Windows\FrameworkElement.cs (59)
4046maxHeight = Math.Max(Math.Min(height, maxHeight), minHeight);
4049minHeight = Math.Max(Math.Min(maxHeight, height), minHeight);
4056maxWidth = Math.Max(Math.Min(width, maxWidth), minWidth);
4059minWidth = Math.Max(Math.Min(maxWidth, width), minWidth);
4161Double yCoverD = (yConstrInfinite ? Double.PositiveInfinity : Math.Abs(yConstr/d));
4162Double xCoverA = (xConstrInfinite ? Double.PositiveInfinity : Math.Abs(xConstr/a));
4182h = Math.Min(0.5*Math.Abs(xConstr/c), yCoverD);
4193w = Math.Min( 0.5*Math.Abs(yConstr/b), xCoverA);
4201Double yCoverB = Math.Abs(yConstr/b);
4202Double xCoverC = Math.Abs(xConstr/c);
4222h = Math.Min(0.5*Math.Abs(yConstr/d), xCoverC);
4233w = Math.Min( 0.5*Math.Abs(xConstr/a), yCoverB);
4239Double xCoverA = Math.Abs(xConstr / a); // w-intercept of x-constraint line.
4240Double xCoverC = Math.Abs(xConstr / c); // h-intercept of x-constraint line.
4242Double yCoverB = Math.Abs(yConstr / b); // w-intercept of y-constraint line.
4243Double yCoverD = Math.Abs(yConstr / d); // h-intercept of y-constraint line.
4250w = Math.Min(yCoverB, xCoverA) * 0.5;
4251h = Math.Min(xCoverC, yCoverD) * 0.5;
4268Double expandFactor = Math.Min(xConstr / childBoundsTr.Width,
4327Math.Max(availableSize.Width - marginWidth, 0),
4328Math.Max(availableSize.Height - marginHeight, 0));
4376frameworkAvailableSize.Width = Math.Max(mm.minWidth, Math.Min(frameworkAvailableSize.Width, mm.maxWidth));
4377frameworkAvailableSize.Height = Math.Max(mm.minHeight, Math.Min(frameworkAvailableSize.Height, mm.maxHeight));
4390Math.Max(desiredSize.Width, mm.minWidth),
4391Math.Max(desiredSize.Height, mm.minHeight));
4457ltd.TransformedUnroundedDS = new Size(Math.Max(0, clippedDesiredWidth), Math.Max(0, clippedDesiredHeight));
4504return new Size(Math.Max(0, clippedDesiredWidth), Math.Max(0, clippedDesiredHeight));
4566arrangeSize.Width = Math.Max(0, arrangeSize.Width - marginWidth);
4567arrangeSize.Height = Math.Max(0, arrangeSize.Height - marginHeight);
4576transformedUnroundedDS.Width = Math.Max(0, transformedUnroundedDS.Width - marginWidth);
4577transformedUnroundedDS.Height = Math.Max(0, transformedUnroundedDS.Height- marginHeight);
4586unclippedDesiredSize = new Size(Math.Max(0, this.DesiredSize.Width - marginWidth),
4587Math.Max(0, this.DesiredSize.Height - marginHeight));
4592unclippedDesiredSize.Width = Math.Max(transformedUnroundedDS.Width, unclippedDesiredSize.Width);
4593unclippedDesiredSize.Height = Math.Max(transformedUnroundedDS.Height, unclippedDesiredSize.Height);
4680double effectiveMaxWidth = Math.Max(unclippedDesiredSize.Width, mm.maxWidth);
4687double effectiveMaxHeight = Math.Max(unclippedDesiredSize.Height, mm.maxHeight);
4718Size clippedInkSize = new Size(Math.Min(innerInkSize.Width, mm.maxWidth),
4719Math.Min(innerInkSize.Height, mm.maxHeight));
4751Size clientSize = new Size(Math.Max(0, finalRect.Width - marginWidth),
4752Math.Max(0, finalRect.Height - marginHeight));
4903inkSize.Width = Math.Min(inkSize.Width, mm.maxWidth);
4904inkSize.Height = Math.Min(inkSize.Height, mm.maxHeight);
4921Size clippingSize = new Size(Math.Max(0, layoutSlotSize.Width - marginWidth),
4922Math.Max(0, layoutSlotSize.Height - marginHeight));
5240inkSize.Width = Math.Min(inkSize.Width, mm.maxWidth);
5241inkSize.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)
1814frameworkAvailableSize.Width = Math.Max(mm.minWidth, Math.Min(frameworkAvailableSize.Width, mm.maxWidth));
1815frameworkAvailableSize.Height = Math.Max(mm.minHeight, Math.Min(frameworkAvailableSize.Height, mm.maxHeight));
1822Math.Max(desiredSize.Width, mm.minWidth),
1823Math.Max(desiredSize.Height, mm.minHeight));
1844arrangeBounds.Width = Math.Max(mm.minWidth, Math.Min(arrangeBounds.Width, mm.maxWidth));
1845arrangeBounds.Height = Math.Max(mm.minHeight, Math.Min(arrangeBounds.Height, mm.maxHeight));
1880Width = Math.Max(0.0, arrangeBounds.Width - frameSize.Width),
1881Height = Math.Max(0.0, arrangeBounds.Height - frameSize.Height)
3416Width = ((constraint.Width == Double.PositiveInfinity) ? Double.PositiveInfinity : Math.Max(0.0, (constraint.Width - frameSize.Width))),
3417Height = ((constraint.Height == Double.PositiveInfinity) ? Double.PositiveInfinity : Math.Max(0.0, (constraint.Height - frameSize.Height)))
3462maxWidthDeviceUnits = Math.Max(_trackMaxWidthDeviceUnits, _windowMaxWidthDeviceUnits);
3463maxHeightDeviceUnits = Math.Max(_trackMaxHeightDeviceUnits, _windowMaxHeightDeviceUnits);
3472mm.minWidth = Math.Max(this.MinWidth, minSizeLogicalUnits.X);
3477mm.maxWidth = Math.Min(MinWidth, maxSizeLogicalUnits.X);
3483mm.maxWidth = Math.Min(MaxWidth, maxSizeLogicalUnits.X);
3494mm.minHeight = Math.Max(this.MinHeight, minSizeLogicalUnits.Y);
3499mm.maxHeight = Math.Min(this.MinHeight, maxSizeLogicalUnits.Y);
3505mm.maxHeight = Math.Min(MaxHeight, maxSizeLogicalUnits.Y);
3856leftDeviceUnits = Math.Min(leftDeviceUnits, workAreaRectDeviceUnits.right - currentSizeDeviceUnits.Width);
3857leftDeviceUnits = Math.Max(leftDeviceUnits, workAreaRectDeviceUnits.left);
3858topDeviceUnits = Math.Min(topDeviceUnits, workAreaRectDeviceUnits.bottom - currentSizeDeviceUnits.Height);
3859topDeviceUnits = Math.Max(topDeviceUnits, workAreaRectDeviceUnits.top);
4718_windowMaxWidthDeviceUnits = Math.Max(_windowMaxWidthDeviceUnits, windowSize.X);
4719_windowMaxHeightDeviceUnits = Math.Max(_windowMaxHeightDeviceUnits, windowSize.Y);
7607return 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);
602Math.Max(0.0, rt.Width - thick.Left - thick.Right),
603Math.Max(0.0, rt.Height - thick.Top - thick.Bottom));
691desired = 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)
513rb.RadiusX = Math.Abs(rb.RadiusX * bounds.Width);
514rb.RadiusY = Math.Abs(rb.RadiusY * bounds.Height);
1911double length = Math.Sqrt(dx * dx + dy * dy);
1925stopDistance = Math.Max(b.RadiusX, b.RadiusY) * (second.Offset - first.Offset);
1943int stopCount = (int)Math.Ceiling(-6.297427 + 4.591693 * Math.Log(stopDistance));
2282double height = Math.Abs(start.Y - end.Y) * multiplier;
2291double 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))
3744min = Math.Min(min, offset);
3745max = Math.Max(max, offset);
3871return Math.Sqrt(sum);
3900return (int)Math.Ceiling(Math.Max(5, step)); // At least five. Radials look bad with less steps.
3949if (Math.Abs(di) < Double.Epsilon)
4043double right = Math.Ceiling(_bounds.Right / _bandDelta);
4044double left = Math.Floor(_bounds.Left / _bandDelta);
4143double rotateAngle = Math.Atan2(-gradientVector.Y, gradientVector.X) * 180.0 / Math.PI;
4188_rx = Math.Abs(b.RadiusX);
4189_ry = Math.Abs(b.RadiusY);
4270double right = Math.Ceiling(maxt * _bandSteps);
4271double left = Math.Floor(mint * _bandSteps);
4388double root = Math.Sqrt(B4AC);
4397maxt = Math.Max(maxt, one);
4398mint = Math.Min(mint, one);
4405maxt = Math.Max(maxt, two);
4406mint = Math.Min(mint, two);
4431double len = Math.Sqrt(dx * dx + dy * dy);
Serialization\VisualSerializer.cs (10)
468scalex = Math.Min(dstwidth / srcwidth, dstheight / srcheight);
473scalex = Math.Max(dstwidth / srcwidth, dstheight / srcheight);
750WriteAttr("RadiusX", Math.Abs(rb.RadiusX * bounds.Width));
751WriteAttr("RadiusY", Math.Abs(rb.RadiusY * bounds.Height));
917WriteAttr("StrokeThickness", Math.Abs(pen.Thickness));
927WriteAttr("StrokeMiterLimit", Math.Max(1.0, pen.MiterLimit));
949dashes.Add(Math.Abs(d));
2259WriteAttr("Opacity", Math.Min(Math.Max( opacity, 0.0),1.0));
2322SetCoordinateFormat(Math.Min(Utility.GetScaleX(mat), Utility.GetScaleY(mat)));
Roslyn.VisualStudio.DiagnosticsWindow (1)
Roslyn.VisualStudio.Next.UnitTests (1)
ScenarioTests.Common.Tests (1)
SemanticSearch.BuildTask (1)
Shared (3)
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 (15)
System.Drawing.Primitives (32)
System\Drawing\Rectangle.cs (16)
182(int)Math.Ceiling(value.X),
183(int)Math.Ceiling(value.Y),
184(int)Math.Ceiling(value.Width),
185(int)Math.Ceiling(value.Height));
212(int)Math.Round(value.X),
213(int)Math.Round(value.Y),
214(int)Math.Round(value.Width),
215(int)Math.Round(value.Height));
290int x1 = Math.Max(a.X, b.X);
291int x2 = Math.Min(a.X + a.Width, b.X + b.Width);
292int y1 = Math.Max(a.Y, b.Y);
293int y2 = Math.Min(a.Y + a.Height, b.Y + b.Height);
315int x1 = Math.Min(a.X, b.X);
316int x2 = Math.Max(a.X + a.Width, b.X + b.Width);
317int y1 = Math.Min(a.Y, b.Y);
318int y2 = Math.Max(a.Y + a.Height, b.Y + b.Height);
System.Formats.Asn1 (6)
System.Formats.Nrbf (3)
System.Formats.Tar (13)
System.IO.Compression (8)
System.IO.FileSystem.Watcher (2)
System.IO.Hashing (1)
System.IO.Pipelines (8)
System.IO.Ports (5)
System.Linq (15)
System.Linq.AsyncEnumerable (5)
System.Linq.Expressions (8)
System.Linq.Parallel (5)
System.Memory (4)
System.Memory.Data (1)
System.Net.Http (53)
System.Net.HttpListener (10)
System.Net.Mail (7)
System.Net.NameResolution (1)
System.Net.NetworkInformation (1)
System.Net.Ping (4)
System.Net.Primitives (8)
System.Net.Quic (7)
System.Net.Requests (4)
System.Net.Security (8)
System.Net.ServerSentEvents (5)
System.Net.Sockets (9)
System.Net.WebClient (6)
System.Net.WebSockets (8)
System.Numerics.Tensors (18)
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 (526)
src\libraries\System.Private.CoreLib\src\System\Byte.cs (4)
279public static (byte Quotient, byte Remainder) DivRem(byte left, byte right) => Math.DivRem(left, right);
525public static byte Clamp(byte value, byte min, byte max) => Math.Clamp(value, min, max);
531public static byte Max(byte x, byte y) => Math.Max(x, y);
537public static byte Min(byte x, byte y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (52)
184ulong high = Math.BigMul(a, b, out ulong low);
243(div, rem) = Math.DivRem(tmp, den);
248(div, rem) = Math.DivRem(tmp, den);
256(bufNum.Low64, rem) = Math.DivRem(tmp, den);
409(ulong quo64, bufNum.Low64) = Math.DivRem(num, den);
451ulong prod = Math.BigMul(quo, (uint)den); // quo * lo divisor
496uint prod2 = (uint)Math.BigMul(bufDen.Low64, quo, out prod1);
552ulong hi64 = Math.BigMul(bufNum.Low64, power, out ulong low64);
554hi64 = Math.BigMul(bufNum.U2, power) + hi64;
579ulong hi64 = Math.BigMul(bufNum.Low64, power, out ulong low64);
581bufNum.High64 = Math.BigMul(bufNum.U2, power) + (nuint)hi64;
595bufNum.U2 = (uint)Math.BigMul(bufNum.Low64, power, out ulong low64);
771(quotient, remainder) = Math.DivRem(high, power);
1026low64 = Math.BigMul((uint)low64, UInt32Powers10[scale]);
1030low64 = Math.BigMul((uint)low64, TenToPowerNine);
1039high = (uint)Math.BigMul(low64, power, out low64);
1052tmp64 = Math.BigMul(low64, power, out low64);
1053tmp64 += Math.BigMul(high, power);
1085tmp64 += Math.BigMul(rgulNum[cur], power);
1288ulong high = Math.BigMul(pdecIn.Low64, pwr, out ulong low);
1372ulong tmp = Math.BigMul(low64, power, out low64);
1373tmp += Math.BigMul(high, power);
1416ulong low64 = Math.BigMul(d1.Low, d2.Low);
1429(low64, ulong remainder) = Math.DivRem(low64, power);
1447tmp = Math.BigMul(d1.Low, d2.Low64, out ulong low);
1452tmp += Math.BigMul(d1.Low, d2.High);
1467tmp = Math.BigMul(d1.Low64, d2.Low, out ulong low);
1472tmp += Math.BigMul(d2.Low, d1.High);
1502ulong mid64 = Math.BigMul(d1.Low64, d2.Low64, out tmp);
1508ulong hi64 = Math.BigMul(d1.High, d2.High);
1511hi64 += Math.BigMul(d1.Low64, d2.High, out tmp);
1517hi64 += Math.BigMul(d2.Low64, d1.High, out tmp);
1626mant = (uint)(int)Math.Round(dbl);
1645result.Low64 = Math.BigMul(mant, UInt32Powers10[power]);
1653ulong low64 = Math.BigMul(mant, UInt32Powers10[power - 18]);
1658ulong low64 = Math.BigMul(mant, UInt32Powers10[power - 9]);
1659ulong hi64 = Math.BigMul(TenToPowerNine, low64, out low64);
1681(uint div, uint rem) = Math.DivRem(mant, 10000);
1692(uint div, uint rem) = Math.DivRem(mant, 100);
1703(uint div, uint rem) = Math.DivRem(mant, 10);
1786mant = (ulong)(long)Math.Round(dbl);
1806ulong low64 = Math.BigMul((uint)mant, pow10);
1807ulong hi64 = Math.BigMul((uint)(mant >> 32), pow10);
1967curScale = Math.Min(9, -scale);
2011ulong num = Math.BigMul(remainder, power);
2058curScale = Math.Min(9, -scale);
2120curScale = Math.Min(9, -scale);
2240uint hi32 = (uint)Math.BigMul(d2.Low64, power, out ulong low64);
2322ulong tmp64 = Math.BigMul(b.Buf24.U0, power);
2327tmp64 += Math.BigMul(buf[i], power);
2411(d.uhi, remainder) = Math.DivRem(n, divisor);
2452(d.uhi, remainder) = Math.DivRem(n, power);
src\libraries\System.Private.CoreLib\src\System\Double.cs (58)
67public const double E = Math.E;
71public const double Pi = Math.PI;
75public const double Tau = Math.Tau;
579public static double Log2(double value) => Math.Log2(value);
633public static double Exp(double x) => Math.Exp(x);
636public static double ExpM1(double x) => Math.Exp(x) - 1;
639public static double Exp2(double x) => Math.Pow(2, x);
642public static double Exp2M1(double x) => Math.Pow(2, x) - 1;
645public static double Exp10(double x) => Math.Pow(10, x);
648public static double Exp10M1(double x) => Math.Pow(10, x) - 1;
656public static double Ceiling(double x) => Math.Ceiling(x);
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);
948Math.ThrowMinMaxException(min, max);
958Math.ThrowMinMaxException(min, max);
964public static double CopySign(double value, double sign) => Math.CopySign(value, sign);
968public static double Max(double x, double y) => Math.Max(x, y);
999public static double Min(double x, double y) => Math.Min(x, y);
1029public static int Sign(double value) => Math.Sign(value);
1046public static double Abs(double value) => Math.Abs(value);
1142public static double MaxMagnitude(double x, double y) => Math.MaxMagnitude(x, y);
1172public static double MinMagnitude(double x, double y) => Math.MinMagnitude(x, y);
1480public static double Pow(double x, double y) => Math.Pow(x, y);
1488public static double Cbrt(double x) => Math.Cbrt(x);
1772public static double Sqrt(double x) => Math.Sqrt(x);
1804public static double Acos(double x) => Math.Acos(x);
1814public static double Asin(double x) => Math.Asin(x);
1824public static double Atan(double x) => Math.Atan(x);
1834public static double Cos(double x) => Math.Cos(x);
1945public static double Sin(double x) => Math.Sin(x);
1948public static (double Sin, double Cos) SinCos(double x) => Math.SinCos(x);
2153public static double Tan(double x) => Math.Tan(x);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (8)
464FormatDigits(ref result, hour12, Math.Min(tokenLen, 2));
469FormatDigits(ref result, dateTime.Hour, Math.Min(tokenLen, 2));
474FormatDigits(ref result, dateTime.Minute, Math.Min(tokenLen, 2));
479FormatDigits(ref result, dateTime.Second, Math.Min(tokenLen, 2));
638FormatDigits(ref result, year, Math.Min(tokenLen, 2));
824(int tens, int ones) = Math.DivRem(offset.Hours, 10);
1502(int offsetHours, int offsetMinutes) = Math.DivRem(offsetTotalMinutes, 60);
1706(int offsetHours, offsetMinutes) = Math.DivRem(offsetMinutes, 60);
src\libraries\System.Private.CoreLib\src\System\Int16.cs (7)
282public static (short Quotient, short Remainder) DivRem(short left, short right) => Math.DivRem(left, right);
619public static short Clamp(short value, short min, short max) => Math.Clamp(value, min, max);
635Math.ThrowNegateTwosCompOverflow();
645public static short Max(short x, short y) => Math.Max(x, y);
651public static short Min(short x, short y) => Math.Min(x, y);
657public static int Sign(short value) => Math.Sign(value);
673public static short Abs(short value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\Int32.cs (8)
54public static long BigMul(int left, int right) => Math.BigMul(left, right);
297public static (int Quotient, int Remainder) DivRem(int left, int right) => Math.DivRem(left, right);
660public static int Clamp(int value, int min, int max) => Math.Clamp(value, min, max);
676Math.ThrowNegateTwosCompOverflow();
686public static int Max(int x, int y) => Math.Max(x, y);
692public static int Min(int x, int y) => Math.Min(x, y);
698public static int Sign(int value) => Math.Sign(value);
714public static int Abs(int value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\Int64.cs (8)
54public static Int128 BigMul(long left, long right) => Math.BigMul(left, right);
294public static (long Quotient, long Remainder) DivRem(long left, long right) => Math.DivRem(left, right);
657public static long Clamp(long value, long min, long max) => Math.Clamp(value, min, max);
673Math.ThrowNegateTwosCompOverflow();
683public static long Max(long x, long y) => Math.Max(x, y);
689public static long Min(long x, long y) => Math.Min(x, y);
695public static int Sign(long value) => Math.Sign(value);
711public static long Abs(long value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (7)
299public static (nint Quotient, nint Remainder) DivRem(nint left, nint right) => Math.DivRem(left, right);
652public static nint Clamp(nint value, nint min, nint max) => Math.Clamp(value, min, max);
668Math.ThrowNegateTwosCompOverflow();
678public static nint Max(nint x, nint y) => Math.Max(x, y);
684public static nint Min(nint x, nint y) => Math.Min(x, y);
690public static int Sign(nint value) => Math.Sign(value);
706public static nint Abs(nint value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (34)
598nMaxDigits = Math.Max(number.DigitsCount, TNumber.MaxRoundTripDigits);
1384int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length;
1410int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length;
1439int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value));
1458int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value));
1495int bufferLength = Math.Max(digits, 32 - (int)uint.LeadingZeroCount(value));
1514int bufferLength = Math.Max(digits, 32 - (int)uint.LeadingZeroCount(value));
1589(value, uint remainder) = Math.DivRem(value, 100);
1631(value, uint remainder) = Math.DivRem(value, 100);
1659(value, remainder) = Math.DivRem(value, 100);
1666(value, remainder) = Math.DivRem(value, 10);
1713int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
1749int bufferLength = Math.Max(digits, countedDigits);
1817int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length;
1843int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length;
1872int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value));
1891int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value));
1944int bufferLength = Math.Max(digits, 64 - (int)ulong.LeadingZeroCount(value));
1963int bufferLength = Math.Max(digits, 64 - (int)ulong.LeadingZeroCount(value));
2060(value, ulong remainder) = Math.DivRem(value, 100);
2099(value, remainder) = Math.DivRem(value, 100);
2106(value, remainder) = Math.DivRem(value, 10);
2141int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
2176int bufferLength = Math.Max(digits, countedDigits);
2245int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length;
2273int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length;
2304int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits(uValue));
2325int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits(uValue));
2354return Int64ToHexChars(buffer, lower, hexBase, Math.Max(digits, 1));
2367int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value));
2388int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value));
2417return UInt64ToBinaryChars(buffer, lower, Math.Max(digits, 1));
2503int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value));
2517int bufferLength = Math.Max(digits, countedDigits);
src\libraries\System.Private.CoreLib\src\System\SByte.cs (7)
285public static (sbyte Quotient, sbyte Remainder) DivRem(sbyte left, sbyte right) => Math.DivRem(left, right);
582public static sbyte Clamp(sbyte value, sbyte min, sbyte max) => Math.Clamp(value, min, max);
598Math.ThrowNegateTwosCompOverflow();
608public static sbyte Max(sbyte x, sbyte y) => Math.Max(x, y);
614public static sbyte Min(sbyte x, sbyte y) => Math.Min(x, y);
620public static int Sign(sbyte value) => Math.Sign(value);
636public static sbyte Abs(sbyte value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (17)
135capacity = Math.Max(capacity, length);
159capacity = Math.Min(DefaultCapacity, maxCapacity);
207persistedCapacity = Math.Min(Math.Max(DefaultCapacity, persistedString.Length), persistedMaxCapacity);
417int capacityToPreserve = Math.Min(Capacity, Math.Max(Length * 6 / 5, m_ChunkChars.Length));
845int length = Math.Min(m_ChunkChars.Length - m_ChunkLength, count);
909chunkEndIndex = Math.Min(chunkEndIndex, chunk.m_ChunkLength);
2109ReadOnlySpan<char> remainingChunk = chunk.m_ChunkChars.AsSpan(indexInChunk, Math.Min(chunk.m_ChunkLength - indexInChunk, count));
2145Debug.Assert(oldValue.Length > Math.Min(count, chunk.m_ChunkLength - indexInChunk),
2231int curInChunk = Math.Max(startIndexInChunk, 0);
2232int endInChunk = Math.Min(chunk.m_ChunkLength, endIndexInChunk);
2476int lengthToCopy = Math.Min(lengthInChunk, count);
2562int newBlockLength = Math.Max(minBlockCharCount, Math.Min(Length, MaxChunkSize));
2670StringBuilder newChunk = new StringBuilder(Math.Max(count, DefaultCapacity), chunk.m_MaxCapacity, chunk.m_ChunkPrevious);
2674int copyCount1 = Math.Min(count, indexInChunk);
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.Blocking.cs (14)
15return Math.Min(_separated.counts.NumThreadsGoal, TargetThreadsGoalForBlockingAdjustment);
28: (short)Math.Min((ushort)(_minThreads + _numBlockedThreads), (ushort)_maxThreads);
146short toSubtract = Math.Min((short)(numThreadsGoal - targetThreadsGoal), _numThreadsAddedDueToBlocking);
157(short)Math.Min((ushort)(_minThreads + BlockingConfig.ThreadsToAddWithoutDelay), (ushort)_maxThreads);
164Math.Max(configuredMaxThreadsWithoutDelay, Math.Min(counts.NumExistingThreads, _maxThreads));
165short targetThreadsGoalWithoutDelay = Math.Min(targetThreadsGoal, maxThreadsGoalWithoutDelay);
221newNumThreadsGoal = (short)Math.Min(newNumThreadsGoal, achievableNumThreadsGoal);
249return Math.Min((uint)delayStepCount * BlockingConfig.DelayStepMs, BlockingConfig.MaxDelayMs);
327blocking_threadsPerDelayStep_procCountFactor = Math.Max(1, blocking_threadsPerDelayStep_procCountFactor);
337MaxDelayMs = Math.Max(1, Math.Min(MaxDelayMs, GateThread.GateActivitiesPeriodMs));
338DelayStepMs = Math.Max(1, Math.Min(DelayStepMs, MaxDelayMs));
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.HillClimbing.cs (21)
200int sampleCount = ((int)Math.Min(_totalSamples - 1, _samplesToMeasure)) / _wavePeriod * _wavePeriod;
235throughputErrorEstimate = Math.Max(throughputErrorEstimate, (GetWaveComponent(_samples, sampleCount, adjacentPeriod2) / averageThroughput).Abs());
271double noiseForConfidence = Math.Max(_averageThroughputNoise, throughputErrorEstimate);
288double move = Math.Min(1.0, Math.Max(-1.0, ratio.Real));
293move *= Math.Min(1.0, Math.Max(0.0, confidence));
301move = Math.Pow(Math.Abs(move), _gainExponent) * (move >= 0.0 ? 1 : -1) * gain;
302move = Math.Min(move, _maxChangePerSample);
321newThreadWaveMagnitude = Math.Min(newThreadWaveMagnitude, _maxThreadWaveMagnitude);
322newThreadWaveMagnitude = Math.Max(newThreadWaveMagnitude, 1);
332_currentControlSetting = Math.Min(maxThreads - newThreadWaveMagnitude, _currentControlSetting);
333_currentControlSetting = Math.Max(minThreads, _currentControlSetting);
343newThreadCount = Math.Min(maxThreads, newThreadCount);
344newThreadCount = Math.Max(minThreads, newThreadCount);
377newSampleInterval = (int)(0.5 + _currentSampleMs * (10.0 * Math.Min(-ratio.Real, 1.0)));
413entry.lastHistoryCount = (int)(Math.Min(_totalSamples, _samplesToMeasure) / _wavePeriod) * _wavePeriod;
447double w = 2 * Math.PI / period;
448double cos = Math.Cos(w);
457return new Complex(q1 - q2 * cos, q2 * Math.Sin(w)) / numSamples;
src\libraries\System.Private.CoreLib\src\System\TimeSpan.cs (17)
479Int128 totalMicroseconds = Math.BigMul(days, MicrosecondsPerDay)
480+ Math.BigMul(hours, MicrosecondsPerHour)
481+ Math.BigMul(minutes, MicrosecondsPerMinute)
482+ Math.BigMul(seconds, MicrosecondsPerSecond)
483+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
515Int128 totalMicroseconds = Math.BigMul(hours, MicrosecondsPerHour)
516+ Math.BigMul(minutes, MicrosecondsPerMinute)
517+ Math.BigMul(seconds, MicrosecondsPerSecond)
518+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
549Int128 totalMicroseconds = Math.BigMul(minutes, MicrosecondsPerMinute)
550+ Math.BigMul(seconds, MicrosecondsPerSecond)
551+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
581Int128 totalMicroseconds = Math.BigMul(seconds, MicrosecondsPerSecond)
582+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
612Int128 totalMicroseconds = Math.BigMul(milliseconds, MicrosecondsPerMillisecond)
923double ticks = Math.Round(timeSpan.Ticks * factor);
938double ticks = Math.Round(timeSpan.Ticks / divisor);
src\libraries\System.Private.CoreLib\src\System\UInt16.cs (4)
276public static (ushort Quotient, ushort Remainder) DivRem(ushort left, ushort right) => Math.DivRem(left, right);
544public static ushort Clamp(ushort value, ushort min, ushort max) => Math.Clamp(value, min, max);
550public static ushort Max(ushort x, ushort y) => Math.Max(x, y);
556public static ushort Min(ushort x, ushort y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\UInt32.cs (5)
51public static ulong BigMul(uint left, uint right) => Math.BigMul(left, right);
292public static (uint Quotient, uint Remainder) DivRem(uint left, uint right) => Math.DivRem(left, right);
583public static uint Clamp(uint value, uint min, uint max) => Math.Clamp(value, min, max);
589public static uint Max(uint x, uint y) => Math.Max(x, y);
595public static uint Min(uint x, uint y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\UInt64.cs (5)
51public static UInt128 BigMul(ulong left, ulong right) => Math.BigMul(left, right);
291public static (ulong Quotient, ulong Remainder) DivRem(ulong left, ulong right) => Math.DivRem(left, right);
582public static ulong Clamp(ulong value, ulong min, ulong max) => Math.Clamp(value, min, max);
588public static ulong Max(ulong x, ulong y) => Math.Max(x, y);
594public static ulong Min(ulong x, ulong y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (4)
295public static (nuint Quotient, nuint Remainder) DivRem(nuint left, nuint right) => Math.DivRem(left, right);
585public static nuint Clamp(nuint value, nuint min, nuint max) => Math.Clamp(value, min, max);
591public static nuint Max(nuint x, nuint y) => Math.Max(x, y);
597public static nuint Min(nuint x, nuint y) => Math.Min(x, y);
System.Private.CoreLib.Generators (3)
System.Private.DataContractSerialization (52)
System\Xml\XmlBaseReader.cs (6)
1148actual = Math.Min(count, value.Length);
1178return ReadBytes(DataContractSerializer.Base64Encoding, 3, 4, buffer, offset, Math.Min(count, 512), false);
1370return ReadBytes(DataContractSerializer.Base64Encoding, 3, 4, buffer, offset, Math.Min(count, 512), true);
1390return ReadBytes(DataContractSerializer.BinHexEncoding, 1, 2, buffer, offset, Math.Min(count, 512), true);
1425int actual = Math.Min(_trailByteCount, byteCount);
1493int actual = Math.Min(_trailByteCount, byteCount);
System\Xml\XmlBinaryReader.cs (15)
881int maxLength = Math.Max(_maxBytesPerRead - maxTextNodeLength, 0);
893int actual = Math.Max(maxLength - maxTextNodeLength, 0);
951int maxLength = Math.Max(_maxBytesPerRead - maxTextNodeLength, 0);
963int actual = Math.Max(maxLength - maxTextNodeLength, 0);
993int maxBytesPerRead = Math.Max(_maxBytesPerRead - nodeLength, 0);
1240int actual = Math.Min(count, _arrayCount);
1263int actual = Math.Min(count, _arrayCount);
1286int actual = Math.Min(count, _arrayCount);
1309int actual = Math.Min(count, _arrayCount);
1332int actual = Math.Min(count, _arrayCount);
1355int actual = Math.Min(count, _arrayCount);
1378int actual = Math.Min(count, _arrayCount);
1402int actual = Math.Min(count, _arrayCount);
1431int actual = Math.Min(count, _arrayCount);
1467int actual = Math.Min(count, _arrayCount);
System.Private.Uri (4)
System.Private.Windows.Core (6)
System.Private.Xml (28)
System.Reflection.Emit (3)
System.Reflection.Metadata (19)
System.Reflection.MetadataLoadContext (1)
System.Runtime (1)
System.Runtime.Caching (18)
System.Runtime.Extensions (1)
System.Runtime.Numerics (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 (25)
System.Security.Cryptography.Cose (2)
System.Security.Cryptography.Pkcs (4)
System.ServiceModel.Federation (1)
System.ServiceModel.NetFramingBase (11)
System\ServiceModel\Channels\SingletonConnectionReader.cs (8)
351int bytesToCopy = Math.Min(_chunkBytesRemaining,
352Math.Min(_chunkBufferSize, count));
377bytesToRead = Math.Min(count, _chunkBytesRemaining + IntEncoder.MaxEncodedSize);
383DecodeData(buffer, offset, Math.Min(bytesRead, _chunkBytesRemaining));
455int bytesToCopy = Math.Min(_chunkBytesRemaining,
456Math.Min(_chunkBufferSize, count));
481bytesToRead = Math.Min(count, _chunkBytesRemaining + IntEncoder.MaxEncodedSize);
487DecodeData(buffer, offset, Math.Min(bytesRead, _chunkBytesRemaining));
System.ServiceModel.NetNamedPipe (1)
System.ServiceModel.Syndication (1)
System.Text.Encodings.Web (6)
System.Text.Json (22)
System.Text.Json.SourceGeneration (4)
System.Text.RegularExpressions (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);
1058return 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)
128End = Math.Min(Math.Max(End, Start + 1), text.Length);
162End = Math.Min(Math.Max(End, Start + 1), text.Length);
296return text.Substring(Start, maxLength >= 0 ? Math.Min(Length, maxLength) : Length);
470Math.Max(0, _provider.LineFromChar(End) - _provider.LinesPerPage() + 1);
655int height = Math.Abs(_provider.GetLogfont().lfHeight);;
682ArrayList rects = new ArrayList(Math.Max(endLine - startLine + 1, 0));
777return Math.Round((double)(-logfont.lfHeight) * 72 / lpy);
824moved = Math.Min(count, limit - index);
869moved = Math.Min(count, lineMax - line - 1);
937moved = Math.Max(count, -oneBasedIndex);
982int actualCount = Math.Max(count, -line);
UIAutomationTypes (3)
VBCSCompiler (1)
WindowsBase.Tests (9)
System\Windows\VectorTests.cs (9)
50yield return new object[] { 1, 2, Math.Sqrt(5) };
51yield return new object[] { 1.1, 2.2, Math.Sqrt(6.05) };
52yield return new object[] { -1.1, -2.2, Math.Sqrt(6.05) };
53yield return new object[] { double.MaxValue, double.MaxValue, Math.Sqrt(double.PositiveInfinity) };
62Assert.Equal(Math.Sqrt(vector.LengthSquared), vector.Length, precision: 5);
323Assert.Equal(1 / Math.Sqrt(5), vector.X, precision: 5);
324Assert.Equal(2 / Math.Sqrt(5), vector.Y, precision: 5);
334Assert.Equal(-1 / Math.Sqrt(5), vector.X, precision: 5);
335Assert.Equal(-2 / Math.Sqrt(5), vector.Y, precision: 5);
WindowsFormsIntegration (13)
WinFormsControlsTest (10)
xunit.assert (36)
EqualityAsserts.cs (26)
280 var typeNameIndent = Math.Max(expectedTypeName.Length, actualTypeName.Length);
346 var expectedRounded = Math.Round(expected, precision);
347 var actualRounded = Math.Round(actual, precision);
372 var expectedRounded = Math.Round(expected, precision, rounding);
373 var actualRounded = Math.Round(actual, precision, rounding);
398 if (!(object.Equals(expected, actual) || Math.Abs(expected - actual) <= tolerance))
418 var expectedRounded = Math.Round(expected, precision);
419 var actualRounded = Math.Round(actual, precision);
444 var expectedRounded = Math.Round(expected, precision, rounding);
445 var actualRounded = Math.Round(actual, precision, rounding);
470 if (!(object.Equals(expected, actual) || Math.Abs(expected - actual) <= tolerance))
490 var expectedRounded = Math.Round(expected, precision);
491 var actualRounded = Math.Round(actual, precision);
794 var typeNameIndent = Math.Max(expectedTypeName.Length, actualTypeName.Length);
827 var expectedRounded = Math.Round(expected, precision);
828 var actualRounded = Math.Round(actual, precision);
853 var expectedRounded = Math.Round(expected, precision, rounding);
854 var actualRounded = Math.Round(actual, precision, rounding);
879 if (object.Equals(expected, actual) || Math.Abs(expected - actual) <= tolerance)
899 var expectedRounded = Math.Round(expected, precision);
900 var actualRounded = Math.Round(actual, precision);
925 var expectedRounded = Math.Round(expected, precision, rounding);
926 var actualRounded = Math.Round(actual, precision, rounding);
951 if (object.Equals(expected, actual) || Math.Abs(expected - actual) <= tolerance)
971 var expectedRounded = Math.Round(expected, precision);
972 var actualRounded = Math.Round(actual, precision);