3830 references to Math
CodeGenerator (8)
HttpUtilities\HttpUtilities.cs (4)
34var maskLength = (byte)Math.Ceiling(Math.Log(httpMethods.Length, 2)); 58int knownMethodsArrayLength = (int)(Math.Pow(2, maskLength) + 1); 218var mask2 = (ulong)(Math.Pow(2, bitsCount) - 1);
HttpUtilities\HttpUtilitiesGeneratorHelpers.cs (4)
191var maskSizeInBIts = Math.Log(mask, 2); 192var hexMaskSize = Math.Ceiling(maskSizeInBIts / 4.0); 210var maskSizeInBIts = Math.Log(mask, 2); 211var hexMaskSize = (byte)Math.Ceiling(maskSizeInBIts / 4);
dotnet-user-jwts (1)
Helpers\ConsoleTable.cs (1)
61var equalColumnLengths = Math.Max((Console.WindowWidth / _columns.Count) - EXCESS_LENGTH_CREATED_BY_BORDERS, 5);
http2cat (10)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
83int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (6)
420int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 458int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 580_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 629dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\DuplexPipeStream.cs (1)
135var count = (int)Math.Min(readableBuffer.Length, destination.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
IIS.FunctionalTests (10)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
83int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (6)
420int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 458int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 580_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 629dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\DuplexPipeStream.cs (1)
135var count = (int)Math.Min(readableBuffer.Length, destination.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
IIS.LongTests (10)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
83int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (6)
420int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 458int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 580_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 629dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\DuplexPipeStream.cs (1)
135var count = (int)Math.Min(readableBuffer.Length, destination.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
IIS.NewHandler.FunctionalTests (10)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
83int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (6)
420int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 458int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 580_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 629dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\DuplexPipeStream.cs (1)
135var count = (int)Math.Min(readableBuffer.Length, destination.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
IIS.NewShim.FunctionalTests (10)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
83int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (6)
420int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 458int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 580_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 629dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\DuplexPipeStream.cs (1)
135var count = (int)Math.Min(readableBuffer.Length, destination.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
IIS.ShadowCopy.Tests (3)
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\DuplexPipeStream.cs (1)
135var count = (int)Math.Min(readableBuffer.Length, destination.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
IISExpress.FunctionalTests (10)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
83int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (6)
420int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 458int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 580_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 629dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\DuplexPipeStream.cs (1)
135var count = (int)Math.Min(readableBuffer.Length, destination.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
ILCompiler.DependencyAnalysisFramework (1)
DependencyAnalyzer.cs (1)
226int dependencyPhase = Math.Max(node.DependencyPhaseForDeferredStaticComputation, _currentDependencyPhase);
InMemory.FunctionalTests (2)
RequestTests.cs (1)
2301var mask = Math.Pow(2, lines.Length) - 1;
src\Servers\Kestrel\shared\test\StringExtensions.cs (1)
15return s.Substring(0, Math.Min(128, s.Length))
KeyManagementSimulator (2)
Program.cs (2)
194Console.WriteLine($"Instance {i}: {Math.Round(cumulativeProblemTime.TotalHours, 2)} hours"); 198Console.WriteLine($"Total missing key score (lower is better) = {Math.Round(totalProblemTime.TotalHours, 2)} hours");
LocalizationSample (4)
Startup.cs (4)
100await context.Response.WriteAsync($"<tr><th>{SR["Big number (invariant):"]}</th><td>{(Math.Pow(2, 42) + 0.42).ToString("N", CultureInfo.InvariantCulture)}</td></tr>"); 101await context.Response.WriteAsync($"<tr><th>{SR["Big number (request):"]}</th><td>{(Math.Pow(2, 42) + 0.42).ToString("N", CultureInfo.CurrentCulture)}</td></tr>"); 102await context.Response.WriteAsync($"<tr><th>{SR["Big number negative (invariant):"]}</th><td>{(-Math.Pow(2, 42) + 0.42).ToString("N", CultureInfo.InvariantCulture)}</td></tr>"); 103await context.Response.WriteAsync($"<tr><th>{SR["Big number negative (request):"]}</th><td>{(-Math.Pow(2, 42) + 0.42).ToString("N", CultureInfo.CurrentCulture)}</td></tr>");
Microsoft.Arcade.Common (1)
ExponentialRetry.cs (1)
57(Math.Pow(DelayBase, i) + DelayConstant) * randomFactor);
Microsoft.Arcade.Test.Common (3)
DiffUtil.cs (3)
211int max = Math.Max(lengthA, lengthB); 263d[i, j] = Math.Min(Math.Min(m1, m2), m3);
Microsoft.AspNetCore.App.Analyzers (2)
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxNode.cs (2)
102start = Math.Min(token.VirtualChars[0].Span.Start, start); 103end = Math.Max(token.VirtualChars.Last().Span.End, end);
Microsoft.AspNetCore.Authentication.Cookies (2)
src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (2)
191var cookieChunkCount = (int)Math.Ceiling(value.Length * 1.0 / dataSizePerCookie); 206var length = Math.Min(dataSizePerCookie, remainingLength);
Microsoft.AspNetCore.Authentication.OpenIdConnect (1)
OpenIdConnectHandler.cs (1)
432message.MaxAge = Convert.ToInt64(Math.Floor((maxAge.Value).TotalSeconds))
Microsoft.AspNetCore.Components (4)
src\Components\Shared\src\ArrayBuilder.cs (2)
90var candidateCapacity = Math.Max(_items.Length * 2, _minCapacity); 179var newCapacity = Math.Max(desiredCapacity, _minCapacity);
src\Http\Routing\src\Template\RoutePrecedence.cs (2)
71precedence += decimal.Divide(digit, (decimal)Math.Pow(10, i)); 127precedence += decimal.Divide(digit, (decimal)Math.Pow(10, i));
Microsoft.AspNetCore.Components.Forms (2)
src\Components\Shared\src\ExpressionFormatting\ReverseStringBuilder.cs (2)
59var sizeToRent = _currentBuffer.Length + Math.Max(MinimumRentedArraySize, remainingLength * 2); 80var sizeToRent = Math.Max(MinimumRentedArraySize, remainingLength * 2);
Microsoft.AspNetCore.Components.QuickGrid (1)
QuickGrid.razor.cs (1)
340count = Math.Min(request.Count, Pagination.ItemsPerPage - request.StartIndex);
Microsoft.AspNetCore.Components.Server (11)
BlazorPack\SequenceOfT.cs (1)
223sizeHint = Math.Max(this.MinimumSpanLength, sizeHint);
Circuits\RemoteJSDataStream.cs (1)
49(int)Math.Min(signalRMaximumIncomingBytes, 50 * 1024) - 512 :
Circuits\RemoteJSRuntime.cs (1)
148_byteArraysToBeRevivedTotalBytes += Math.Max(4, data.Length);
src\Components\Shared\src\ArrayBuilder.cs (2)
90var candidateCapacity = Math.Max(_items.Length * 2, _minCapacity); 179var newCapacity = Math.Max(desiredCapacity, _minCapacity);
src\Shared\PooledArrayBufferWriter.cs (1)
157var growBy = Math.Max(sizeHint, _rentedBuffer.Length);
src\SignalR\common\Shared\BinaryMessageParser.cs (1)
36var lengthPrefixBuffer = buffer.Slice(0, Math.Min(MaxLengthPrefixSize, buffer.Length));
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\BufferWriter.cs (1)
239var writable = Math.Min(bytesLeftToCopy, _span.Length);
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\MessagePackReader.cs (1)
1109int bytesRead = Math.Min(remainingByteLength, this.reader.UnreadSpan.Length);
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\SequenceReader.cs (1)
484int toCopy = Math.Min(nextSpan.Length, destination.Length - copied);
Microsoft.AspNetCore.Components.Web (12)
Forms\InputFile\BrowserFileStream.cs (1)
73var maxBytesToRead = (int)Math.Min(bytesAvailableToRead, buffer.Length);
src\Components\Shared\src\ExpressionFormatting\ReverseStringBuilder.cs (2)
59var sizeToRent = _currentBuffer.Length + Math.Max(MinimumRentedArraySize, remainingLength * 2); 80var sizeToRent = Math.Max(MinimumRentedArraySize, remainingLength * 2);
Virtualization\Virtualize.cs (9)
210var lastItemIndex = Math.Min(_itemsBefore + _visibleItemCapacity, _itemCount); 212var placeholdersBeforeCount = Math.Min(_loadedItemsStartIndex, lastItemIndex); 252_lastRenderedPlaceholderCount = Math.Max(0, lastItemIndex - _itemsBefore - _lastRenderedItemCount); 264var itemsAfter = Math.Max(0, _itemCount - _visibleItemCapacity - _itemsBefore); 296var itemsBefore = Math.Max(0, _itemCount - itemsAfter - visibleItemCapacity); 329itemsInSpacer = Math.Max(0, (int)Math.Floor(spacerSize / _itemSize) - OverscanCount); 330visibleItemCapacity = (int)Math.Ceiling(containerSize / _itemSize) + 2 * OverscanCount; 339itemsBefore = Math.Max(0, _itemCount - visibleItemCapacity);
Microsoft.AspNetCore.Components.WebAssembly (1)
src\Components\Shared\src\PullFromJSDataStream.cs (1)
95numBytesToRead = (int)Math.Min(numBytesToRead, _totalLength - _offset);
Microsoft.AspNetCore.Components.WebView (3)
src\Components\Shared\src\ArrayBuilder.cs (2)
90var candidateCapacity = Math.Max(_items.Length * 2, _minCapacity); 179var newCapacity = Math.Max(desiredCapacity, _minCapacity);
src\Components\Shared\src\PullFromJSDataStream.cs (1)
95numBytesToRead = (int)Math.Min(numBytesToRead, _totalLength - _offset);
Microsoft.AspNetCore.CookiePolicy.Test (2)
src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (2)
191var cookieChunkCount = (int)Math.Ceiling(value.Length * 1.0 / dataSizePerCookie); 206var length = Math.Min(dataSizePerCookie, remainingLength);
Microsoft.AspNetCore.Cryptography.KeyDerivation (1)
PBKDF2\ManagedPbkdf2Provider.cs (1)
58int numBytesToCopy = Math.Min(numBytesRemaining, T_blockIndex.Length);
Microsoft.AspNetCore.DataProtection (2)
SP800_108\ManagedSP800_108_CTR_HMACSHA512.cs (1)
47var numBytesToCopyThisIteration = Math.Min(prfOutputSizeInBytes, outputCount);
SP800_108\Win7SP800_108_CTR_HMACSHA512Provider.cs (1)
67uint numBytesToCopy = Math.Min(cbDerivedKey, SHA512_DIGEST_SIZE_IN_BYTES);
Microsoft.AspNetCore.DataProtection.Tests (1)
TypeForwardingActivatorTests.cs (1)
128new Version(Math.Max(0, current.Major - 1), 0, 0, 0),
Microsoft.AspNetCore.Diagnostics (1)
src\Shared\StackTrace\ExceptionDetails\ExceptionDetailsProvider.cs (1)
149var preErrorLineNumberInFile = Math.Max(errorStartLineNumberInFile - _sourceCodeLineCount, 1);
Microsoft.AspNetCore.Grpc.JsonTranscoding (1)
src\Grpc\JsonTranscoding\src\Shared\Legacy.cs (1)
229AppendNanoseconds(builder, Math.Abs(nanos));
Microsoft.AspNetCore.Grpc.Swagger (1)
src\Grpc\JsonTranscoding\src\Shared\Legacy.cs (1)
229AppendNanoseconds(builder, Math.Abs(nanos));
Microsoft.AspNetCore.Hosting (1)
src\Shared\StackTrace\ExceptionDetails\ExceptionDetailsProvider.cs (1)
149var preErrorLineNumberInFile = Math.Max(errorStartLineNumberInFile - _sourceCodeLineCount, 1);
Microsoft.AspNetCore.Http (3)
Internal\ReferenceReadStream.cs (2)
95var toRead = Math.Min(count, _length - _position); 108var toRead = (int)Math.Min(buffer.Length, _length - _position);
src\Http\Shared\StreamCopyOperationInternal.cs (1)
57readLength = (int)Math.Min(bytesRemaining.GetValueOrDefault(), (long)readLength);
Microsoft.AspNetCore.Http.Abstractions (5)
Routing\RouteValueDictionary.cs (2)
680capacity = Math.Max(DefaultCapacity, Math.Max(storage.Properties.Length, capacity));
src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
78int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 88nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
Microsoft.AspNetCore.Http.Connections (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.Http.Connections.Tests (1)
TestWebSocketConnectionFeature.cs (1)
155length = Math.Min(buffer.Count - buffer.Offset, _internalBuffer.Buffer.Length);
Microsoft.AspNetCore.Http.Extensions (5)
src\Http\Shared\StreamCopyOperationInternal.cs (1)
57readLength = (int)Math.Min(bytesRemaining.GetValueOrDefault(), (long)readLength);
src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
78int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 88nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
src\Shared\ValueStringBuilder\ValueStringBuilder.cs (1)
293char[] poolArray = ArrayPool<char>.Shared.Rent((int)Math.Max((uint)(_pos + additionalCapacityBeyondPos), (uint)_chars.Length * 2));
Microsoft.AspNetCore.Http.Results (2)
src\Http\Shared\StreamCopyOperationInternal.cs (1)
57readLength = (int)Math.Min(bytesRemaining.GetValueOrDefault(), (long)readLength);
src\Shared\RangeHelper\RangeHelper.cs (1)
121var bytes = Math.Min(end.Value, length);
Microsoft.AspNetCore.Http.Tests (1)
Features\FormFeatureTests.cs (1)
620var toWrite = Math.Min(size - written, bytes.Length);
Microsoft.AspNetCore.HttpLogging (8)
BufferingStream.cs (2)
184sizeHint = Math.Max(MinimumBufferSize, sizeHint); 186var adjustedToMaximumSize = Math.Min(maxBufferSize, sizeHint);
RequestBufferingStream.cs (1)
94var innerCount = Math.Min(remaining, span.Length);
ResponseBufferingStream.cs (1)
85var innerCount = Math.Min(remaining, span.Length);
src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
78int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 88nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
src\Shared\ValueStringBuilder\ValueStringBuilder.cs (1)
293char[] poolArray = ArrayPool<char>.Shared.Rent((int)Math.Max((uint)(_pos + additionalCapacityBeyondPos), (uint)_chars.Length * 2));
Microsoft.AspNetCore.HttpOverrides (4)
ForwardedHeadersMiddleware.cs (4)
133entryCount = Math.Max(forwardedFor.Length, entryCount); 145entryCount = Math.Max(forwardedProto.Length, entryCount); 159entryCount = Math.Max(forwardedHost.Length, entryCount); 174entryCount = Math.Max(forwardedPrefix.Length, entryCount);
Microsoft.AspNetCore.HttpsPolicy (1)
HstsMiddleware.cs (1)
40var maxAge = Convert.ToInt64(Math.Floor(hstsOptions.MaxAge.TotalSeconds))
Microsoft.AspNetCore.Identity.FunctionalTests (1)
src\Identity\Extensions.Core\src\Base32.cs (1)
96var bits = Math.Min(5 - bitIndex, 8 - outputBits);
Microsoft.AspNetCore.InternalTesting (1)
xunit\AspNetTestRunner.cs (1)
80var numAttempts = Math.Max(1, retryAttribute.MaxRetries);
Microsoft.AspNetCore.Mvc.Core (3)
src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (2)
191var cookieChunkCount = (int)Math.Ceiling(value.Length * 1.0 / dataSizePerCookie); 206var length = Math.Min(dataSizePerCookie, remainingLength);
src\Shared\RangeHelper\RangeHelper.cs (1)
121var bytes = Math.Min(end.Value, length);
Microsoft.AspNetCore.Mvc.Core.TestCommon (2)
NonSeekableReadableStream.cs (2)
66count = Math.Max(count, 1); 72count = Math.Max(count, 1);
Microsoft.AspNetCore.Mvc.TagHelpers (3)
CacheTagHelper.cs (1)
264var pageLength = Math.Min(length, page.Length);
GlobbingUrlBuilder.cs (2)
202var compareLength = Math.Max(xLength, yLength); 245var length = Math.Max(xSegment.Length, ySegment.Length);
Microsoft.AspNetCore.Mvc.ViewFeatures (5)
Buffers\MemoryPoolViewBufferScope.cs (1)
58segment = _viewBufferPool.Rent(Math.Max(pageSize, MinimumSize));
Buffers\PagedBufferedTextWriter.cs (1)
57var pageLength = Math.Min(length, page.Length);
Buffers\PagedCharBuffer.cs (2)
60var copyLength = Math.Min(count, page.Length - _charIndex); 81var copyLength = Math.Min(count, page.Length - _charIndex);
src\Shared\PooledArrayBufferWriter.cs (1)
157var growBy = Math.Max(sizeHint, _rentedBuffer.Length);
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (2)
DefaultHtmlGeneratorTest.cs (1)
281Assert.Equal(Math.Min(ModelWithMaxLengthMetadata.MaxLengthAttributeValue, ModelWithMaxLengthMetadata.StringLengthAttributeValue), int.Parse(attribute.Value, CultureInfo.InvariantCulture));
ViewExecutorTest.cs (1)
345var expectedWriteCallCount = Math.Ceiling((double)writeLength / TestHttpResponseStreamWriterFactory.DefaultBufferSize);
Microsoft.AspNetCore.OpenApi (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.OutputCaching (4)
FormatterBinaryWriter.cs (1)
200var toWrite = Math.Min(value.Length, available.Length);
RecyclableArrayBufferWriter.cs (2)
94int growBy = Math.Max(sizeHint, currentLength); 98growBy = Math.Max(growBy, DefaultInitialBufferSize);
RecyclableSequenceBuilder.cs (1)
100var toWrite = Math.Min(buffer.Length, available.Length);
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (4)
EndToEndBenchmarks.cs (4)
83var bytes = Math.Min(rand.Next(4, 1024), value.Length); 96var bytes = Math.Min(rand.Next(4, 1024), value.Length); 98bytes = Math.Min(bytes, span.Length); 111var bytes = Math.Min(rand.Next(4, 1024), value.Length);
Microsoft.AspNetCore.ResponseCaching (1)
src\Shared\SegmentWriteStream.cs (1)
144var bytesWritten = Math.Min(buffer.Length, _segmentSize - (int)_bufferStream.Length);
Microsoft.AspNetCore.Routing (9)
ArrayBuilder.cs (2)
155nextCapacity = Math.Max(capacity + 1, MaxCoreClrArrayLength); 158nextCapacity = Math.Max(nextCapacity, minimum);
Matching\DfaMatcherBuilder.cs (2)
84maxDepth = Math.Max(maxDepth, endpoint.RoutePattern.PathSegments.Count); 560maxSegmentCount = Math.Max(maxSegmentCount, node.PathDepth);
Matching\NegotiationMatcherPolicy.cs (1)
161bestMatchIndex = Math.Max(bestMatchIndex, 0);
Template\RoutePrecedence.cs (4)
50precedence += decimal.Divide(digit, (decimal)Math.Pow(10, i)); 71precedence += decimal.Divide(digit, (decimal)Math.Pow(10, i)); 104precedence += decimal.Divide(digit, (decimal)Math.Pow(10, i)); 127precedence += decimal.Divide(digit, (decimal)Math.Pow(10, i));
Microsoft.AspNetCore.Routing.Microbenchmarks (2)
Matching\JumpTableMultipleEntryBenchmark.cs (2)
156var text = guid.Substring(0, Math.Max(5, Math.Min(i, 36)));
Microsoft.AspNetCore.Server.HttpSys (1)
RequestProcessing\Response.cs (1)
317cachePolicy.SecondsToLive = (uint)Math.Min(_cacheTtl.Value.Ticks / TimeSpan.TicksPerSecond, Int32.MaxValue);
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (10)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
83int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (6)
420int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 458int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 580_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 629dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\DuplexPipeStream.cs (1)
135var count = (int)Math.Min(readableBuffer.Length, destination.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
Microsoft.AspNetCore.Server.IIS (5)
Core\IISHttpContext.IO.cs (1)
36var actual = Math.Min(readableBuffer.Length, memory.Length);
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\DuplexPipeStream.cs (1)
135var count = (int)Math.Min(readableBuffer.Length, destination.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
src\Shared\StackTrace\ExceptionDetails\ExceptionDetailsProvider.cs (1)
149var preErrorLineNumberInFile = Math.Max(errorStartLineNumberInFile - _sourceCodeLineCount, 1);
Microsoft.AspNetCore.Server.Kestrel.Core (29)
Internal\Http\Http1ChunkedEncodingMessageBody.cs (1)
400var actual = Math.Min(buffer.Length, _inputLength);
Internal\Http\HttpRequestStream.cs (1)
133var actual = (int)Math.Min(length, destination.Length);
Internal\Http2\Http2Connection.cs (6)
170StreamPool = new PooledStreamStack<Http2Stream>(Math.Min(InitialStreamPoolSize, http2Limits.MaxStreamsPerConnection)); 180(int)Math.Min(MaxTrackedStreams, int.MaxValue), 203internal uint MaxTrackedStreams => Math.Max(_serverSettings.MaxConcurrentStreams * 2, 100); 941_frameWriter.UpdateMaxFrameSize(Math.Min(_clientSettings.MaxFrameSize, _serverSettings.MaxFrameSize)); 968_frameWriter.UpdateMaxHeaderTableSize(Math.Min(_clientSettings.HeaderTableSize, (uint)Limits.Http2.HeaderTableSize)); 1775var copyAmount = (int)Math.Min(outputBuffer.Length, readResult.Buffer.Length);
Internal\Http2\Http2FrameWriter.cs (1)
949return Math.Min(bytes, _connectionWindow);
Internal\Http2\Http2OutputProducer.cs (1)
164return Math.Min(bytes, _streamWindow);
Internal\Infrastructure\HttpUtilities.cs (1)
165for (var i = 0; i < Math.Min(span.Length, maxChars); i++)
Internal\Infrastructure\PipeWriterHelpers\ConcurrentPipeWriter.cs (2)
387sizeHint = Math.Max(MinimumBufferSize, sizeHint); 389var adjustedToMaximumSize = Math.Min(maxBufferSize, sizeHint);
Internal\Infrastructure\TimeoutControl.cs (4)
114_readTimingElapsedTicks += Math.Min(timestamp - _lastTimestamp, _heartbeatIntervalTicks); 296var singleWriteTimeoutTimestamp = currentTimeUpperBound + Math.Max( 309_writeTimingTimeoutTimestamp = Math.Max(singleWriteTimeoutTimestamp, accumulatedWriteTimeoutTimestamp); 343return Math.Max(_writeTimingTimeoutTimestamp, gracePeriod);
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
83int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (6)
420int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 458int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 580_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 629dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\runtime\Http3\QPack\QPackDecoder.cs (2)
287int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 373int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex);
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\DuplexPipeStream.cs (1)
135var count = (int)Math.Min(readableBuffer.Length, destination.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (6)
CertificatePathWatcherTests.cs (1)
100Assert.Equal(Math.Min(dirCount, fileCount), watcher.TestGetDirectoryWatchCountUnsynchronized());
HeartbeatTests.cs (1)
87var roundedActualMs = Math.Round(actualMs / 50.0) * 50.0;
Http1\Http1ConnectionTests.cs (1)
1092var delay = (int)Math.Ceiling(timeout.TotalMilliseconds / MaxWaitLoop);
src\Servers\Kestrel\shared\test\StringExtensions.cs (1)
15return s.Substring(0, Math.Min(128, s.Length))
src\Shared\test\Shared.Tests\runtime\Http2\DynamicTableTest.cs (1)
172int expectedCount = Math.Min(finalMaxSize / 64, headers.Count);
src\Shared\test\Shared.Tests\runtime\Http3\QPackDecoderTest.cs (1)
343int resolvedSize = Math.Min(encoded.Length - i, chunkSize);
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (1)
SchedulerBenchmark.cs (1)
20private static readonly int IOQueueCount = Math.Min(Environment.ProcessorCount, 16);
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (1)
NamedPipeTransportOptions.cs (1)
20public int ListenerQueueCount { get; set; } = Math.Min(Environment.ProcessorCount, 16);
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (2)
SocketConnectionFactoryOptions.cs (1)
38public int IOQueueCount { get; set; } = Math.Min(Environment.ProcessorCount, 16);
SocketTransportOptions.cs (1)
33public int IOQueueCount { get; set; } = Math.Min(Environment.ProcessorCount, 16);
Microsoft.AspNetCore.Shared.Tests (18)
runtime\Http2\DynamicTableTest.cs (1)
172int expectedCount = Math.Min(finalMaxSize / 64, headers.Count);
runtime\Http3\QPackDecoderTest.cs (1)
343int resolvedSize = Math.Min(encoded.Length - i, chunkSize);
SegmentWriteStreamTests.cs (3)
60var expectedSegmentSize = Math.Min(segmentSize, WriteData.Length - i); 84stream.Write(WriteData, i, Math.Min(writeSize, WriteData.Length - i)); 93var expectedSegmentSize = Math.Min(segmentSize, WriteData.Length - i);
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
83int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (6)
420int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 458int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 580_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 629dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\Shared\runtime\Http3\QPack\QPackDecoder.cs (2)
287int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 373int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex);
src\Shared\SegmentWriteStream.cs (1)
144var bytesWritten = Math.Min(buffer.Length, _segmentSize - (int)_bufferStream.Length);
src\Shared\ServerInfrastructure\BufferWriter.cs (1)
145var writable = Math.Min(source.Length, _span.Length);
src\Shared\ServerInfrastructure\DuplexPipeStream.cs (1)
135var count = (int)Math.Min(readableBuffer.Length, destination.Length);
src\Shared\ServerInfrastructure\MemoryPoolExtensions.cs (1)
25return Math.Min(4096, pool.MaxBufferSize);
Microsoft.AspNetCore.SignalR.Client.Core (2)
src\SignalR\common\Shared\MessageBuffer.cs (2)
373var numElements = (int)Math.Min(BufferLength, Math.Max(1, sequenceId - (linkedBuffer._startingSequenceId - 1)));
Microsoft.AspNetCore.SignalR.Client.Tests (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.SignalR.Common (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.SignalR.Common.Tests (1)
src\SignalR\common\Shared\BinaryMessageParser.cs (1)
36var lengthPrefixBuffer = buffer.Slice(0, Math.Min(MaxLengthPrefixSize, buffer.Length));
Microsoft.AspNetCore.SignalR.Core (2)
src\SignalR\common\Shared\MessageBuffer.cs (2)
373var numElements = (int)Math.Min(BufferLength, Math.Max(1, sequenceId - (linkedBuffer._startingSequenceId - 1)));
Microsoft.AspNetCore.SignalR.Microbenchmarks (1)
src\SignalR\common\Shared\BinaryMessageParser.cs (1)
36var lengthPrefixBuffer = buffer.Slice(0, Math.Min(MaxLengthPrefixSize, buffer.Length));
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (2)
src\SignalR\common\Shared\BinaryMessageParser.cs (1)
36var lengthPrefixBuffer = buffer.Slice(0, Math.Min(MaxLengthPrefixSize, buffer.Length));
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.SignalR.Specification.Tests (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.SignalR.StackExchangeRedis (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.StaticAssets (1)
src\Shared\RangeHelper\RangeHelper.cs (1)
121var bytes = Math.Min(end.Value, length);
Microsoft.AspNetCore.StaticFiles (1)
src\Shared\RangeHelper\RangeHelper.cs (1)
121var bytes = Math.Min(end.Value, length);
Microsoft.AspNetCore.StaticFiles.FunctionalTests (1)
src\Shared\RangeHelper\RangeHelper.cs (1)
121var bytes = Math.Min(end.Value, length);
Microsoft.AspNetCore.TestHost (2)
ResponseBodyReaderStream.cs (1)
99var actual = Math.Min(readableBuffer.Length, buffer.Length);
TestWebSocket.cs (1)
141int count = Math.Min(buffer.Count, receiveMessage.Buffer.Count);
Microsoft.AspNetCore.WebSockets (5)
HandshakeHelpers.cs (1)
206parsedOptions.ServerMaxWindowBits = Math.Min(parsedServerMaxWindowBits ?? 15, serverMaxWindowBits);
src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
78int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 88nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
src\Shared\ValueStringBuilder\ValueStringBuilder.cs (1)
293char[] poolArray = ArrayPool<char>.Shared.Rent((int)Math.Max((uint)(_pos + additionalCapacityBeyondPos), (uint)_chars.Length * 2));
Microsoft.AspNetCore.WebSockets.Tests (2)
BufferStream.cs (2)
133int actualCount = Math.Min(count, _topBuffer.Count); 197var actualCount = Math.Min(count, _topBuffer.Count);
Microsoft.AspNetCore.WebUtilities (18)
BufferedReadStream.cs (2)
209int toCopy = Math.Min(_bufferCount, count); 231int toCopy = Math.Min(_bufferCount, buffer.Length);
FileBufferingReadStream.cs (3)
284var rentedBuffer = _bytePool.Rent(Math.Min((int)oldBuffer.Length, _maxRentedBufferSize)); 359var rentedBuffer = _bytePool.Rent(Math.Min((int)oldBuffer.Length, _maxRentedBufferSize)); 432bufferSize = Math.Max(4096, bufferSize);
HttpResponseStreamWriter.cs (3)
629var remaining = Math.Min(_charBufferSize - _charBufferCount, count); 644var remaining = Math.Min(_charBufferSize - _charBufferCount, count); 660var remaining = Math.Min(_charBufferSize - _charBufferCount, value.Length);
MultipartReaderStream.cs (9)
177var slice = buffer.AsSpan(0, Math.Min(buffer.Length, index)); 197read = _innerStream.Read(buffer, offset, Math.Min(count, matchOffset - bufferedData.Offset)); 208read = _innerStream.Read(buffer, offset, Math.Min(count, bufferedData.Count)); 257var slice = buffer[..Math.Min(buffer.Length, index)]; 280var slice = buffer[..Math.Min(buffer.Length, matchOffset - bufferedData.Offset)]; 294read = _innerStream.Read(buffer.Span[..Math.Min(buffer.Length, bufferedData.Count)]); 325matchOffset = Math.Max(segment1.Offset, segment1.Offset + segment1.Count - matchBytes.Length); 352bufferSize = Math.Max(4096, bufferSize); 361bufferSize = Math.Max(4096, bufferSize);
PagedByteBuffer.cs (1)
53var copyLength = Math.Min(memory.Length, currentPage.Length - _currentPageIndex);
Microsoft.AspNetCore.WebUtilities.Tests (4)
HttpResponseStreamWriterTest.cs (2)
133var expectedWriteCount = Math.Ceiling((double)byteLength / HttpResponseStreamWriter.DefaultBufferSize); 171var expectedWriteCount = Math.Ceiling((double)byteLength / HttpResponseStreamWriter.DefaultBufferSize);
NonSeekableReadStream.cs (2)
59count = Math.Max(count, 1); 65count = Math.Max(count, 1);
Microsoft.Build (49)
BackEnd\BuildManager\BuildManager.cs (1)
1952Math.Round(projectGraph.ConstructionMetrics.ConstructionTime.TotalSeconds, 3),
BackEnd\Client\MSBuildClient.cs (1)
623NodeProviderOutOfProcBase.ConnectToPipeStream(_nodeStream, _pipeName, _handshake, Math.Max(1, timeoutMilliseconds - (int)sw.ElapsedMilliseconds));
BackEnd\Components\Caching\ConfigCache.cs (2)
283remainingToRelease = Convert.ToInt32(Math.Max(1, Math.Floor(_configurations.Count * 0.1)));
BackEnd\Components\Communications\NodeProviderOutOfProcBase.cs (2)
778int lengthToWrite = Math.Min(writeStreamLength - i, MaxPacketWriteSize); 856delay = Math.Min(delay * 2, 500);
BackEnd\Components\Logging\LoggingService.cs (2)
318_queueCapacity = Math.Max(0, _queueCapacity); 1788int newMinImportance = Math.Max((int)_minimumRequiredMessageImportance, (int)minimumImportance);
BackEnd\Components\RequestBuilder\TaskHost.cs (1)
874coresBeingReleased = Math.Min(coresBeingReleased, _additionalAcquiredCores);
BackEnd\Components\Scheduler\Scheduler.cs (8)
585int grantedCores = Math.Min(requestedCores, availableCores); 1303configurationCountLimit = Math.Max(1, (int)Math.Ceiling(configurationCountLimit * _customSchedulerForSQLConfigurationLimitMultiplier / _availableNodes.Count)); 1408int implicitlyGrantedCores = Math.Max(1, (_schedulingData.ExecutingRequestsCount * _nodeCoreAllocationWeight) / 100); 1413return Math.Max(0, _coreLimit - (implicitlyGrantedCores + explicitlyGrantedCores)); 1553inProcNodesToCreate = Math.Min(availableNodesWithInProcAffinity, inProcNodesToCreate); 1585outOfProcNodesToCreate = Math.Min(maxCreatableOutOfProcNodes, outOfProcNodesToCreate); 2502int postPad = Math.Max(20 /* field width */ - (2 * level) /* spacing for hierarchy lines */ - 3 /* length allocated for config/request id */, 0);
BackEnd\Components\Scheduler\SchedulingData.cs (1)
680coresToRemove = Math.Min(request.GrantedCores, coresToRemove);
BackEnd\Components\Scheduler\SchedulingPlan.cs (1)
418MaximumConfigurationId = Math.Max(MaximumConfigurationId, configId);
Collections\HashTableUtility.cs (1)
44int comparison = Math.Sign(h1.Count - h2.Count);
Collections\RetrievableEntryHashSet\HashHelpers.cs (1)
41int limit = (int)Math.Sqrt(candidate);
Definition\Project.cs (2)
2978string displayValue = escapedValue.Substring(0, Math.Min(escapedValue.Length, 75)) + ((escapedValue.Length > 75) ? "..." : String.Empty); 2985string displayOriginalValue = originalValue.Substring(0, Math.Min(originalValue.Length, 75)) + ((originalValue.Length > 75) ? "..." : String.Empty);
Evaluation\Expander.cs (7)
3899else if (_receiverType == typeof(Math)) 3901if (string.Equals(_methodMethodName, nameof(Math.Max), StringComparison.OrdinalIgnoreCase)) 3905returnVal = Math.Max(arg0, arg1); 3909else if (string.Equals(_methodMethodName, nameof(Math.Min), StringComparison.OrdinalIgnoreCase)) 3913returnVal = Math.Min(arg0, arg1); 4643if (Math.Abs(arg - d) == 0) 4680if (Math.Abs(arg - d) == 0)
Evaluation\Profiler\EvaluationLocationPrettyPrinterBase.cs (2)
36return Math.Round(timeSpan.TotalMilliseconds, 0, MidpointRounding.AwayFromZero); 44return Math.Round(percentage, 1, MidpointRounding.AwayFromZero);
FileMatcher.cs (3)
999dop = Math.Min(taskOptions.MaxTasksPerIteration, taskOptions.AvailableTasks); 2537int compareLength = Math.Min( 2576var maxTasks = Math.Max(1, NativeMethodsShared.GetLogicalCoreCount() / 2);
FileUtilities.cs (1)
397var headingSegmentsToRemove = Math.Max(0, segments.Length - trailingSegmentsToKeep);
Instance\ProjectInstance.cs (2)
3059_importPaths = new List<string>(Math.Max(0, importClosure.Count - 1) /* outer project */); 3071_importPathsIncludingDuplicates = new List<string>(Math.Max(0, importClosureWithDuplicates.Count - 1) /* outer project */);
Logging\BaseConsoleLogger.cs (1)
812"{0,5}", Math.Round(elapsedTime.TotalMilliseconds, 0));
Logging\BinaryLogger\Postprocessing\StreamExtensions.cs (1)
48int read = stream.Read(buffer, 0, (int)Math.Min(bytesCount - totalRead, buffer.Length));
Logging\BinaryLogger\Postprocessing\SubStream.cs (2)
46count = Math.Min((int)Math.Max(Length - _position, 0), count);
Logging\LogFormatter.cs (1)
53int prettyLength = System.Math.Min(11, rawTimeLength);
Logging\ParallelLogger\ConsoleOutputAligner.cs (1)
110int remainingCharsToEndOfBuffer = Math.Min(bufferWidthMinusNewLine - cursor, count - endIndex);
Logging\ParallelLogger\ParallelConsoleLogger.cs (1)
1756"{0,5}", Math.Round(elapsedTime.TotalMilliseconds, 0));
NodeEndpointOutOfProcBase.cs (1)
365int waitTimeRemaining = Math.Max(0, CommunicationsUtilities.NodeConnectionTimeout - (int)usedWaitTime.TotalMilliseconds);
Resources\Constants.cs (1)
353availableStaticMethods.TryAdd("System.Math", new Tuple<string, Type>(null, typeof(Math)));
StringExtensions.cs (1)
62int length = Math.Min(span.Length, other.Length);
Utilities\NuGetFrameworkWrapper.cs (1)
114return version.ToString(Math.Max(nonZeroVersionParts, minVersionPartCount));
Microsoft.Build.Engine (5)
Collections\HashTableUtility.cs (1)
44int comparison = Math.Sign(h1.Count - h2.Count);
Logging\BaseConsoleLogger.cs (1)
747"{0,5}", Math.Round(elapsedTime.TotalMilliseconds, 0));
Logging\LogFormatter.cs (1)
53int prettyLength = System.Math.Min(11, rawTimeLength);
Logging\ParallelLogger\ParallelConsoleLogger.cs (1)
1576"{0,5}", Math.Round(elapsedTime.TotalMilliseconds, 0));
Resources\Constants.cs (1)
211availableStaticMethods.TryAdd("System.Math", new Tuple<string, Type>(null, typeof(System.Math)));
Microsoft.Build.Engine.OM.UnitTests (1)
FileUtilities.cs (1)
397var headingSegmentsToRemove = Math.Max(0, segments.Length - trailingSegmentsToKeep);
Microsoft.Build.Engine.UnitTests (1)
Evaluation\SimpleVersion_Tests.cs (1)
129Assert.Equal(expectedSign, Math.Sign(version1.CompareTo(version2)));
Microsoft.Build.Framework (12)
HashHelpers.cs (1)
49var limit = (int)Math.Sqrt(candidate);
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));
StringUtils.cs (1)
24int randomBytesNeeded = (int)Math.Ceiling(length * bytesNumNeededForSingleStringChar);
Microsoft.Build.Tasks.Core (8)
FileMatcher.cs (3)
999dop = Math.Min(taskOptions.MaxTasksPerIteration, taskOptions.AvailableTasks); 2537int compareLength = Math.Min( 2576var maxTasks = Math.Max(1, NativeMethodsShared.GetLogicalCoreCount() / 2);
FileUtilities.cs (1)
397var headingSegmentsToRemove = Math.Max(0, segments.Length - trailingSegmentsToKeep);
GenerateResource.cs (2)
736int maxCount = Math.Min(inputsToProcess.Count, outputsToProcess.Count); 737maxCount = Math.Min(maxCount, 5); // Limit to just 5
Hash.cs (1)
86int charsToProcess = Math.Min(itemSpec.Length - itemSpecPosition, MaxInputChunkLength);
StreamMappedString.cs (1)
388charactersExtracted = Math.Min(length - i, charactersOnPage - relativeStartPosition);
Microsoft.Build.Tasks.UnitTests (6)
XmlPeek_Tests.cs (2)
277for (int i = 0; i < Math.Pow(2, attrs.Length); i++) 282if ((i & (int)Math.Pow(2, k)) != 0)
XmlPoke_Tests.cs (2)
264for (int i = 0; i < Math.Pow(2, attrs.Length); i++) 269if ((i & (int)Math.Pow(2, k)) != 0)
XslTransformation_Tests.cs (2)
442for (int i = 0; i < Math.Pow(2, attrs.Length); i++) 447if ((i & (int)Math.Pow(2, k)) != 0)
Microsoft.Build.UnitTests.Shared (2)
ObjectModelHelpers.cs (2)
288int minimumLength = Math.Min(expectedItems.Length, items.Count); 1936for (int i = 0; i < Math.Min(actualLines.Length, expectedLines.Length); i++)
Microsoft.Build.Utilities.Core (4)
FileMatcher.cs (3)
999dop = Math.Min(taskOptions.MaxTasksPerIteration, taskOptions.AvailableTasks); 2537int compareLength = Math.Min( 2576var maxTasks = Math.Max(1, NativeMethodsShared.GetLogicalCoreCount() / 2);
FileUtilities.cs (1)
397var headingSegmentsToRemove = Math.Max(0, segments.Length - trailingSegmentsToKeep);
Microsoft.DotNet.Build.Tasks.Feed (2)
src\common\GeneralUtils.cs (1)
79int minBytesAvailable = Math.Min(bytesLocalAvailable, bytesRemoteAvailable);
src\ExecWithRetriesForNuGetPush.cs (1)
166Math.Pow(RetryDelayBase, i) + RetryDelayConstant);
Microsoft.DotNet.Build.Tasks.Installers (1)
src\ExecWithRetries.cs (1)
99Math.Pow(RetryDelayBase, i) + RetryDelayConstant);
Microsoft.DotNet.Helix.Sdk (2)
AzureDevOpsTask.cs (2)
174var min = (int)(Math.Pow(factor, attempt) * 1000); 175var max = (int)(Math.Pow(factor, attempt + 1) * 1000);
Microsoft.DotNet.NuGetRepack.Tests (3)
TestHelpers\DiffUtil.cs (3)
211int max = Math.Max(lengthA, lengthB); 263d[i, j] = Math.Min(Math.Min(m1, m2), m3);
Microsoft.DotNet.SignTool (2)
src\Hash.cs (1)
76var maxSize = Math.Min(maxItemsToHash, values.Length);
src\SignToolTask.cs (1)
324int min = Math.Min(dir1.Length, dir2.Length);
Microsoft.DotNet.VersionTools (1)
src\Dependencies\Submodule\SubmoduleDependencyInfo.cs (1)
97public string SimpleVersion => Commit?.Substring(0, Math.Min(7, Commit.Length)) ?? "latest";
Microsoft.Extensions.Caching.Hybrid (2)
Internal\RecyclableArrayBufferWriter.cs (2)
163var growBy = Math.Max(sizeHint, currentLength); 167growBy = Math.Max(growBy, DefaultInitialBufferSize);
Microsoft.Extensions.Caching.MicroBenchmarks (2)
src\Caching\Hybrid\src\Internal\RecyclableArrayBufferWriter.cs (2)
163var growBy = Math.Max(sizeHint, currentLength); 167growBy = Math.Max(growBy, DefaultInitialBufferSize);
Microsoft.Extensions.Caching.StackExchangeRedis (1)
RedisCache.cs (1)
573return (long)Math.Min(
Microsoft.Extensions.DependencyInjection (3)
DependencyInjectionEventSource.cs (2)
118format.Substring(i * MaxChunkSize, Math.Min(MaxChunkSize, format.Length - i * MaxChunkSize)), i, chunkCount, 233descriptorString.Substring(i * MaxChunkSize, Math.Min(MaxChunkSize, descriptorString.Length - i * MaxChunkSize)), i, chunkCount);
ServiceLookup\CallSiteFactory.cs (1)
367return (CallSiteResultCacheLocation)Math.Max((int)locationA, (int)locationB);
Microsoft.Extensions.DependencyModel (1)
DependencyContextJsonReader.cs (1)
66long expectedLength = Math.Max(utf8Bom.Length, stream.Length - stream.Position) + 1;
Microsoft.Extensions.FileProviders.Physical (1)
PollingWildCardChangeToken.cs (1)
169_byteBuffer = new byte[Math.Max(byteCount, 256)];
Microsoft.Extensions.Identity.Core (2)
AuthenticatorTokenProvider.cs (1)
63var unixTimestamp = Convert.ToInt64(Math.Round((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds));
Base32.cs (1)
96var bits = Math.Min(5 - bitIndex, 8 - outputBits);
Microsoft.Extensions.Logging.Abstractions (2)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
Microsoft.Extensions.Logging.Console (2)
src\libraries\Common\src\System\Text\Json\PooledByteBufferWriter.cs (2)
186sizeHint = Math.Max(sizeHint, MaximumBufferSize - currentLength); 191int growBy = Math.Max(sizeHint, currentLength);
Microsoft.Extensions.Logging.Generators (4)
LoggerMessageGenerator.Parser.cs (1)
861return Math.Abs((int)result);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
180int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 190nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
Microsoft.Extensions.Options.SourceGeneration (1)
OptionsSourceGenContext.cs (1)
80return Math.Abs((int)result);
Microsoft.Interop.JavaScript.JSImportGenerator (1)
JSSignatureContext.cs (1)
58int typesHash = Math.Abs((int)hash);
Microsoft.Interop.SourceGeneration (4)
SyntaxExtensions.cs (1)
114(_, _) => Math.Min(idxPartial, idxRef)
TypeSymbolExtensions.cs (1)
278int numArgumentsToCopy = Math.Min(numArgumentsToInsert, typeArgumentsToSubstitute.Length - currentArityOffset);
UseSiteAttributeProvider.cs (2)
51_maxIndirectionLevelDataProvided = Math.Max(_maxIndirectionLevelDataProvided, indirectionDepth); 81_maxIndirectionLevelUsed = Math.Max(indirectionDepth, _maxIndirectionLevelUsed);
Microsoft.JSInterop (2)
src\Components\Shared\src\ArrayBuilder.cs (2)
90var candidateCapacity = Math.Max(_items.Length * 2, _minCapacity); 179var newCapacity = Math.Max(desiredCapacity, _minCapacity);
Microsoft.NET.WebAssembly.Webcil (1)
WebcilConverter.cs (1)
150firstPESection = Math.Min(firstPESection.Position, sectionHeader.PointerToRawData);
Microsoft.VisualBasic.Core (9)
Microsoft\VisualBasic\CompilerServices\LikeOperator.vb (1)
1543SourceIndex = Math.Max(SourceIndex, PatternGroups(PGIndex).MinSourceIndex + 1)
Microsoft\VisualBasic\CompilerServices\VBBinder.vb (5)
1164For ParmIndex = 0 To Math.Min(LastArgIndexToCheck, ParamArrayIndex) - 1 1313For ParmIndex = 0 To Math.Min(ArgCountUpperBound, Math.Max(LastNonSetValueIndex0, LastNonSetValueIndex1)) 1785For ParmIndex = 0 To Math.Max(LastArgNonSetValueIndex, LastParamNonSetValueIndex) 1858Dim ArrayUBound As Integer = Math.Max(vars.GetUpperBound(0), paramOrder.GetUpperBound(0))
Microsoft\VisualBasic\ErrObject.vb (1)
113ElseIf System.String.CompareOrdinal("Exception from HRESULT: 0x", 0, Msg, 0, Math.Min(Msg.Length, 26)) = 0 Then
Microsoft\VisualBasic\FileIO\FileSystem.vb (1)
1300Dim BufferSize As Integer = Math.Max(MaxByteDetectedEncoding, DEFAULT_BUFFER_SIZE)
Microsoft\VisualBasic\Financial.vb (1)
5Imports System.Math
MonoAOTCompiler (1)
MonoAOTCompiler.cs (1)
526int allowedParallelism = DisableParallelAot ? 1 : Math.Min(_assembliesToCompile.Count, Environment.ProcessorCount);
MonoTargetsTasks (4)
EmitBundleTask\EmitBundleBase.cs (3)
156int allowedParallelism = Math.Max(Math.Min(bundledResources.Count, Environment.ProcessorCount), 1); 469: encodedHash.Substring(0, Math.Min(encodedHash.Length, maxEncodedHashLength));
ILStrip\ILStrip.cs (1)
77int allowedParallelism = DisableParallelStripping ? 1 : Math.Min(Assemblies.Length, Environment.ProcessorCount);
MSBuild (6)
CommunicationsUtilities.cs (1)
522timeout = Math.Max(timeout, 50);
FileUtilities.cs (1)
397var headingSegmentsToRemove = Math.Max(0, segments.Length - trailingSegmentsToKeep);
NodeEndpointOutOfProcBase.cs (1)
365int waitTimeRemaining = Math.Max(0, CommunicationsUtilities.NodeConnectionTimeout - (int)usedWaitTime.TotalMilliseconds);
TerminalLogger\NodesFrame.cs (1)
29Width = Math.Min(width, MaxColumn);
TerminalLogger\Terminal.cs (1)
156ReadOnlySpan<char> truncatedText = text.Slice(0, Math.Min(text.Length, Width - 1));
TerminalLogger\TerminalLogger.cs (1)
1217int length = Math.Min(maxLength - indent.Length, text.Length - start);
MSBuildTaskHost (3)
Concurrent\ConcurrentDictionary.cs (1)
440_budget = Math.Max(1, newBuckets.Length / newLocks.Length);
Concurrent\ConcurrentQueue.cs (1)
112int nextSize = tail._preservedForObservation != 0 ? InitialSegmentLength : Math.Min(tail.Capacity * 2, MaxSegmentLength);
NodeEndpointOutOfProcBase.cs (1)
365int waitTimeRemaining = Math.Max(0, CommunicationsUtilities.NodeConnectionTimeout - (int)usedWaitTime.TotalMilliseconds);
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
360[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Math))]
netstandard (1)
netstandard.cs (1)
1049[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Math))]
PresentationBuildTasks (4)
MS\Internal\MarkupCompiler\VersionHelper.cs (1)
205int build = Math.Min(ushort.MaxValue, (int)days.TotalDays);
src\Microsoft.DotNet.Wpf\src\PresentationCore\MS\Internal\Media\XamlSerializationHelper.cs (1)
442scaledInteger = Math.Floor( scaledValue ) ;
src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Media\ParsersCommon.cs (2)
377_curIndex = Math.Min(_curIndex+8, _pathLength); // "Infinity" has 8 characters 387_curIndex = Math.Min(_curIndex+3, _pathLength); // "NaN" has 3 characters
PresentationCore (524)
MS\Internal\AnimatedTypeHelpers.cs (17)
371return Math.Abs((Int32)to - (Int32)from); 388return Math.Abs(to.ScA - from.ScA) 389+ Math.Abs(to.ScR - from.ScR) 390+ Math.Abs(to.ScG - from.ScG) 391+ Math.Abs(to.ScB - from.ScB); 399return (Double)Math.Abs(to - from); 404return Math.Abs(to - from); 409return Math.Abs(to - from); 414return Math.Abs(to - from); 419return Math.Abs(to - from); 441return Math.Abs((to - from).Length); 446return Math.Abs((to - from).Length); 466return Math.Sqrt((a * a) + (b * b)); 476return Math.Abs(to - from); 481return Math.Abs(((System.Windows.Vector)to - (System.Windows.Vector)from).Length); 498return Math.Abs((to - from).Length); 503return Math.Abs((to - from).Length);
MS\Internal\FontCache\FontCacheUtil.cs (1)
742int minLength = Math.Min(aLength, bLength);
MS\Internal\FontCache\FontFaceLayoutInfo.cs (2)
931int smaller = Math.Min(lastChar, firstChar); 932int larger = Math.Max(lastChar, firstChar);
MS\Internal\Generic\Span.cs (1)
510_cp = Math.Min(cp, _dcp);
MS\Internal\IListConverters.cs (4)
108List<double> list = new List<double>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1)); 151List<ushort> list = new List<ushort>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1)); 192List<bool> list = new List<bool>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1)); 234List<Point> list = new List<Point>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1));
MS\Internal\Ink\Bezier.cs (5)
389bool accept = (Math.Abs(det) > Math.Abs(s) * DoubleUtil.DBL_EPSILON && 390Math.Abs(det) > Math.Abs(u) * DoubleUtil.DBL_EPSILON); 537nPoints = (int)(Math.Sqrt(rCurv / tolerance)) + 3;
MS\Internal\Ink\CuspData.cs (4)
473rMin = Math.Min(rMin, a); 474rMax = Math.Max(a, rMax); 502_dist = Math.Abs(rR) + Math.Abs(rB);
MS\Internal\Ink\EllipticalNodeOperations.cs (12)
34_radius = Math.Max(_radii.Width, _radii.Height); 121double distance = Math.Sqrt(distanceSquared); 142rad *= Math.Sqrt(1 - rSinSquared); 143spine *= Math.Sqrt(rSinSquared); 622radius = Math.Abs(nearest.Y); 626radius = Math.Abs(nearest.X); 725double tmp = Math.Sqrt(B*B-4.0f * A * C); 732findex = Math.Min(s1, s2); 759findex = Math.Abs(Math.Min(s1, s2) - 0d) < Math.Abs(Math.Max(s1, s2) - 1d) ? 0d : 1d;
MS\Internal\Ink\ErasingStroke.cs (2)
186Math.Min(lastFragment.BeginFIndex, fragment.BeginFIndex), 187Math.Max(lastFragment.EndFIndex, fragment.EndFIndex));
MS\Internal\Ink\InkSerializedFormat\GorillaCodec.cs (8)
163uint ulAbsMaxDelDel = (uint)Math.Max(MathHelper.AbsNoThrow(minDelDel), MathHelper.AbsNoThrow(maxDelDel)); 165uint ulAbsMax = (uint)Math.Max(MathHelper.AbsNoThrow(minVal), MathHelper.AbsNoThrow(maxVal)); 236maxByte = Math.Max(input[n], maxByte); 237maxShort = Math.Max((ushort)shortReader.ReadUInt16Reverse(Native.BitsPerShort), maxShort); 247maxByte = Math.Max(input[n], maxByte); 248maxShort = Math.Max((ushort)shortReader.ReadUInt16Reverse(Native.BitsPerShort), maxShort); 254maxByte = Math.Max(input[n], maxByte); 296ulAbsMax = (uint)Math.Max(MathHelper.AbsNoThrow(minInt), MathHelper.AbsNoThrow(maxInt));
MS\Internal\Ink\InkSerializedFormat\InkSerializer.cs (3)
1408double dAngle = (tdrd.Transform[0] / 100) * (Math.PI / 180); 1410M00 = M11 = Math.Cos(dAngle); 1411M01 = Math.Sin(dAngle);
MS\Internal\Ink\InkSerializedFormat\SerializationHelper.cs (1)
111ull = (ulong)Math.Abs(Value);
MS\Internal\Ink\Lasso.cs (6)
155DoubleUtil.GreaterThanOrClose(point.X, Math.Min(prevLassoPoint.X, lassoPoint.X)) && 156DoubleUtil.LessThanOrClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X))) 165if (DoubleUtil.GreaterThanOrClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X))) 170else if (DoubleUtil.GreaterThanOrClose(point.X, Math.Min(prevLassoPoint.X, lassoPoint.X))) 521return (Math.Abs(vector.X) < MinDistance && Math.Abs(vector.Y) < MinDistance);
MS\Internal\Ink\Renderer.cs (1)
569i = Math.Min(_visuals.Count, _strokes.Count); //not -1, we're about to decrement
MS\Internal\Ink\StrokeNode.cs (17)
782line1XMin = Math.Floor(line1Start.X); 783line1XMax = Math.Ceiling(line1End.X); 787line1XMin = Math.Floor(line1End.X); 788line1XMax = Math.Ceiling(line1Start.X); 793line2XMin = Math.Floor(line2Start.X); 794line2XMax = Math.Ceiling(line2End.X); 798line2XMin = Math.Floor(line2End.X); 799line2XMax = Math.Ceiling(line2Start.X); 804line1YMin = Math.Floor(line1Start.Y); 805line1YMax = Math.Ceiling(line1End.Y); 809line1YMin = Math.Floor(line1End.Y); 810line1YMax = Math.Ceiling(line1Start.Y); 815line2YMin = Math.Floor(line2Start.Y); 816line2YMax = Math.Ceiling(line2End.Y); 820line2YMin = Math.Floor(line2End.Y); 821line2YMax = Math.Ceiling(line2Start.Y); 1067double floor = Math.Floor(findex);
MS\Internal\Ink\StrokeNodeOperations.cs (2)
738double r = (Math.Abs(nextNode.X) < Math.Abs(nextNode.Y)) //DoubleUtil.IsZero(nextNode.X)
MS\Internal\Ink\StrokeNodeOperations2.cs (1)
511return Math.Sqrt(nearestOnFirst.LengthSquared / shortest.LengthSquared);
MS\Internal\Ink\StrokeRenderer.cs (27)
93double delta = Math.Abs(GetAngleDeltaFromLast(strokeNode.PreviousPosition, strokeNode.Position, ref lastAngle)); 113if ((Math.Min(prevArea, currArea) / Math.Max(prevArea, currArea)) <= 0.70d) 254double maxExtent = Math.Max(drawingAttributes.Height, drawingAttributes.Width); 255percentIntersect += Math.Min(4.99999d, ((maxExtent / 20d) * 5d)); 523bool directionChangedOverAbsoluteThreshold = Math.Abs(delta) > 90d && Math.Abs(delta) < (360d - 90d); 524bool directionChangedOverOverlapThreshold = overlap && !(ignorePressure || strokeNode.PressureFactor == 1f) && Math.Abs(delta) > 30d && Math.Abs(delta) < (360d - 30d); 533if ((Math.Min(prevArea, currArea) / Math.Max(prevArea, currArea)) <= 0.90d) 838double intersectLeft = Math.Max(rect1.Left, rect2.Left); 839double intersectTop = Math.Max(rect1.Top, rect2.Top); 840double intersectWidth = Math.Max((double)(Math.Min(rect1.Right, rect2.Right) - intersectLeft), (double)0); 841double intersectHeight = Math.Max((double)(Math.Min(rect1.Bottom, rect2.Bottom) - intersectTop), (double)0); 851double minArea = Math.Min(rect1Area, rect2Area); 1054angle = Math.PI / 2.0; 1058angle = Math.PI * 3.0 / 2.0; 1069angle = Math.PI; 1076angle = Math.Atan(dy / dx) + Math.PI; 1080angle = Math.Atan(dy / dx) + (2 * Math.PI); 1084angle = Math.Atan(dy / dx); 1089angle = angle * 180 / Math.PI;
MS\Internal\IO\Packaging\DeobfuscatingStream.cs (1)
292int bytesToXor = (int) (Math.Min(ObfuscatedLength, unchecked (readPosition + (long) count)) - readPosition);
MS\Internal\IO\Packaging\NetStream.cs (7)
152count = Math.Min(bytesAvailable, count); // don't return more than they requested, and don't return more than is available 740bytesAvailable = Math.Min(block.Length, (int)(data.End - block.Offset)); 905_length = (int)(Math.Max(_offset + _length, b._offset + b._length) - _offset); 962bytesAvailable = (int)Math.Min(block.Length, _highWaterMark - block.Offset); 1026dataAvailable = (int)Math.Min(block.Length, _highWaterMark - block.Offset); 1058dataAvailable = (int)Math.Min(block.Length, _highWaterMark - block.Offset); 1156block.Length = (int)Math.Min(block.Length, _fullStreamLength - block.Offset);
MS\Internal\Media\XamlSerializationHelper.cs (1)
442scaledInteger = Math.Floor( scaledValue ) ;
MS\Internal\Media3D\GeneralTransform2DTo3DTo2D.cs (19)
517if (!((Math.Max(visEdgeStart.X, visEdgeEnd.X) < Math.Min(uv1.X, uv2.X)) || 518(Math.Min(visEdgeStart.X, visEdgeEnd.X) > Math.Max(uv1.X, uv2.X)) || 519(Math.Max(visEdgeStart.Y, visEdgeEnd.Y) < Math.Min(uv1.Y, uv2.Y)) || 520(Math.Min(visEdgeStart.Y, visEdgeEnd.Y) > Math.Max(uv1.Y, uv2.Y)))) 621if (Math.Abs(visUV1.X - visUV2.X) > Math.Abs(visUV1.Y - visUV2.Y)) 935if (!((Math.Max(visEdgeStart.X, visEdgeEnd.X) < Math.Min(uv1.X, uv2.X)) || 936(Math.Min(visEdgeStart.X, visEdgeEnd.X) > Math.Max(uv1.X, uv2.X)) || 937(Math.Max(visEdgeStart.Y, visEdgeEnd.Y) < Math.Min(uv1.Y, uv2.Y)) || 938(Math.Min(visEdgeStart.Y, visEdgeEnd.Y) > Math.Max(uv1.Y, uv2.Y)))) 1105closestIntersection = ((currClosest - edges[i]._p1Transformed).Length / Math.Sqrt(denom) *
MS\Internal\Media3D\LineUtil.cs (4)
287maxvalue = Math.Max(maxvalue,m[i,j]*m[i,j]); 290maxvalue = Math.Sqrt(maxvalue); 339double root = Math.Sqrt(1+tau*tau); 342_c = 1/Math.Sqrt(1+t*t);
MS\Internal\Media3D\M3DUtil.cs (2)
378return radians*(180.0/Math.PI); 383return degrees*(Math.PI/180.0);
MS\Internal\Shaping\CompositeFontFamily.cs (2)
126return Math.Round(_fontInfo.Baseline * emSize); 157return Math.Round(_fontInfo.LineSpacing * emSize);
MS\Internal\Shaping\TypefaceMap.cs (4)
185cch = Math.Min(cch, itemSpanRider.Length); 186cch = Math.Min(cch, typefaceIndexSpanRider.Length); 230int cch = Math.Min(cchRange - ich, typefaceIndexSpanRider.Length); 396int cch = Math.Min(unicodeString.Length - ich, typefaceSpanRider.Length);
MS\Internal\TextFormatting\Bidi.cs (9)
1613lengthResolved = Math.Max(startOfNeutrals, startOfDelayed) == PositionInvalid ? 1615((Math.Min(startOfNeutrals, startOfDelayed) == PositionInvalid) ? 1616(Math.Max(startOfNeutrals, startOfDelayed)) : 1617(Math.Min(startOfNeutrals, startOfDelayed))); 1847cchText = Math.Min(cchText, index); 2413sor = Helper.IsOdd(Math.Max(baseLevel, levels[runStart])) ? 2418sor = Helper.IsOdd(Math.Max(lastRunLevel, levels[runStart])) ? 2428eor = Helper.IsOdd(Math.Max(levels[runStart], baseLevel)) ? 2443eor = Helper.IsOdd(Math.Max(levels[runStart], levels[runLimits[runNumber-1] + 1])) ?
MS\Internal\TextFormatting\FormatSettings.cs (3)
141_maxLineWidth = Math.Max(maxLineWidth, 0); 178formatWidth = Math.Max(formatWidth, 0); 179formatWidth = Math.Min(formatWidth, Constants.IdealInfiniteWidth);
MS\Internal\TextFormatting\FullTextLine.cs (5)
1384offsetToNextCaretStopIndex = Math.Min(Length, lsrun.Length - caretStopIndex + lsrun.OffsetToFirstCp + _cpFirst); 1426lscpVisisble = Math.Min(lscpVisisble, _metrics._lscpLim - 1); 1658int lscpEndInSubline = Math.Min( 2001int cch = Math.Min(plsrunSpanRider.Length, cchLeft); 2087cch = Math.Min(cch, cchLeft);
MS\Internal\TextFormatting\FullTextState.cs (1)
272return Math.Min(0, TextFormatterImp.RealToIdeal(_markerStore.Pap.TextMarkerProperties.Offset) - _store.Settings.TextIndent);
MS\Internal\TextFormatting\LexicalChunk.cs (2)
86return ich - cchLast + Math.Min(cchLast, lsdcp - lsdcpLast); 94return ich - cchLast + Math.Min(cchLast, lsdcp - lsdcpLast);
MS\Internal\TextFormatting\LineServicesCallbacks.cs (14)
456lstTextMetrics.dvAscent = (int)Math.Round(typeface.Baseline(store.Pap.EmSize, Constants.DefaultIdealToReal, store.Settings.TextSource.PixelsPerDip, fullText.TextFormattingMode)); 457lstTextMetrics.dvMultiLineHeight = (int)Math.Round(typeface.LineSpacing(store.Pap.EmSize, Constants.DefaultIdealToReal, store.Settings.TextSource.PixelsPerDip, fullText.TextFormattingMode)); 715ulInfo.dvpFirstUnderlineOffset = (int)Math.Round(lsrun.EmSize * -underlinePositionInEm); 716ulInfo.dvpFirstUnderlineSize = (int)Math.Round(lsrun.EmSize * underlineThicknessInEm); 769stInfo.dvpLowerStrikethroughOffset = (int)Math.Round(lsrun.EmSize * strikeThroughPositionInEm); 770stInfo.dvpLowerStrikethroughSize = (int)Math.Round(lsrun.EmSize * strikeThroughThicknessInEm); 964int baselineTop = ptOrigin.y + (int)Math.Round(lsrun.EmSize * strikeThroughPositionInEm); 965int overlineTop = baselineTop - (lsrun.BaselineOffset - (int)Math.Round(lsrun.EmSize * strikeThroughThicknessInEm)); 1271penThickness = Math.Abs(penThickness); 1347drawingPenThickness = drawingPenThickness / Math.Abs(unitValue); 2016int expandedBy = Math.Max(0, interWordAdjustTo - adjustedCharWidth); 2023pplsAdjustRight[0][i] = Math.Max(0, adjustedCharWidth - interWordAdjustTo); 2149pplsCompressionRight[0][igi + i] = Math.Max(0, glyphAdvance - interWordCompressTo); 2282int expandedBy = Math.Max(0, interWordExpandTo - glyphAdvance);
MS\Internal\TextFormatting\LineServicesRun.cs (2)
72(shapeable != null ? (int)Math.Round(shapeable.Baseline * realToIdeal) : 0), 73(shapeable != null ? (int)Math.Round(shapeable.Height * realToIdeal) : 0),
MS\Internal\TextFormatting\SimpleTextLine.cs (10)
298realHeight = Math.Max(realHeight, run.Height); 299realAscent = Math.Max(realAscent, run.Baseline); 300realDescent = Math.Max(realDescent, run.Height - run.Baseline); 335_height = formatter.IdealToReal((int)Math.Round(pap.DefaultTypeface.LineSpacing(pap.EmSize, Constants.DefaultIdealToReal, PixelsPerDip, _settings.TextFormattingMode)), PixelsPerDip); 336_baselineOffset = formatter.IdealToReal((int)Math.Round(pap.DefaultTypeface.Baseline(pap.EmSize, Constants.DefaultIdealToReal, PixelsPerDip, _settings.TextFormattingMode)), PixelsPerDip); 370_idealOffsetUnRounded = (int)Math.Round((paragraphWidth - idealWidthAtTrailing) * 0.5); 853int first = Math.Max(ich, dcp) + _cpFirst; 854int afterLast = Math.Min(ich + run.Length, dcp + textLength) + _cpFirst; 1221cpVisible = Math.Max(cpRunStart, cp); 1253cpVisible = Math.Min(cpRunEnd, cp);
MS\Internal\TextFormatting\TextFormatterImp.cs (6)
672return Math.Round(value * pixelsPerDip, midpointRounding) / pixelsPerDip; 715value = Math.Max(value, Constants.DefaultIdealToReal); 726int value = (int)Math.Round(i * ToIdeal); 730value = Math.Max(value, 1); 747int value = (int)Math.Floor(i * ToIdeal); 751value = Math.Max(value, 1);
MS\Internal\TextFormatting\TextMarkerSource.cs (1)
184Math.Min(_characterArray.Length, textSourceCharacterIndexLimit)
MS\Internal\TextFormatting\TextMetrics.cs (5)
185int lscpFirstIndependence = Math.Max( 205_baselineOffset = (int)Math.Round( 216_textAscent = (int)Math.Round(pap.DefaultTypeface.Baseline(pap.EmSize, Constants.DefaultIdealToReal, _pixelsPerDip, fullText.TextFormattingMode)); 217_textHeight = (int)Math.Round(pap.DefaultTypeface.LineSpacing(pap.EmSize, Constants.DefaultIdealToReal, _pixelsPerDip, fullText.TextFormattingMode)); 268_paragraphToText = (int)Math.Round((paragraphWidth + _textStart - _textWidthAtTrailing) * 0.5);
MS\Internal\TextFormatting\TextProperties.cs (1)
394return (int)Math.Round(properties.FontRenderingEmSize * 0.75 * _textRunLength * realToIdeal);
MS\Internal\TextFormatting\TextRunCacheImp.cs (3)
206looseCharLength = (int)Math.Round(TextStore.TypicalCharactersPerLine * 0.25); 229int lookAheadLimit = Math.Min(runLength, looseCharLength + TextStore.TypicalCharactersPerLine); 255looseCharLength = Math.Min(runLength, endOffset);
MS\Internal\TextFormatting\TextShapeableCharacters.cs (2)
358advanceWidthsUnshaped[i] = (int)Math.Round(TextFormatterImp.RoundDipForDisplayMode(glyphMetrics[i].AdvanceWidth * designToEm, pixelsPerDip) * scalingFactor); 370advanceWidthsUnshaped[i] = (int)Math.Round(glyphMetrics[i].AdvanceWidth * designToEm);
MS\Internal\TextFormatting\TextStore.cs (16)
524int effectedRangeStart = Math.Max(cpFetched - offset, bounds[0].Position); 525int effectedRangeEnd = Math.Min(cpFetched - offset + runInfo.Length, bounds[bounds.Length - 1].Position); 535int currentRangeEnd = Math.Min(bounds[i].Position, effectedRangeEnd); 569currentPosition = Math.Max(currentPosition, bounds[i + 1].Position); 1137int runLength = Math.Min(span.length, cchToAdd - ichRun); 1225int first = limit - Math.Min(charRange.Length, limitCp - firstCp); 1308int spanLength = Math.Min(runInfoSpanRider.Length, textEffectsSpanRider.Length); 1309int ichEnd = Math.Min(ichRun + spanLength, cchUniform); 1579(int)Math.Round(realToIdeal * runInfo.TextRun.Properties.FontRenderingEmSize), 1734(int)Math.Round(realToIdeal * runInfo.TextRun.Properties.FontRenderingEmSize), 1973textTop = Math.Max(textTop, lsrun.BaselineOffset); 1974textBottom = Math.Max(textBottom, lsrun.Descent); 1994textBottom = Math.Max(textBottom, lsrun.Height + top); 1998textBottom = Math.Max(textBottom, lsrun.Height + textTop); 2062cellAscent = Math.Max(cellAscent, lsrun.BaselineOffset - move); 2063cellDescent = Math.Max(cellDescent, lsrun.Descent + move);
MS\Internal\TextFormatting\ThousandthOfEmRealDoubles.cs (1)
287thousandthOfEm = (short) Math.Round(scaled);
src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\FloatUtil.cs (6)
38float eps = ((float)Math.Abs(a) + (float)Math.Abs(b) + 10.0f) * FLT_EPSILON; 48return (float)Math.Abs(a-1.0f) < 10.0f * FLT_EPSILON; 56return (float)Math.Abs(a) < 10.0f * FLT_EPSILON; 65return Math.Abs(denominator) <= Math.Abs(numerator) * INVERSE_FLT_MAX_PRECISION;
src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\Ink\BitStream.cs (1)
290int rightShiftNextByteBy = Math.Abs((countOfBits - _cbitsInPartialByte) - Native.BitsPerByte);
System\Windows\dataobject.cs (1)
2348_current = _current + (int)Math.Min(celt, Int32.MaxValue - _current);
System\Windows\Ink\IncrementalHitTester.cs (4)
837weight += Math.Sqrt(da.Width*da.Width + da.Height*da.Height) / 2.0f; 842weight += Math.Sqrt(spine.LengthSquared) / 2.0f; 847weight += Math.Sqrt(da.Width*da.Width + da.Height*da.Height) / 2.0f; 852weight += Math.Sqrt(spine.LengthSquared) / 2.0f;
System\Windows\Ink\Stroke.cs (8)
246double min = Math.Min(shapeBoundingBox.Width, shapeBoundingBox.Height); 247tolerance = Math.Log10(min + min); 370return Math.Sqrt(spine.LengthSquared); 763Math.Ceiling(cutAt[cutAt.Length - 1].EndFIndex) > sourceStylusPoints.Count - 1)); 819Math.Ceiling(cutAt[cutAt.Length - 1].EndFIndex) > sourceStylusPoints.Count - 1)); 871? 0 : (int)Math.Floor(beginFIndex); 875? (sourceStylusPoints.Count - 1) : (int)Math.Ceiling(endFIndex); 929double ceiling = Math.Ceiling(endFIndex);
System\Windows\Ink\Stroke2.cs (4)
393selectedDA.Height = Math.Max(selectedDA.Height, DrawingAttributes.DefaultHeight); 394selectedDA.Width = Math.Max(selectedDA.Width, DrawingAttributes.DefaultWidth); 694double newWidth = Math.Sqrt(w.X * w.X + w.Y * w.Y); 695double newHeight = Math.Sqrt(h.X * h.X + h.Y * h.Y);
System\Windows\Input\AngleUtil.cs (2)
16return degrees * Math.PI / 180.0; 24return radians * 180.0 / Math.PI;
System\Windows\Input\ManipulationLogic.cs (1)
506Radius = (float)Math.Max(1.0, pivot.Radius)
System\Windows\Input\MouseDevice.cs (2)
2171return (Math.Abs(newPosition.X - _lastClick.X) < doubleClickDeltaX) && 2172(Math.Abs(newPosition.Y - _lastClick.Y) < doubleClickDeltaY);
System\Windows\Input\Stylus\Common\StylusPointCollection.cs (4)
533output[x] = (int)Math.Round(stylusPoint.X * StrokeCollectionSerializer.AvalonToHimetricMultiplier); 534output[x + 1] = (int)Math.Round(stylusPoint.Y * StrokeCollectionSerializer.AvalonToHimetricMultiplier); 602output[0][b] = (int)Math.Round(stylusPoint.X * StrokeCollectionSerializer.AvalonToHimetricMultiplier); 603output[1][b] = (int)Math.Round(stylusPoint.Y * StrokeCollectionSerializer.AvalonToHimetricMultiplier);
System\Windows\Input\Stylus\Pointer\PointerFlickEngine.cs (5)
452_flickDirectionRadians = Math.Atan2(newData.PhysicalPoint.Y - _flickStartPhysical.Y, newData.PhysicalPoint.X - _flickStartPhysical.X); 484return ((180 * radians / Math.PI) + 360) % 360; 495return Math.Sqrt(Math.Pow((p1.X - p2.X), 2) + Math.Pow((p1.Y - p2.Y), 2));
System\Windows\Input\Stylus\Pointer\PointerLogic.cs (7)
494return new Point(Math.Round(pt.X), Math.Round(pt.Y)); 510return new Point(Math.Round(pt.X), Math.Round(pt.Y)); 1292int elapsedTime = Math.Abs(unchecked(stylusDownEventArgs.Timestamp - _lastTapTimeTicks)); 1298bool isSameSpot = (Math.Abs(ptPixels.X - _lastTapPoint.X) < doubleTapSize.Width) && 1299(Math.Abs(ptPixels.Y - _lastTapPoint.Y) < doubleTapSize.Height);
System\Windows\Input\Stylus\Pointer\PointerStylusPlugInManager.cs (2)
176ptTablet.X = (int)Math.Round(ptTablet.X); // Make sure we snap to whole window pixels. 177ptTablet.Y = (int)Math.Round(ptTablet.Y);
System\Windows\Input\Stylus\Pointer\PointerStylusPointPropertyInfoHelper.cs (1)
93float exponent = (float)Math.Pow(10, mappedExponent);
System\Windows\Input\Stylus\Pointer\PointerTabletDevice.cs (6)
127Size mouseDoubleTapDefault = new Size(Math.Max(1, MS.Win32.SafeSystemMetrics.DoubleClickDeltaX / 2), 128Math.Max(1, MS.Win32.SafeSystemMetrics.DoubleClickDeltaY / 2)); 138_doubleTapSize = new Size((int)Math.Round((ScreenSize.Width * DoubleTapDelta) / dwXValue), 139(int)Math.Round((ScreenSize.Height *DoubleTapDelta) / dwYValue)); 143_doubleTapSize.Width = Math.Max(mouseDoubleTapDefault.Width, _doubleTapSize.Width); 144_doubleTapSize.Height = Math.Max(mouseDoubleTapDefault.Height, _doubleTapSize.Height);
System\Windows\Input\Stylus\Wisp\PenContexts.cs (3)
209if (context.QueuedInRangeCount > 0 || (Math.Abs(unchecked(timestamp - context.LastInRangeTime)) <= 500)) 512ptTablet.X = (int)Math.Round(ptTablet.X); // Make sure we snap to whole window pixels. 513ptTablet.Y = (int)Math.Round(ptTablet.Y);
System\Windows\Input\Stylus\Wisp\WispLogic.cs (6)
1090int timeSpan = Math.Abs(unchecked(stylusDownEventArgs.Timestamp - stylusDevice.LastTapTime)); 1094bool isSameSpot = (Math.Abs(pPixelPoint.X - pLastPixelPoint.X) < doubleTapSize.Width) && 1095(Math.Abs(pPixelPoint.Y - pLastPixelPoint.Y) < doubleTapSize.Height); 3251if (Math.Abs(unchecked(timestamp - _lastInRangeTime)) <= 500) 3596pt.X = (int)Math.Round(pt.X); // Make sure we return whole numbers (pixels are whole numbers) 3597pt.Y = (int)Math.Round(pt.Y);
System\Windows\Input\Stylus\Wisp\WispStylusDevice.cs (2)
1504if ((Math.Abs(_lastMouseScreenLocation.X - dragPosition.X) > delta.Width) || 1505(Math.Abs(_lastMouseScreenLocation.Y - dragPosition.Y) > delta.Height))
System\Windows\Input\Stylus\Wisp\WispTabletDevice.cs (12)
281Size mouseDragDefault = new Size(Math.Max(1, SafeSystemMetrics.DragDeltaX / 2), 282Math.Max(1, SafeSystemMetrics.DragDeltaY / 2)); 283Size mouseDoubleTapDefault = new Size(Math.Max(1, SafeSystemMetrics.DoubleClickDeltaX / 2), 284Math.Max(1, SafeSystemMetrics.DoubleClickDeltaY / 2)); 294_cancelSize = new Size((int)Math.Round((ScreenSize.Width * stylusLogic.CancelDelta) / dwXValue), 295(int)Math.Round((ScreenSize.Height * stylusLogic.CancelDelta) / dwYValue)); 299_cancelSize.Width = Math.Max(mouseDragDefault.Width, _cancelSize.Width); 300_cancelSize.Height = Math.Max(mouseDragDefault.Height, _cancelSize.Height); 302_doubleTapSize = new Size((int)Math.Round((ScreenSize.Width * stylusLogic.DoubleTapDelta) / dwXValue), 303(int)Math.Round((ScreenSize.Height * stylusLogic.DoubleTapDelta) / dwYValue)); 307_doubleTapSize.Width = Math.Max(mouseDoubleTapDefault.Width, _doubleTapSize.Width); 308_doubleTapSize.Height = Math.Max(mouseDoubleTapDefault.Height, _doubleTapSize.Height);
System\Windows\InterOp\HwndPointerInputProvider.cs (2)
336originOffsetX = (int)Math.Round(originTabletCoord.X); 337originOffsetY = (int)Math.Round(originTabletCoord.Y);
System\Windows\InterOp\HwndSource.cs (2)
921size = new Point(Math.Ceiling(size.X), Math.Ceiling(size.Y));
System\Windows\InterOp\HwndTarget.cs (4)
783(float)(Math.Ceiling((double)(_hwndClientRectInScreenCoords.right - _hwndClientRectInScreenCoords.left))), 784(float)(Math.Ceiling((double)(_hwndClientRectInScreenCoords.bottom - _hwndClientRectInScreenCoords.top)))); 1594(float)(Math.Ceiling((double)(_hwndClientRectInScreenCoords.right - _hwndClientRectInScreenCoords.left))), 1595(float)(Math.Ceiling((double)(_hwndClientRectInScreenCoords.bottom - _hwndClientRectInScreenCoords.top))));
System\Windows\Markup\XmlLanguage.cs (1)
431specificity = Math.Max(GetSubtagCount(languageTag), 1 + GetSpecificity(culture.Parent, maxDepth - 1));
System\Windows\Media\Animation\BackEase.cs (4)
44double amp = Math.Max(0.0, Amplitude); 45return Math.Pow(normalizedTime, 3.0) - normalizedTime * amp * Math.Sin(Math.PI * normalizedTime);
System\Windows\Media\Animation\BounceEase.cs (7)
82double bounces = Math.Max(0.0, (double)Bounces); 92double pow = Math.Pow(bounciness, bounces); 105double bounceAtT = Math.Log(-unitAtT * (1.0-bounciness) + 1.0, bounciness); 106double start = Math.Floor(bounceAtT); 111double startTime = (1.0 - Math.Pow(bounciness, start)) / (oneMinusBounciness * sumOfUnits); 112double endTime = (1.0 - Math.Pow(bounciness, end)) / (oneMinusBounciness * sumOfUnits); 118double amplitude = Math.Pow(1.0 / bounciness, (bounces - start));
System\Windows\Media\Animation\CircleEase.cs (3)
16normalizedTime = Math.Max(0.0, Math.Min(1.0, normalizedTime)); 17return 1.0 - Math.Sqrt(1.0 - normalizedTime * normalizedTime);
System\Windows\Media\Animation\Clock.cs (3)
2160timeUntilNextBoundary = DivideTimeSpan(_currentDuration.TimeSpan, Math.Abs(parentSpeed)); 4183long error = (long)Math.Max(_appliedSpeedRatio, 1.0); 4192Debug.Assert(Math.Abs(optimizedInputTime - inputTime) <= error,
System\Windows\Media\Animation\ClockGroup.cs (1)
205desiredFrameRate = Math.Max(desiredFrameRate, currentDesiredFrameRate.Value);
System\Windows\Media\Animation\DoubleAnimationUsingPath.cs (2)
304double angle = Math.Acos(x) * (180.0 / Math.PI);
System\Windows\Media\Animation\ElasticEase.cs (7)
72double oscillations = Math.Max(0.0, (double)Oscillations); 73double springiness = Math.Max(0.0, Springiness); 81expo = (Math.Exp(springiness * normalizedTime) - 1.0) / (Math.Exp(springiness) - 1.0); 84return expo * (Math.Sin((Math.PI * 2.0 * oscillations + Math.PI * 0.5) * normalizedTime));
System\Windows\Media\Animation\ExponentialEase.cs (2)
54return (Math.Exp(factor * normalizedTime) - 1.0) / (Math.Exp(factor) - 1.0);
System\Windows\Media\Animation\KeySpline.cs (2)
362absdx = Math.Abs(dx); 377if (Math.Abs(x - time) < accuracy * absdx)
System\Windows\Media\Animation\PowerEase.cs (2)
47double power = Math.Max(0.0, Power); 48return Math.Pow(normalizedTime, power);
System\Windows\Media\Animation\SineEase.cs (2)
16return 1.0 - Math.Sin(Math.PI * 0.5 * (1 - normalizedTime));
System\Windows\Media\ArcSegment.cs (1)
104count = Math.Min(count, 4);
System\Windows\Media\ByteStreamGeometryContext.cs (2)
494int cbDataForThisChunk = Math.Min(cbDataSize, 530int newChunkSize = Math.Min(2*_chunkList[_chunkList.Count-1].Length, c_maxChunkSize);
System\Windows\Media\Color.cs (2)
1055return (float)Math.Pow(((double)val + 0.055) / 1.055, 2.4); 1079return ((byte)((255.0f * ((1.055f * (float)Math.Pow((double)val, (1.0 / 2.4))) - 0.055f)) + 0.5f));
System\Windows\Media\Effects\DropShadowEffect.cs (3)
45double direction = Math.PI/180 * Direction; 46double offsetX = depth * Math.Cos(direction); 47double offsetY = depth * Math.Sin(direction);
System\Windows\Media\EllipseGeometry.cs (14)
103currentCenter.X - Math.Abs(currentRadiusX), 104currentCenter.Y - Math.Abs(currentRadiusY), 1052.0 * Math.Abs(currentRadiusX), 1062.0 * Math.Abs(currentRadiusY)); 169strokeThickness = Math.Abs(pen.Thickness); 173center.X - Math.Abs(radiusX)-0.5*strokeThickness, 174center.Y - Math.Abs(radiusY)-0.5*strokeThickness, 1752.0 * Math.Abs(radiusX)+strokeThickness, 1762.0 * Math.Abs(radiusY)+strokeThickness); 254double area = Math.Abs(RadiusX * RadiusY) * Math.PI; 260area *= Math.Abs(transform.Value.Determinant); 364radiusX = Math.Abs(radiusX); 365radiusY = Math.Abs(radiusY);
System\Windows\Media\FamilyTypeface.cs (1)
316pAdvances[i] = Math.Max(0, (int)((metrics.BlackBoxWidth + metrics.LeftSideBearing + metrics.RightSideBearing) * emSize));
System\Windows\Media\FormattedText.cs (21)
344i = Math.Min(limit, i + formatRider.Length); 418i = Math.Min(limit, i + formatRider.Length); 473i = Math.Min(limit, i + formatRider.Length); 526i = Math.Min(limit, i + formatRider.Length); 585i = Math.Min(limit, i + formatRider.Length); 644i = Math.Min(limit, i + formatRider.Length); 696i = Math.Min(limit, i + formatRider.Length); 749i = Math.Min(limit, i + formatRider.Length); 802i = Math.Min(limit, i + formatRider.Length); 854i = Math.Min(limit, i + formatRider.Length); 995return _that._maxTextWidths[Math.Min(line, _that._maxTextWidths.Length - 1)]; 1139Math.Min(textSourcePosition + line.Length - 1, _that._text.Length - 1) 1650int x0 = Math.Max(enumerator.Position, startIndex); 1651int x1 = Math.Min(enumerator.Position + enumerator.Length, startIndex + count); 1802accBlackBoxLeft = Math.Min(accBlackBoxLeft, blackBoxLeft); 1803accBlackBoxRight = Math.Max(accBlackBoxRight, blackBoxRight); 1804accBlackBoxBottom = Math.Max(accBlackBoxBottom, blackBoxBottom); 1805accBlackBoxTop = Math.Min(accBlackBoxTop, blackBoxTop); 1811metrics.Width = Math.Max(metrics.Width, currentLine.Width); 1812metrics.WidthIncludingTrailingWhitespace = Math.Max(metrics.WidthIncludingTrailingWhitespace, currentLine.WidthIncludingTrailingWhitespace); 1813lineStartOfLongestLine = Math.Min(lineStartOfLongestLine, currentLine.Start);
System\Windows\Media\GlyphRun.cs (4)
1418double inflation = Math.Min(_renderingEmSize / 7.0, 1.0); 1460return Math.Max(advance, oneSideBearing + otherSideBearing + 1); 1767_baseVectorX = Math.Sqrt(m11 * m11 + m12 * m12); 1773_baseVectorY = _baseVectorX == 0 ? 0 : Math.Abs(m11 * m22 - m12 * m21) / _baseVectorX;
System\Windows\Media\GlyphsSerializer.cs (6)
72Math.Max( 198int roundedShapingAdvance = (int)Math.Round(_idealAdvanceTotal + shapingAdvance - _currentAdvanceTotal); 199int roundedFontAdvance = (int)Math.Round(fontAdvance); 220int offset = (int)Math.Round(_offsets[glyph].X * _milToEm); 228offset = (int)Math.Round(_offsets[glyph].Y * _milToEm); 294lastCaretStop = Math.Min(i | 3, _caretStops.Count - 1);
System\Windows\Media\GlyphTypeface.cs (3)
1353advanceWidthsUnshaped[i] = (int)Math.Round(TextFormatterImp.RoundDipForDisplayMode(glyphMetrics[i].AdvanceWidth * designToEm, pixelsPerDip) * scalingFactor); 1361advanceWidthsUnshaped[i] = (int)Math.Round(glyphMetrics[i].AdvanceWidth * designToEm); 1369int missingGlyphWidth = (int)Math.Round(TextFormatterImp.RoundDip(emSize * GetAdvanceWidth(0, pixelsPerDip, textFormattingMode, isSideways), pixelsPerDip, textFormattingMode) * scalingFactor);
System\Windows\Media\Imaging\BitmapDownload.cs (1)
361int percentComplete = (int)Math.Floor(100.0 * (double)entry.outputStream.Length / (double)entry.contentLength);
System\Windows\Media\Imaging\BitmapPalette.cs (1)
285int numColors = Math.Min(256, _colors.Count);
System\Windows\Media\Imaging\BitmapSource.cs (2)
479return new Size(Math.Max(0, GetWidthInternal()), 480Math.Max(0, GetHeightInternal()));
System\Windows\Media\Imaging\TransformedBitmap.cs (6)
136scaleX = Math.Abs(m.M11); 137scaleY = Math.Abs(m.M22); 155scaleX = Math.Abs(m.M12); 156scaleY = Math.Abs(m.M21); 195uint width = Math.Max(1, (uint)(scaleX * _source.PixelWidth + 0.5)); 196uint height = Math.Max(1, (uint)(scaleY * _source.PixelHeight + 0.5));
System\Windows\Media\LinearGradientBrush.cs (3)
224angle = angle * (1.0/180.0) * System.Math.PI; 226return (new Point(System.Math.Cos(angle), System.Math.Sin(angle)));
System\Windows\Media\MatrixStack.cs (4)
86_highWaterMark = Math.Max(_highWaterMark, _size); 124_highWaterMark = Math.Max(_highWaterMark, _size); 154_highWaterMark = Math.Max(_highWaterMark, _size); 197int newSize = Math.Max(_highWaterMark, s_initialSize);
System\Windows\Media\MediaContext.cs (4)
120int sqrt = (int) Math.Sqrt(number); 592nextTickNeeded = TimeSpan.FromTicks(Math.Max(nextTickNeeded.Ticks, minimumDelay.Ticks)); 771_animationRenderRate = Math.Max(_adjustedRefreshRate, _timeManager.GetMaxDesiredFrameRate()); 823_animationRenderRate = Math.Min(_animationRenderRate, 1000);
System\Windows\Media\ParsersCommon.cs (2)
377_curIndex = Math.Min(_curIndex+8, _pathLength); // "Infinity" has 8 characters 387_curIndex = Math.Min(_curIndex+3, _pathLength); // "NaN" has 3 characters
System\Windows\Media\RectangleGeometry.cs (9)
205strokeThickness = Math.Abs(pen.Thickness); 299double area = Math.Abs(rect.Width * rect.Height); 302area -= Math.Abs(radiusX * radiusY) * (4.0 - Math.PI); 308area *= Math.Abs(transform.Value.Determinant); 478radiusX = Math.Min(rect.Width * (1.0 / 2.0), Math.Abs(radiusX)); 479radiusY = Math.Min(rect.Height * (1.0 / 2.0), Math.Abs(radiusY));
System\Windows\Media\RenderData.cs (1)
485int newSize = Math.Max((_buffer.Length << 1) - (_buffer.Length >> 1), cbRequiredSize);
System\Windows\Media\textformatting\CharacterBufferReference.cs (1)
91int maxOffset = (charBuffer == null) ? 0 : Math.Max(0, charBuffer.Count - 1);
System\Windows\Media\Typeface.cs (2)
652nominalWidths[i] = (int)Math.Round(TextFormatterImp.RoundDipForDisplayMode(glyphMetrics[i].AdvanceWidth * designToEm, pixelsPerDip) * toIdeal); 661nominalWidths[i] = (int)Math.Round(glyphMetrics[i].AdvanceWidth * designToEm);
System\Windows\Media\VisualCollection.cs (1)
246InternalCapacity = Math.Max(min, (int)(InternalCapacity * c_growFactor));
System\Windows\Media\VisualProxy.cs (1)
580Array.Copy(_tail, reallocatedTail, Math.Min(_tail.Length, newLength));
System\Windows\Media3D\AxisAngleRotation3D.cs (4)
122Math.E, Math.PI, Math.E * Math.PI, 55.0
System\Windows\Media3D\OrthographicCamera.cs (1)
230return x + 0.1*Math.Abs(x) + 1.0;
System\Windows\Media3D\PerspectiveCamera.cs (2)
84double halfWidthDepthRatio = Math.Tan(fov/2); 132double halfWidthDepthRatio = Math.Tan(fov/2);
System\Windows\Media3D\Quaternion.cs (34)
89double angleInRadians = angleInDegrees * (Math.PI / 180.0); 93Vector3D v = (axisOfRotation / length) * Math.Sin(0.5 * angleInRadians); 97_w = Math.Cos(0.5 * angleInRadians); 161double msin = Math.Sqrt(_x*_x + _y*_y + _z*_z); 170double maxcoeff = Math.Max(Math.Abs(_x),Math.Max(Math.Abs(_y),Math.Abs(_z))); 174msin = Math.Sqrt(x*x + y*y + z*z); 180return Math.Atan2(msin,mcos) * (360.0 / Math.PI); 260double rmax = 1.0/Max(Math.Abs(_x), 261Math.Abs(_y), 262Math.Abs(_z), 263Math.Abs(_w)); 271double normInverse = 1.0 / Math.Sqrt(norm2); 445double max = Math.Max(Math.Max(Math.Abs(_x),Math.Abs(_y)), 446Math.Max(Math.Abs(_z),Math.Abs(_w))); 453double smallLength = Math.Sqrt(x*x+y*y+z*z+w*w); 457return Math.Sqrt(norm2); 561double theta = t * Math.PI; 563scaleFrom = Math.Cos(theta); 564scaleTo = Math.Sin(theta); 569double omega = Math.Acos(cosOmega); 570double sinOmega = Math.Sqrt(1.0 - cosOmega*cosOmega); 571scaleFrom = Math.Sin((1.0 - t) * omega) / sinOmega; 572scaleTo = Math.Sin(t * omega) / sinOmega; 580double lengthOut = lengthFrom * Math.Pow(lengthTo/lengthFrom, t);
System\Windows\Media3D\Ray3DHitTestResult.cs (1)
99return Math.Sign(x.DistanceToRayOrigin - y.DistanceToRayOrigin);
System\Windows\Media3D\Rect3D.cs (18)
97_x = Math.Min(point1._x, point2._x); 98_y = Math.Min(point1._y, point2._y); 99_z = Math.Min(point1._z, point2._z); 100_sizeX = Math.Max(point1._x, point2._x) - _x; 101_sizeY = Math.Max(point1._y, point2._y) - _y; 102_sizeZ = Math.Max(point1._z, point2._z) - _z; 438double x = Math.Max(_x, rect._x); 439double y = Math.Max(_y, rect._y); 440double z = Math.Max(_z, rect._z); 441_sizeX = Math.Min(_x + _sizeX, rect._x + rect._sizeX) - x; 442_sizeY = Math.Min(_y + _sizeY, rect._y + rect._sizeY) - y; 443_sizeZ = Math.Min(_z + _sizeZ, rect._z + rect._sizeZ) - z; 476double x = Math.Min(_x, rect._x); 477double y = Math.Min(_y, rect._y); 478double z = Math.Min(_z, rect._z); 479_sizeX = Math.Max(_x + _sizeX, rect._x + rect._sizeX) - x; 480_sizeY = Math.Max(_y + _sizeY, rect._y + rect._sizeY) - y; 481_sizeZ = Math.Max(_z + _sizeZ, rect._z + rect._sizeZ) - z;
System\Windows\Media3D\Vector3D.cs (11)
65return Math.Sqrt(_x * _x + _y * _y + _z * _z); 90double m = Math.Abs(_x); 91double absy = Math.Abs(_y); 92double absz = Math.Abs(_z); 106double length = Math.Sqrt(_x * _x + _y * _y + _z * _z); 172theta = Math.PI - 2.0 * Math.Asin((-vector1 - vector2).Length / 2.0); 176theta = 2.0 * Math.Asin((vector1 - vector2).Length / 2.0); 468return new Size3D(Math.Abs(vector._x), Math.Abs(vector._y), Math.Abs(vector._z));
System\Windows\UIElement.cs (2)
1096newValue = Math.Round(value * dpiScale) / dpiScale; 1107newValue = Math.Round(value);
PresentationFramework (1130)
Microsoft\Win32\CommonDialog.cs (2)
326(int)Math.Round(x), 327(int)Math.Round(y), // new X and Y positions
MS\Internal\AnimatedTypeHelpers.cs (6)
84return Math.Abs(to - from); 90Math.Pow(GetSegmentLengthDouble(from.Left, to.Left), 2.0) 91+ Math.Pow(GetSegmentLengthDouble(from.Top, to.Top), 2.0) 92+ Math.Pow(GetSegmentLengthDouble(from.Right, to.Right), 2.0) 93+ Math.Pow(GetSegmentLengthDouble(from.Bottom, to.Bottom), 2.0); 95return Math.Sqrt(totalLength);
MS\Internal\Annotations\Component\MarkedHighlightComponent.cs (1)
854sign = Math.Sign(next.Left - current.Left);
MS\Internal\AppModel\IconHelper.cs (1)
346return (((int)Math.Ceiling(original) + (nBitsCount - 1)) / nBitsCount) * nBitsCount;
MS\Internal\Controls\InkCanvasInnerCanvas.cs (4)
97newSize.Width = Math.Max(newSize.Width, left + child.DesiredSize.Width); 101newSize.Width = Math.Max(newSize.Width, child.DesiredSize.Width); 107newSize.Height = Math.Max(newSize.Height, top + child.DesiredSize.Height); 111newSize.Height = Math.Max(newSize.Height, child.DesiredSize.Height);
MS\Internal\Controls\StickyNote\StickyNoteAnnotations.cs (6)
1057if (DoubleUtil.GreaterThan(Math.Abs(offsetX), Math.Abs(_offsetX))) 1063offset = Math.Max(offset, -(rectStickyNote.Left - rectPage.Left)); 1069if (DoubleUtil.GreaterThan(Math.Abs(offsetY), Math.Abs(_offsetY))) 1074offset = Math.Max(offset, -(rectStickyNote.Top - rectPage.Top));
MS\Internal\Data\RBTree.cs (1)
398int n = Math.Min(mid - left, right - mid);
MS\Internal\Documents\ContentElementCollection.cs (1)
671PrivateCapacity = Math.Max(min, PrivateCapacity * 2);
MS\Internal\Documents\DocumentGrid.cs (18)
323if (Math.Abs(pageNumber - _firstVisiblePageNumber) > 1) 584double clippedHorizontalOffset = Math.Min(_horizontalOffset, ExtentWidth - ViewportWidth); 585clippedHorizontalOffset = Math.Max(clippedHorizontalOffset, 0.0); 627double clippedVerticalOffset = Math.Min(_verticalOffset, ExtentHeight - ViewportHeight); 628clippedVerticalOffset = Math.Max(clippedVerticalOffset, 0.0); 1224pageOffset = new Point(Math.Max(ViewportWidth, ExtentWidth) - (xOffset + pageSize.Width), yOffset); 1452visiblePages.Add(_childrenCollection[_firstPageVisualIndex + j - Math.Max(0, firstPage)]); 1606double centerWidth = Math.Max(ViewportWidth, ExtentWidth); 2229(int)Math.Floor(ViewportWidth / 2234maxColumns = Math.Min(maxColumns, _pageCache.PageCount); 2235maxColumns = Math.Min(maxColumns, DocumentViewerConstants.MaximumMaxPagesAcross); 2246int rows = (int)Math.Floor((double)(_pageCache.PageCount / columns)); 2258double aspectDiff = Math.Abs(layoutAspect - viewportAspect); 2370newScale = Math.Max(newScale, CurrentMinimumScale); 2371newScale = Math.Min(newScale, DocumentViewerConstants.MaximumScale); 2440scaleFactor = Math.Min(compensatedViewportWidth / rowWidth, compensatedViewportHeight / rowHeight); 2469scaleFactor = Math.Min(compensatedViewportWidth / rowWidth, 2699Math.Max(0.0, (ExtentWidth - row.RowSize.Width) / 2.0) : 0.0;
MS\Internal\Documents\DocumentPageTextView.cs (2)
655while (Math.Abs(pagesMoved) < Math.Abs(count))
MS\Internal\Documents\FlowDocumentView.cs (8)
84desiredSize.Width = Math.Min(constraint.Width, _formatter.DocumentPage.Size.Width); 85desiredSize.Height = Math.Min(constraint.Height, _formatter.DocumentPage.Size.Height); 134if (Math.Abs(_scrollData.ExtentWidth - _scrollData.ViewportWidth) < 1) 138if (Math.Abs(_scrollData.ExtentHeight - _scrollData.ViewportHeight) < 1) 144Math.Max(0, Math.Min(_scrollData.ExtentWidth - _scrollData.ViewportWidth, _scrollData.HorizontalOffset)), 145Math.Max(0, Math.Min(_scrollData.ExtentHeight - _scrollData.ViewportHeight, _scrollData.VerticalOffset)));
MS\Internal\Documents\IFlowDocumentViewer.cs (2)
834GoToPage(Math.Max(1, MasterPageNumber - 2)); 842GoToPage(Math.Min(PageCount, MasterPageNumber + 2));
MS\Internal\Documents\MultiPageTextView.cs (17)
762Invariant.Assert(Math.Abs(request.NewCount) >= Math.Abs(linesMoved)); 834Invariant.Assert(Math.Abs(request.NewCount) >= Math.Abs(pagesMoved)); 982Invariant.Assert(Math.Abs(pagesMoved) <= Math.Abs(count)); 1100horz = Math.Min(Math.Abs(point.X - textViewBounds.Left), Math.Abs(point.X - textViewBounds.Right)); 1108vert = Math.Min(Math.Abs(point.Y - textViewBounds.Top), Math.Abs(point.Y - textViewBounds.Bottom)); 1110textViewProximities[i] = Math.Sqrt(Math.Pow(horz, 2) + Math.Pow(vert, 2)); 1195int closestDistance = Math.Abs(count); 1220int distance = Math.Abs(currentPageNumber - pageNumber);
MS\Internal\Documents\RowCache.cs (13)
316double roundedOffset = Math.Round(offset, _findOffsetPrecision); 324double rowOffset = Math.Round(_rowCache[i].VerticalOffset, _findOffsetPrecision); 325double rowHeight = Math.Round(_rowCache[i].RowSize.Height, _findOffsetPrecision); 416startOffset = Math.Round(startOffset, _findOffsetPrecision); 417endOffset = Math.Round(endOffset, _findOffsetPrecision); 423double rowOffset = Math.Round(_rowCache[i].VerticalOffset, _findOffsetPrecision); 475_extentWidth = Math.Max(currentRow.RowSize.Width, _extentWidth); 542_layoutColumns = Math.Min(_layoutColumns, PageCache.PageCount); 543_layoutColumns = Math.Max(1, _layoutColumns); 657pivotPage = Math.Max(0, PageCache.PageCount - columns); 981_extentWidth = Math.Max(newRow.RowSize.Width, _extentWidth); 1109_extentWidth = Math.Max(row.RowSize.Width, _extentWidth); 1377_rowSize.Height = Math.Max(pageSize.Height, _rowSize.Height);
MS\Internal\Documents\ScrollData.cs (4)
135offset = Math.Max(0, Math.Min(_extent.Width - _viewport.Width, offset)); 157offset = Math.Max(0, Math.Min(_extent.Height - _viewport.Height, offset));
MS\Internal\Documents\TextBoxLine.cs (1)
124int runLength = Math.Min(128, position.GetTextRunLength(LogicalDirection.Backward));
MS\Internal\Documents\TextBoxView.cs (32)
503desiredSize.Width = Math.Min(constraint.Width, desiredSize.Width); 504desiredSize.Height = Math.Min(constraint.Height, desiredSize.Height); 697int startOffset = Math.Min(_lineMetrics[_lineMetrics.Count - 1].EndOffset, startPosition.Offset); 698int endOffset = Math.Min(_lineMetrics[_lineMetrics.Count - 1].EndOffset, endPosition.Offset); 705firstLineIndex = Math.Max(firstLineIndex, GetLineIndexFromOffset(startOffset, LogicalDirection.Forward)); 706lastLineIndex = Math.Min(lastLineIndex, GetLineIndexFromOffset(endOffset, LogicalDirection.Backward)); 775int nextLineIndex = Math.Max(0, Math.Min(_lineMetrics.Count - 1, lineIndex + count)); 1791Math.Max(0, Math.Min(_scrollData.ExtentWidth - _scrollData.ViewportWidth, _scrollData.HorizontalOffset)), 1792Math.Max(0, Math.Min(_scrollData.ExtentHeight - _scrollData.ViewportHeight, _scrollData.VerticalOffset))); 1938int endOffset = Math.Min(range.StartIndex + range.PositionsAdded, _host.TextContainer.SymbolCount); 2049int startOffset = Math.Max(_lineMetrics[lineIndex].Offset, unclippedStartOffset); 2050int endOffset = Math.Min(_lineMetrics[lineIndex].EndOffset, unclippedEndOffset); 2145int startOffset = Math.Max(lineStartOffset, unclippedStartOffset); 2146int endOffset = Math.Min(lineEndOffset, unclippedEndOffset); 2205lastLineIndex = (int)Math.Ceiling((viewport.Y + viewport.Height) / _lineHeight) - 1; 2208firstLineIndex = Math.Max(0, Math.Min(firstLineIndex, _lineMetrics.Count - 1)); 2209lastLineIndex = Math.Max(0, Math.Min(lastLineIndex, _lineMetrics.Count - 1)); 2281desiredSize.Width = Math.Max(desiredSize.Width, line.Width); 2555int lastCoveredCharOffset = range.StartIndex + Math.Max(range.PositionsAdded, range.PositionsRemoved); 2651desiredSize.Width = Math.Max(desiredSize.Width, _lineMetrics[i].Width); 2714int lineIndex = Math.Max(oldLineVisualsIndex, firstLineIndex); 2715int lineCount = Math.Min(oldLastLineIndex, firstLineIndex + count - 1) - lineIndex + 1; 2809count = Math.Max(0, count); 2815count = Math.Min(count, _viewportLineVisuals.Count - start); 2993int rangeStart = Math.Max(viewportStart, selectionStart); 2994int rangeSize = Math.Min(viewportEnd, selectionEnd) - rangeStart; 3130padding = Math.Max(0, viewport.Height - _contentSize.Height);
MS\Internal\Documents\TextContainerHelper.cs (6)
202_cpFirst = Math.Min(_cpFirst, cpFirst); 203_cpLast = Math.Max(_cpLast, cpLast); 227_ranges[i * 2] = Math.Min(_ranges[i * 2], cpFirst); 228_ranges[i * 2 + 1] = Math.Max(_ranges[i * 2 + 1], cpLast); 250_ranges[pos * 2 + 1] = Math.Max(_ranges[pos * 2 + 1], _ranges[(pos + 1) * 2 + 1]); 475int depth = Math.Min(ancestorsStart.Count, ancestorsEnd.Count);
MS\Internal\Documents\TextDocumentView.cs (2)
2107double distance = Math.Abs(point.X - midPoint.X) + Math.Abs(point.Y - midPoint.Y);
MS\Internal\Documents\TextParagraphView.cs (6)
167lineIndex = Math.Max(0, lineIndex + count); 168lineIndex = Math.Min(lines.Count - 1, lineIndex); 578lineIndex = Math.Max(Math.Min((int)(point.Y / approximatedLineHeight), lines.Count - 1), 0); 724siblingGap = Math.Max(lineBox.X - (siblingLineBox.X + siblingLineBox.Width), 0); 753siblingGap = Math.Max(siblingLineBox.X - (lineBox.X + lineBox.Width), 0);
MS\Internal\Globalization\LocalizableResourceBuilder.cs (2)
576Readability readability = (Readability)Math.Min( 582Modifiability modifiability = (Modifiability)Math.Min(
MS\Internal\Helper.cs (7)
1081headerSize.Height = Math.Max(itemsCorrectionFactor.Top, headerSize.Height); 1085headerSize.Height = Math.Max(virtualizingElement.DesiredSize.Height, headerSize.Height); 1087headerSize.Width = Math.Max(virtualizingElement.DesiredSize.Width, headerSize.Width); 1118itemPixelSize.Width = Math.Max(desiredSize.Width, itemPixelSize.Width); 1131itemPixelSizeBeforeViewport.Width = Math.Max(desiredSize.Width, itemPixelSizeBeforeViewport.Width); 1143itemPixelSizeInViewport.Width = Math.Max(desiredSize.Width, itemPixelSizeInViewport.Width); 1154itemPixelSizeAfterViewport.Width = Math.Max(desiredSize.Width, itemPixelSizeAfterViewport.Width);
MS\Internal\Ink\LassoHelper.cs (6)
113double step = Math.Sqrt(MinDistanceSquared / distanceSquared); 237&& DoubleUtil.GreaterThanOrClose(point.X, Math.Min(prevLassoPoint.X, lassoPoint.X)) 238&& DoubleUtil.LessThanOrClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X))) 247if (DoubleUtil.GreaterThanOrClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X))) 253if ((0 == i) && DoubleUtil.AreClose(point.X, Math.Max(prevLassoPoint.X, lassoPoint.X))) 258else if (DoubleUtil.GreaterThanOrClose(point.X, Math.Min(prevLassoPoint.X, lassoPoint.X)))
MS\Internal\Ink\PenCursorManager.cs (3)
220int xHotspot = (int)Math.Round(hotspot.X - drawingBounds.Left); 221int yHotspot = (int)Math.Round(hotspot.Y - drawingBounds.Top); 347double maxLength = Math.Min(SystemParameters.PrimaryScreenWidth / 2, SystemParameters.PrimaryScreenHeight / 2);
MS\Internal\PtsHost\CellParagraph.cs (1)
81Math.Max(TextDpi.FromTextDpi(dvrAvailable), 0));
MS\Internal\PtsHost\ContainerParaClient.cs (2)
66_rect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du); 67_rect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv);
MS\Internal\PtsHost\ContainerParagraph.cs (13)
528fsrcToFillSubtrack.u = Math.Max(Math.Min(fsrcToFillSubtrack.u, fsrcToFill.u + fsrcToFill.du - 1), fsrcToFill.u); 529fsrcToFillSubtrack.du = Math.Max(fsrcToFillSubtrack.du, 0); 542fsrcToFillSubtrack.v = Math.Max(Math.Min(fsrcToFillSubtrack.v, fsrcToFill.v + fsrcToFill.dv - 1), fsrcToFill.v); 543fsrcToFillSubtrack.dv = Math.Max(fsrcToFillSubtrack.dv, 0); 603dvrUsed = Math.Min(fsrcToFill.dv, dvrUsed); 686urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack); 687durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0); 816urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack); 817durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
MS\Internal\PtsHost\DtrList.cs (2)
104int adjust = Math.Min(_dtrs[i].PositionsAdded, dtr.PositionsRemoved - delta); 118int adjust = Math.Min(dtr.PositionsRemoved, _dtrs[i].PositionsAdded - delta);
MS\Internal\PtsHost\FigureHelper.cs (5)
184value = Math.Max(1, Math.Min(value, structuralCache.CurrentFormatContext.PageHeight)); 189value = Math.Max(1, Math.Min(value, structuralCache.CurrentFormatContext.PageHeight - pageMargin.Top - pageMargin.Bottom)); 257width = Math.Min(width, pageWidth);
MS\Internal\PtsHost\FigureParaClient.cs (4)
84_contentRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BPRight - mbp.BPLeft); 86_contentRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BPBottom - mbp.BPTop); 89_paddingRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BorderRight - mbp.BorderLeft); 91_paddingRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BorderBottom - mbp.BorderTop);
MS\Internal\PtsHost\FigureParagraph.cs (4)
161int subpageWidth = Math.Max(1, TextDpi.ToTextDpi(anchorLimitedWidth) - (mbp.BPLeft + mbp.BPRight)); 170int subpageHeight = Math.Max(1, TextDpi.ToTextDpi(anchorLimitedHeight) - (mbp.BPTop + mbp.BPBottom)); 617width = Math.Max(TextDpi.MinWidth, maxTotalWidth - elementMarginWidth); 646height = Math.Max(TextDpi.MinWidth, maxTotalHeight - elementMarginHeight);
MS\Internal\PtsHost\FloaterParaClient.cs (4)
205_contentRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BPRight - mbp.BPLeft); 207_contentRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BPBottom - mbp.BPTop); 210_paddingRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BorderRight - mbp.BorderLeft); 212_paddingRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BorderBottom - mbp.BorderTop);
MS\Internal\PtsHost\FloaterParagraph.cs (7)
216dvrAvailable = Math.Min(dvrAvailable, PTS.dvBottomUndefined / 2); 222dvrAvailable = Math.Min(dvrAvailable, TextDpi.ToTextDpi(StructuralCache.CurrentFormatContext.PageHeight)); 235subpageHeight = Math.Max(1, dvrAvailable - (mbp.MBPTop + mbp.MBPBottom)); 668subpageWidth = Math.Max(1, durSpecified - (mbp.BPLeft + mbp.BPRight)); 673subpageWidth = Math.Max(1, durAvailable - (mbp.MBPLeft + mbp.MBPRight)); 679subpageWidth = Math.Max(1, durAvailable - (mbp.MBPLeft + mbp.MBPRight)); 882return Math.Min(desiredSize, spaceAvailable);
MS\Internal\PtsHost\Line.cs (1)
110dvrSuppressible = Math.Max(0, TextDpi.ToTextDpi(_line.OverhangAfter));
MS\Internal\PtsHost\ListMarkerSourceInfo.cs (1)
198state.number = Math.DivRem(state.number, state.b, out int remainder) - state.disjoint;
MS\Internal\PtsHost\MarginCollapsingState.cs (2)
167_maxPositive = Math.Max(_maxPositive, mcs._maxPositive); 168_minNegative = Math.Min(_minNegative, mcs._minNegative);
MS\Internal\PtsHost\PtsHelper.cs (9)
838return Math.Max(1, Math.Min(PTS.Restrictions.tscColumnRestriction-1, columns)); // at least 1 column is required 885columnWidth = Math.Max(1, Math.Min(columnWidth, pageWidth)); 887freeSpace = Math.Max(0, freeSpace); 928pfscolinfo[i].durBefore = Math.Max(0, pfscolinfo[i].durBefore); 929pfscolinfo[i].durWidth = Math.Max(1, pfscolinfo[i].durWidth); 960pfscolinfo[i].durBefore = Math.Max(0, pfscolinfo[i].durBefore); 961pfscolinfo[i].durWidth = Math.Max(1, pfscolinfo[i].durWidth);
MS\Internal\PtsHost\PtsHost.cs (1)
1532for(int breakIndex = 0; breakIndex < Math.Min(textBreakpoints.Count, nLineVariantsAlloc); breakIndex++)
MS\Internal\PtsHost\PtsPage.cs (7)
778rect.dv = Math.Max(rect.dv, bbox.fsrc.dv); 781_calculatedSize.Width = Math.Max(TextDpi.MinWidth, TextDpi.FromTextDpi(rect.du)); 782_calculatedSize.Height = Math.Max(TextDpi.MinWidth, TextDpi.FromTextDpi(rect.dv)); 786_contentSize.Width = Math.Max(Math.Max(TextDpi.FromTextDpi(bbox.fsrc.du), TextDpi.MinWidth), _calculatedSize.Width); 787_contentSize.Height = Math.Max(TextDpi.MinWidth, TextDpi.FromTextDpi(bbox.fsrc.dv)); 793_contentSize.Height = Math.Max(_contentSize.Height, _calculatedSize.Height);
MS\Internal\PtsHost\SubpageParaClient.cs (4)
97_contentRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BPRight - mbp.BPLeft); 99_contentRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BPBottom - mbp.BPTop); 102_paddingRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BorderRight - mbp.BorderLeft); 104_paddingRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BorderBottom - mbp.BorderTop);
MS\Internal\PtsHost\SubpageParagraph.cs (16)
182subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight)); 191subpageHeight = Math.Max(1, subpageHeight - (marginTop + mbp.BPTop)); 245dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v); 246fsrcToFill.du = Math.Max(fsrcToFill.du, fsbbox.fsrc.du + fsbbox.fsrc.u); 289fsbbox.fsrc.du = Math.Max(fsrcToFill.du - (mbp.MarginLeft + mbp.MarginRight), 0); 290fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0); 369subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight)); 441dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v); 442durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u); 452fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0); 453fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0); 529subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight)); 600dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v); 601durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u); 611fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0); 612fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
MS\Internal\PtsHost\TableParaClient.cs (11)
652int du = Math.Min(Math.Abs(rect.u - u), Math.Abs(rect.u + rect.du - u)); 653int dv = Math.Min(Math.Abs(rect.v - v), Math.Abs(rect.v + rect.dv - v)); 1001int iDistance = Math.Abs((cpc.Rect.u + cpc.Rect.du / 2) - suggestedU); 1077int iDistance = Math.Abs((cpc.Rect.u + cpc.Rect.du / 2) - suggestedU); 1934Math.Min(_calculatedColumns.Length, columns)); 2426Math.Max(_rect.du - (mbpInfo.BPRight + mbpInfo.BPLeft), 1), 2427Math.Max(_rect.dv - calculatedBPBottom - calculatedBPTop, 1)
MS\Internal\PtsHost\TextParaClient.cs (19)
745int dcpStart = Math.Max(cpStartTextPointer, cpParagraphStart) - cpParagraphStart; 749int dcpEnd = Math.Min(cpEndTextPointer, cpParagraphEnd) - cpParagraphStart; 1414int countVisualsShiftBeforeChange = Math.Min(Math.Max(lineIndexToBeginRemoval - _lineIndexFirstVisual, 0), lineVisuals.Count); 1431int actualLinesToRemove = Math.Min(Math.Max(lineIndexToBeginRemoval - _lineIndexFirstVisual + cLinesToRemove, 0), lineVisuals.Count); 1459int actualLinesToRemove = Math.Min(cLinesToRemove, lineVisuals.Count - (lineIndexToBeginRemoval - _lineIndexFirstVisual)); 1879int dcpRangeStartForThisLine = Math.Max(lineDesc.dcpFirst, dcpStart); 1882int cchRangeForThisLine = Math.Max(Math.Min(lineDesc.dcpLim, dcpEnd) - dcpRangeStartForThisLine, 1); 1989int dcpRangeStartForThisElem = Math.Max(elemDesc.dcpFirst, dcpStart); 1992int cchRangeForThisElem = Math.Max(Math.Min(elemDesc.dcpLim, dcpEnd) - dcpRangeStartForThisElem, 1); 2084lineRect.Width = Math.Max(lineVisual.WidthIncludingTrailingWhitespace, 0); 2195elementRect.Width = Math.Max(lineVisual.WidthIncludingTrailingWhitespace, 0); 3133line.GetGlyphRuns(glyphRuns, Math.Max(dcpStart, lineDesc.dcpFirst), Math.Min(dcpEnd, lineDesc.dcpLim)); 3195line.GetGlyphRuns(glyphRuns, Math.Max(dcpStart, element.dcpFirst), Math.Min(dcpEnd, element.dcpLim));
MS\Internal\PtsHost\TextParagraph.cs (2)
833ddcpOld = Math.Min(ddcpOld, (LastFormatCch - dcpStart) + 1); 834ddcpNew = Math.Min(ddcpNew, (Cch - dcpStart) + 1);
MS\Internal\PtsHost\UIElementParaClient.cs (2)
80_rect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du); 81_rect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv);
MS\Internal\PtsHost\UIElementParagraph.cs (3)
390double elementWidth = TextDpi.FromTextDpi(Math.Max(1, durAvailable - (mbp.MBPLeft + mbp.MBPRight))); 407elementHeight = Math.Max(TextDpi.FromTextDpi(1), elementHeight - TextDpi.FromTextDpi(mbp.MBPTop + mbp.MBPBottom)); 428elementHeight = Math.Max(TextDpi.FromTextDpi(1), elementHeight);
MS\Internal\Text\ComplexLine.cs (1)
563offset = Math.Min(_dcp + this.Length, offset);
MS\Internal\Text\DynamicPropertyReader.cs (2)
217return Math.Max(TextDpi.MinWidth, Math.Min(TextDpi.MaxWidth, lineHeight));
MS\Internal\Text\LineProperties.cs (2)
187lineAdvance = Math.Max(lineAdvance, _lineHeight); 219lineAdvance = Math.Max(lineAdvance, _lineHeight);
MS\Internal\Text\SimpleLine.cs (1)
89Math.Min(dcp, _content.Length)
MS\Internal\Text\TextDpi.cs (3)
54return (int)Math.Round(d * _scale); 167pageMargin.Right = Math.Max(0.0, pageSize.Width - pageMargin.Left - _minSize); 176pageMargin.Bottom = Math.Max(0.0, pageSize.Height - pageMargin.Top - _minSize);;
MS\Internal\WindowsRuntime\Generated\WinRT\Projections\IReadOnlyList.cs (1)
190uint itemCount = Math.Min((uint)items.Length, (uint)_list.Count - startIndex);
System\Windows\Application.cs (1)
2371if (Math.Abs(diff) == 1)
System\Windows\Automation\Peers\CalendarAutomationPeer.cs (1)
362return Math.Max(0, this.OwningGrid.RowDefinitions.Count - 1);
System\Windows\Automation\Peers\ScrollViewerAutomationPeer.cs (3)
217return Math.Min(100.0, (double)(owner.ViewportWidth * 100.0 / owner.ExtentWidth)); 231return Math.Min(100.0, (double)(owner.ViewportHeight * 100.0 / owner.ExtentHeight)); 267return Math.Min(100.0, (double)(viewport * 100.0 / extent));
System\Windows\Controls\Border.cs (12)
234Size childConstraint = new Size(Math.Max(0.0, constraint.Width - combined.Width), 235Math.Max(0.0, constraint.Height - combined.Height)); 639Math.Max(0.0, rt.Width - thick.Left - thick.Right), 640Math.Max(0.0, rt.Height - thick.Top - thick.Bottom)); 983LeftTop = Math.Max(0.0, radii.TopLeft - left); 984TopLeft = Math.Max(0.0, radii.TopLeft - top); 985TopRight = Math.Max(0.0, radii.TopRight - top); 986RightTop = Math.Max(0.0, radii.TopRight - right); 987RightBottom = Math.Max(0.0, radii.BottomRight - right); 988BottomRight = Math.Max(0.0, radii.BottomRight - bottom); 989BottomLeft = Math.Max(0.0, radii.BottomLeft - bottom); 990LeftBottom = Math.Max(0.0, radii.BottomLeft - left);
System\Windows\Controls\ColumnDefinition.cs (1)
646PrivateSetCapacity(Math.Max(_items.Length * 2, c_defaultCapacity));
System\Windows\Controls\DataGrid.cs (18)
2650indexToSelect = Math.Min(Items.Count - numSelected - 1, indexToSelect); 5073int newRowCount = Math.Abs(endIndex - startIndex) + 1; 5074int newColumnCount = Math.Abs(endColumnIndex - startColumnIndex) + 1; 5092int previousStartIndex = Math.Min(startIndex, currentCellIndex); 5093int previousRowCount = Math.Abs(currentCellIndex - startIndex) + 1; 5094int previousStartColumnIndex = Math.Min(startColumnIndex, currentCellColumnIndex); 5095int previousColumnCount = Math.Abs(currentCellColumnIndex - startColumnIndex) + 1; 5135_selectedCells.AddRegion(Math.Min(startIndex, endIndex), Math.Min(startColumnIndex, endColumnIndex), newRowCount, newColumnCount); 5733nextDisplayIndex = Math.Max(0, InternalColumns.LastVisibleDisplayIndex); 5814nextRowIndex = Math.Max(0, Items.Count - 1); 5999index = Math.Max(0, Math.Min(numItems - 1, index + (shiftModifier ? -1 : 1))); 6142int jumpDistance = Math.Max(1, (int)scrollHost.ViewportHeight - 1); 6144targetIndex = Math.Max(0, Math.Min(targetIndex, Items.Count - 1)); 6587distance = Math.Abs(pt.Y - cellBounds.Top); 6595distance = Math.Abs(pt.X - cellBounds.Left);
System\Windows\Controls\DataGridCellsPanel.cs (6)
190measureHeight = Math.Max(measureHeight, blockMeasureSize.Height); 402measureSize.Height = Math.Max(measureSize.Height, childSize.Height); 422measureSize.Height = Math.Max(measureSize.Height, headerSize.Height); 617measureHeight = Math.Max(measureHeight, childSize.Height); 1908childMeasureWidth = Math.Max(averageColumnWidth, column.MinWidth); 1909childMeasureWidth = Math.Min(childMeasureWidth, column.MaxWidth);
System\Windows\Controls\DataGridColumnCollection.cs (24)
754int columnCount = Math.Min(newFrozenCount, Count); 762int columnCount = Math.Min(oldFrozenCount, Count); 952availableStarSpace = Math.Max(0.0, availableStarSpace - columnMinWidth); 1236double displayValue = Math.Max(width.DesiredValue, minWidth); 1276double displayValue = Math.Min(width.DesiredValue, maxWidth); 1344TakeAwayWidthFromColumns(null, Math.Abs(availableSpaceChange), false, newTotalAvailableSpace); 1368column.SetWidthInternal(new DataGridLength(width.Value, width.UnitType, width.DesiredValue, Math.Min(width.DesiredValue, maxWidth))); 1390Math.Max(width.DisplayValue - nonRetrievableSpace, changedColumn.MinWidth))); 1462return Math.Max(availableSpace - requiredSpace, 0.0); 1673column.UpdateWidthForStarColumn(Math.Max(columnDesiredWidth, column.MinWidth), columnDesiredWidth, columnDesiredWidth / perStarWidth); 1702double columnExcessWidth = onlyShrinkToDesiredWidth ? width.DisplayValue - Math.Max(width.DesiredValue, column.MinWidth) : width.DisplayValue - column.MinWidth; 1787double maxColumnResizeWidth = expandBeyondDesiredWidth ? column.MaxWidth : Math.Min(width.DesiredValue, column.MaxWidth); 1922column.UpdateWidthForStarColumn(Math.Min(columnDesiredWidth, column.MaxWidth), columnDesiredWidth, columnDesiredWidth / perStarWidth); 2009double usedStarSpace = ComputeStarColumnWidths(Math.Min(expectedStarSpace, sumOfStarMaxWidths)); 2010giveAwayWidth = Math.Max(usedStarSpace - expectedStarSpace, 0.0); 2080double lagWidth = Math.Min(width.DesiredValue, columnMaxWidth) - width.DisplayValue; 2111if (DoubleUtil.LessThan(width.DisplayValue, Math.Min(width.DesiredValue, column.MaxWidth))) 2139giveAwayWidth -= Math.Min(contributingSpace, giveAwayWidth); 2146giveAwayWidth = Math.Min(giveAwayWidth, Math.Max(0d, totalSpace - usedSpace)); 2193return Math.Min(usedSpace - totalAvailableWidth, takeAwayWidth); 2201takeAwayWidth = Math.Max(0.0, takeAwayWidth - unusedSpace); 2272double usedStarSpace = ComputeStarColumnWidths(Math.Max(expectedStarSpace, sumOfStarMinWidths)); 2273takeAwayWidth = Math.Max(usedStarSpace - expectedStarSpace, 0.0);
System\Windows\Controls\DataGridHelper.cs (4)
39return new Size(size.Width, Math.Max(0.0, size.Height - thickness)); 43return new Size(Math.Max(0.0, size.Width - thickness), size.Height); 722value = Math.Max(value, minValue); 723value = Math.Min(value, maxValue);
System\Windows\Controls\DataGridRow.cs (1)
553double minHeight = Math.Max(RowHeader.DesiredSize.Height, MinHeight);
System\Windows\Controls\DefinitionBase.cs (2)
133_minSize = Math.Max(_minSize, minSize); 883sharedMinSize = Math.Max(sharedMinSize, _registry[i]._minSize);
System\Windows\Controls\DockPanel.cs (10)
226childConstraint = new Size(Math.Max(0.0, constraint.Width - accumulatedWidth), 227Math.Max(0.0, constraint.Height - accumulatedHeight)); 247parentHeight = Math.Max(parentHeight, accumulatedHeight + childDesiredSize.Height); 253parentWidth = Math.Max(parentWidth, accumulatedWidth + childDesiredSize.Width); 260parentWidth = Math.Max(parentWidth, accumulatedWidth); 261parentHeight = Math.Max(parentHeight, accumulatedHeight); 291Math.Max(0.0, arrangeSize.Width - (accumulatedLeft + accumulatedRight)), 292Math.Max(0.0, arrangeSize.Height - (accumulatedTop + accumulatedBottom)) ); 305rcChild.X = Math.Max(0.0, arrangeSize.Width - accumulatedRight); 316rcChild.Y = Math.Max(0.0, arrangeSize.Height - accumulatedBottom);
System\Windows\Controls\DocumentViewer.cs (2)
1408VerticalOffset = Math.Max(verticalOffset, 0.0); 1409HorizontalOffset = Math.Max(horizontalOffset, 0.0);
System\Windows\Controls\FlowDocumentReader.cs (2)
722SetCurrentValueInternal(ZoomProperty, Math.Min(Zoom + ZoomIncrement, MaxZoom)); 734SetCurrentValueInternal(ZoomProperty, Math.Max(Zoom - ZoomIncrement, MinZoom));
System\Windows\Controls\FlowDocumentScrollViewer.cs (8)
592Math.Max(ia.OriginWidth, pagePadding.Left), 593Math.Max(ia.OriginHeight, pagePadding.Top), 594Math.Max(ia.MediaSizeWidth - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right), 595Math.Max(ia.MediaSizeHeight - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom)); 634Zoom = Math.Min(Zoom + ZoomIncrement, MaxZoom); 646Zoom = Math.Max(Zoom - ZoomIncrement, MinZoom); 712SetCurrentValueInternal(ZoomProperty, Math.Min(Zoom + ZoomIncrement, MaxZoom)); 716SetCurrentValueInternal(ZoomProperty, Math.Max(Zoom - ZoomIncrement, MinZoom));
System\Windows\Controls\Grid.cs (69)
380gridDesiredSize.Width = Math.Max(gridDesiredSize.Width, child.DesiredSize.Width); 381gridDesiredSize.Height = Math.Max(gridDesiredSize.Height, child.DesiredSize.Height); 917cell.ColumnIndex = Math.Min(GetColumn(child), DefinitionsU.Length - 1); 920cell.RowIndex = Math.Min(GetRow(child), DefinitionsV.Length - 1); 925cell.ColumnSpan = Math.Min(GetColumnSpan(child), DefinitionsU.Length - cell.ColumnIndex); 929cell.RowSpan = Math.Min(GetRowSpan(child), DefinitionsV.Length - cell.RowIndex); 1106userMinSize = Math.Max(userMinSize, Math.Min(userSize, userMaxSize)); 1130definitions[i].MeasureSize = Math.Max(userMinSize, Math.Min(userSize, userMaxSize)); 1230DefinitionsU[PrivateCells[i].ColumnIndex].UpdateMinSize(Math.Min(children[i].DesiredSize.Width, DefinitionsU[PrivateCells[i].ColumnIndex].UserMaxSize)); 1247DefinitionsV[PrivateCells[i].RowIndex].UpdateMinSize(Math.Min(children[i].DesiredSize.Height, DefinitionsV[PrivateCells[i].RowIndex].UserMaxSize)); 1468double maxSize = Math.Max(definitions[i].UserMaxSize, minSize); 1520double newMinSize = Math.Min(sizeToDistribute / (count - i), tempDefinitions[i].PreferredSize); 1550tempDefinitions[i].UpdateMinSize(Math.Min(newMinSize, tempDefinitions[i].SizeCache)); 1561tempDefinitions[i].UpdateMinSize(Math.Min(newMinSize, tempDefinitions[i].SizeCache)); 1672starValue = Math.Min(starValue, c_starClip); 1676double maxSize = Math.Max(definitions[i].MinSize, definitions[i].UserMaxSize); 1677maxSize = Math.Min(maxSize, c_starClip); 1715double userSize = Math.Max(availableSize - takenSize, 0.0) * (starValue / tempDefinitions[i].SizeCache); 1716resolvedSize = Math.Min(userSize, tempDefinitions[i].UserMaxSize); 1717resolvedSize = Math.Max(tempDefinitions[i].MinSize, resolvedSize); 1778double power = Math.Floor(Math.Log(Double.MaxValue / maxStar / starCount, 2.0)); 1781scale = Math.Pow(2.0, power - 4.0); // -4 is just for paranoia 1829double effectiveMaxSize = Math.Max(def.MinSize, def.UserMaxSize); 1901resolvedSize = Math.Max(resolvedDef.MinSize, resolvedDef.UserMaxSize); 2019double resolvedSize = (def.MeasureSize > 0.0) ? Math.Max(availableSize - takenSize, 0.0) * (def.MeasureSize / def.SizeCache) : 0.0; 2022resolvedSize = Math.Min(resolvedSize, def.UserMaxSize); 2023resolvedSize = Math.Max(def.MinSize, resolvedSize); 2112starValue = Math.Min(starValue, c_starClip); 2116double maxSize = Math.Max(definitions[i].MinSizeForArrange, definitions[i].UserMaxSize); 2117maxSize = Math.Min(maxSize, c_starClip); 2157definitions[i].SizeCache = Math.Max(definitions[i].MinSizeForArrange, Math.Min(userSize, userMaxSize)); 2202double userSize = Math.Max(finalSize - allPreferredArrangeSize, 0.0) * (starValue / definitions[definitionIndices[i]].SizeCache); 2203resolvedSize = Math.Min(userSize, definitions[definitionIndices[i]].UserMaxSize); 2204resolvedSize = Math.Max(definitions[definitionIndices[i]].MinSizeForArrange, resolvedSize); 2229final = Math.Max(final, definitions[definitionIndex].MinSizeForArrange); 2230final = Math.Min(final, definitions[definitionIndex].SizeCache); 2236final = Math.Max(final, definitions[definitionIndex].MinSizeForArrange); 2237final = Math.Min(final, definitions[definitionIndex].SizeCache); 2270final = Math.Max(final, definition.MinSizeForArrange); 2286final = Math.Max(final, definition.MinSizeForArrange); 2357double power = Math.Floor(Math.Log(Double.MaxValue / maxStar / starCount, 2.0)); 2360scale = Math.Pow(2.0, power - 4.0); // -4 is just for paranoia 2404double effectiveMaxSize = Math.Max(def.MinSizeForArrange, def.UserMaxSize); 2443def.SizeCache = Math.Max(def.MinSizeForArrange, Math.Min(userSize, userMaxSize)); 2512resolvedSize = Math.Max(resolvedDef.MinSizeForArrange, resolvedDef.UserMaxSize); 2644double resolvedSize = (def.MeasureSize > 0.0) ? Math.Max(finalSize - takenSize, 0.0) * (def.MeasureSize / def.SizeCache) : 0.0; 2647resolvedSize = Math.Min(resolvedSize, def.UserMaxSize); 2648resolvedSize = Math.Max(def.MinSizeForArrange, resolvedSize); 2739final = Math.Max(final, definition.MinSizeForArrange); 2755final = Math.Max(final, definition.MinSizeForArrange); 2797double minPower = Math.Floor(Math.Log(minRatio, 2.0)); 2798double maxPower = Math.Floor(Math.Log(maxRatio, 2.0)); 2799double f = Math.Pow(2.0, Math.Floor((minPower + maxPower) / 2.0)); 2878Array.Clear(extData.TempDefinitions, 0, Math.Max(DefinitionsU.Length, DefinitionsV.Length)); 3083int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length) * 2; 3116int requiredLength = Math.Max(Math.Max(DefinitionsU.Length, DefinitionsV.Length), 1) * 2; 3134int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length); 3226return (Math.Abs(d) < c_epsilon); 3237return (Math.Abs(d1 - d2) < c_epsilon);
System\Windows\Controls\GridSplitter.cs (13)
504_resizeData.SplitterLength = Math.Min(ActualWidth, ActualHeight); 656horizontalChange = Math.Round(horizontalChange / dragIncrement) * dragIncrement; 657verticalChange = Math.Round(verticalChange / dragIncrement) * dragIncrement; 664_resizeData.Adorner.OffsetX = Math.Min(Math.Max(horizontalChange, _resizeData.MinChange), _resizeData.MaxChange); 668_resizeData.Adorner.OffsetY = Math.Min(Math.Max(verticalChange, _resizeData.MinChange), _resizeData.MaxChange); 802definition1Min = Math.Max(definition1Min, _resizeData.SplitterLength); 806definition2Min = Math.Max(definition2Min, _resizeData.SplitterLength); 812minDelta = -Math.Min(definition1Len - definition1Min, definition2Max - definition2Len); 813maxDelta = Math.Min(definition1Max - definition1Len, definition2Len - definition2Min); 921delta = Math.Min(Math.Max(delta, min), max);
System\Windows\Controls\GridViewHeaderRowPresenter.cs (8)
262double childConstraintWidth = Math.Max(0.0, constraint.Width - accumulatedWidth); 284childConstraintWidth = Math.Min(childConstraintWidth, column.DesiredWidth); 292childConstraintWidth = Math.Min(childConstraintWidth, column.Width); 299maxHeight = Math.Max(maxHeight, child.DesiredSize.Height); 306maxHeight = Math.Max(maxHeight, _paddingHeader.DesiredSize.Height); 355double childArrangeWidth = Math.Min(remainingWidth, ((column.State == ColumnMeasureState.SpecificWidth) ? column.Width : column.DesiredWidth)); 389rect = new Rect(accumulatedWidth, 0.0, Math.Max(remainingWidth, 0.0), arrangeSize.Height); 1247return (DoubleUtil.GreaterThan(Math.Abs(currentPos.X - originalPos.X), c_thresholdX));
System\Windows\Controls\GridViewRowPresenter.cs (5)
148double childConstraintWidth = Math.Max(0.0, constraint.Width - accumulatedWidth); 177childConstraintWidth = Math.Min(childConstraintWidth, column.DesiredWidth); 185childConstraintWidth = Math.Min(childConstraintWidth, column.Width); 192maxHeight = Math.Max(maxHeight, child.DesiredSize.Height); 225double childArrangeWidth = Math.Min(remainingWidth, ((column.State == ColumnMeasureState.SpecificWidth) ? column.Width : column.DesiredWidth));
System\Windows\Controls\InkPresenter.cs (4)
177newSize.Width = Math.Max(newSize.Width, sizeStrokes.Width); 178newSize.Height = Math.Max(newSize.Height, sizeStrokes.Height); 211availableSize = new Size(Math.Min(arrangeSize.Width, _constraintSize.Width), 212Math.Min(arrangeSize.Height, _constraintSize.Height));
System\Windows\Controls\ItemContainerGenerator.cs (1)
2764int index = Math.Min(oldIndex, newIndex);
System\Windows\Controls\ItemsControl.cs (2)
2811return FindFocusable((int)(ScrollHost.VerticalOffset + Math.Max(ScrollHost.ViewportHeight - 1, 0)), 2825return FindFocusable((int)(ScrollHost.HorizontalOffset + Math.Max(ScrollHost.ViewportWidth - 1, 0)),
System\Windows\Controls\MenuScrollingVisibilityConverter.cs (2)
90double percent = Math.Min(100.0, Math.Max(0.0, (verticalOffset * 100.0 / (extentHeight - viewportHeight))));
System\Windows\Controls\PasswordTextNavigator.cs (2)
200finalCount = Math.Min(count, _container.SymbolCount - _offset); 204finalCount = Math.Min(count, _offset);
System\Windows\Controls\PopupControlService.cs (2)
1615Debug.Assert(((int)pt.X == (int)Math.Round(pt2.X)) && ((int)pt.Y == (int)Math.Round(pt2.Y)), "got incorrect mouse point");
System\Windows\Controls\Primitives\BulletDecorator.cs (5)
258contentConstraint.Width = Math.Max(0.0, contentConstraint.Width - bulletSize.Width); 264Size desiredSize = new Size(bulletSize.Width + contentSize.Width, Math.Max(bulletSize.Height, contentSize.Height)); 300contentSize.Width = Math.Max(content.DesiredSize.Width, arrangeSize.Width - bullet.DesiredSize.Width); 301contentSize.Height = Math.Max(content.DesiredSize.Height, arrangeSize.Height); 306bulletOffsetY += Math.Max(0d, centerY - bulletSize.Height * 0.5d);
System\Windows\Controls\Primitives\DataGridCellsPresenter.cs (1)
134dirtyCount = Math.Min(newColumnCount, oldColumnCount);
System\Windows\Controls\Primitives\DataGridColumnHeadersPresenter.cs (10)
122desiredSize.Width = Math.Max(desiredSize.Width, indicatorSize.Width); 123desiredSize.Height = Math.Max(desiredSize.Height, indicatorSize.Height); 130desiredSize.Width = Math.Max(desiredSize.Width, indicatorSize.Width); 131desiredSize.Height = Math.Max(desiredSize.Height, indicatorSize.Height); 134desiredSize.Width = Math.Min(availableSize.Width, desiredSize.Width); 154childRect.Width = Math.Max(finalSize.Width, dataGrid.CellsPanelActualWidth); 649return DoubleUtil.GreaterThan(Math.Abs(currentPos.X - originalPos.X), SystemParameters.MinimumHorizontalDragDistance); 698height = Math.Max(_draggingSrcColumnHeader.RenderSize.Height, _columnHeaderDragIndicator.Height); 922columnEstimatedWidth = Math.Max(averageColumnWidth, column.MinWidth); 923columnEstimatedWidth = Math.Min(columnEstimatedWidth, column.MaxWidth);
System\Windows\Controls\Primitives\DocumentPageView.cs (2)
962pageVisualRect.Width = Math.Min(pageVisualRect.Width, maxWidth); 963pageVisualRect.Height = Math.Min(pageVisualRect.Height, maxHeight);
System\Windows\Controls\Primitives\Popup.cs (26)
2109if (Math.Abs(score - childArea) < Tolerance) 2135if (Math.Abs(intersection.Width - childBounds.Width) > Tolerance || 2136Math.Abs(intersection.Height - childBounds.Height) > Tolerance) 2150if (!IsTransparent || double.IsNaN(horizontalAxis.Y) || Math.Abs(horizontalAxis.Y) < Tolerance) 2162else if (IsTransparent && Math.Abs(horizontalAxis.X) < Tolerance) 2185if (!IsTransparent || double.IsNaN(verticalAxis.X) || Math.Abs(verticalAxis.X) < Tolerance) 2196else if (IsTransparent && Math.Abs(verticalAxis.Y) < Tolerance) 2251if (!IsTransparent || double.IsNaN(verticalAxis.X) || Math.Abs(verticalAxis.X) < Tolerance) 2253limitSize.Height = Math.Max(0.0, Math.Max(screenBounds.Bottom - targetBounds.Bottom, targetBounds.Top - screenBounds.Top)); 2255else if (IsTransparent && Math.Abs(verticalAxis.Y) < Tolerance) 2257limitSize.Width = Math.Max(0.0, Math.Max(screenBounds.Right - targetBounds.Right, targetBounds.Left - screenBounds.Left)); 2273if (!IsTransparent || double.IsNaN(horizontalAxis.X) || Math.Abs(horizontalAxis.Y) < Tolerance) 2275limitSize.Width = Math.Max(0.0, Math.Max(screenBounds.Right - targetBounds.Right, targetBounds.Left - screenBounds.Left)); 2277else if (IsTransparent && Math.Abs(horizontalAxis.X) < Tolerance) 2279limitSize.Height = Math.Max(0.0, Math.Max(screenBounds.Bottom - targetBounds.Bottom, targetBounds.Top - screenBounds.Top)); 2629desiredSize.Width = Math.Min(desiredSize.Width, screenBounds.Width); 2630desiredSize.Width = Math.Min(desiredSize.Width, limitSize.Width); 2634desiredSize.Height = Math.Min(desiredSize.Height, screenBounds.Height); 2635desiredSize.Height = Math.Min(desiredSize.Height, maxHeight); 2636desiredSize.Height = Math.Min(desiredSize.Height, limitSize.Height); 2708return new Rect(mousePoint.x, mousePoint.y - 1, Math.Max(0, cursorWidth - hotX), Math.Max(0, cursorHeight - hotY + 2));
System\Windows\Controls\Primitives\PopupRoot.cs (4)
227restrictWidth = Math.Abs(restrictedSize.Width - desiredSize.Width) > Popup.Tolerance; 228restrictHeight = Math.Abs(restrictedSize.Height - desiredSize.Height) > Popup.Tolerance; 239return new Size(Math.Min(restrictedSize.Width, restricted2DDesiredSize.Width), 240Math.Min(restrictedSize.Height, restricted2DDesiredSize.Height));
System\Windows\Controls\Primitives\ScrollBar.cs (8)
349perpendicularDragDelta = Math.Abs(verticalDragDelta); 353perpendicularDragDelta = Math.Abs(horizontalDragDelta); 425newValue = Math.Min(Math.Max(newValue, Minimum), Maximum); 555double newValue = Math.Max(Value - SmallChange, Minimum); 564double newValue = Math.Min(Value + SmallChange, Maximum); 573double newValue = Math.Max(Value - LargeChange, Minimum); 582double newValue = Math.Min(Value + LargeChange, Maximum);
System\Windows\Controls\Primitives\ScrollContentPresenter.cs (5)
445desiredSize.Width = Math.Min(constraint.Width, desiredSize.Width); 446desiredSize.Height = Math.Min(constraint.Height, desiredSize.Height); 494childRect.Width = Math.Max(childRect.Width, arrangeSize.Width); 495childRect.Height = Math.Max(childRect.Height, arrangeSize.Height); 697return Math.Max(0.0, offset);
System\Windows\Controls\Primitives\TabPanel.cs (5)
212desiredSizeWithoutMargin.Height = Math.Max(0d, element.DesiredSize.Height - margin.Top - margin.Bottom); 213desiredSizeWithoutMargin.Width = Math.Max(0d, element.DesiredSize.Width - margin.Left - margin.Right); 284childSize.Height = Math.Max(0d, childSize.Height - topOffset - bottomOffset); 285childSize.Width = Math.Max(0d, childSize.Width - leftOffset - rightOffset); 416currentAverageGap = Math.Max(0d, (rowWidthLimit - currentRowWidth) / numberOfHeadersInCurrentRow); // The amout of width that should be added to justify the header
System\Windows\Controls\Primitives\TickBar.cs (4)
535Point pt2 = new Point(startPoint.X + tickLen2, y0 + Math.Abs(tickLen2) * progression); 548pt2 = new Point(startPoint.X + tickLen2, y0 - Math.Abs(tickLen2) * progression); 640Point pt2 = new Point(x0 + Math.Abs(tickLen2) * progression, startPoint.Y + tickLen2); 653pt2 = new Point(x0 - Math.Abs(tickLen2) * progression, startPoint.Y + tickLen2);
System\Windows\Controls\Primitives\ToolBarOverflowPanel.cs (7)
122_wrapWidth = Math.Min(_wrapWidth, constraint.Width); 131_panelSize.Width = Math.Max(curLineSize.Width, _panelSize.Width); 137_panelSize.Width = Math.Max(sz.Width, _panelSize.Width); 145curLineSize.Height = Math.Max(sz.Height, curLineSize.Height); 150_panelSize.Width = Math.Max(curLineSize.Width, _panelSize.Width); 166_wrapWidth = Math.Min(_wrapWidth, arrangeBounds.Width); 186curLineSize.Height = Math.Max(sz.Height, curLineSize.Height);
System\Windows\Controls\Primitives\ToolBarPanel.cs (6)
125panelDesiredSize.Height = Math.Max(panelDesiredSize.Height, childDesiredSize.Height); 129panelDesiredSize.Width = Math.Max(panelDesiredSize.Width, childDesiredSize.Width); 184panelDesiredSize.Height = Math.Max(panelDesiredSize.Height, childDesiredSize.Height); 189panelDesiredSize.Width = Math.Max(panelDesiredSize.Width, childDesiredSize.Width); 313rcChild.Height = Math.Max(arrangeSize.Height, child.DesiredSize.Height); 320rcChild.Width = Math.Max(arrangeSize.Width, child.DesiredSize.Width);
System\Windows\Controls\Primitives\Track.cs (11)
82return Math.Max(Minimum, Math.Min(Maximum, val)); 482double viewportSize = Math.Max(0.0, ViewportSize); 581double range = Math.Max(0.0, Maximum - min); 582double offset = Math.Min(range, Value - min); 620double range = Math.Max(0.0, Maximum - min); 621double offset = Math.Min(range, Value - min); 625double extent = Math.Max(0.0, range) + viewportSize; 637thumbMinLength = Math.Floor(buttonHeight * 0.5); 645thumbMinLength = Math.Floor(buttonWidth * 0.5); 651thumbLength = Math.Max(thumbMinLength, thumbLength);
System\Windows\Controls\Primitives\UniformGrid.cs (1)
297_rows = (int)Math.Sqrt(nonCollapsedCount);
System\Windows\Controls\PrintDialog.cs (6)
308dlg.MinPage = Math.Max(1, Math.Min(_minPage, _maxPage)); 309dlg.MaxPage = Math.Max(dlg.MinPage, Math.Max(_minPage, _maxPage)); 315Math.Max((int)dlg.MinPage, _pageRange.PageFrom), 316Math.Min((int)dlg.MaxPage, _pageRange.PageTo));
System\Windows\Controls\RowDefinition.cs (1)
646PrivateSetCapacity(Math.Max(_items.Length * 2, c_defaultCapacity));
System\Windows\Controls\ScrollViewer.cs (17)
409get { return Math.Max(0.0, ExtentWidth - ViewportWidth); } 417get { return Math.Max(0.0, ExtentHeight - ViewportHeight); } 1757DoubleUtil.LessThan(Math.Abs(unusedX), PanningInfo.PreFeedbackTranslationX)) 1765DoubleUtil.LessThan(Math.Abs(unusedY), PanningInfo.PreFeedbackTranslationY)) 1810double newUnused = Math.Max(unused + delta, 0); 1819double newUnused = Math.Min(unused + delta, 0); 1830Math.Round(PanningRatio * cumulativeTranslation / _panningInfo.DeltaPerHorizontalOffet)); 1840Math.Round(PanningRatio * cumulativeTranslation / _panningInfo.DeltaPerVerticalOffset)); 1853if (Math.Abs(Environment.TickCount - _panningInfo.InertiaBoundaryBeginTimestamp) < PanningInfo.InertiaBoundryMinimumTicks) 1858return (DoubleUtil.GreaterThanOrClose(Math.Abs(_panningInfo.UnusedTranslation.X), PanningInfo.MaxInertiaBoundaryTranslation) || 1859DoubleUtil.GreaterThanOrClose(Math.Abs(_panningInfo.UnusedTranslation.Y), PanningInfo.MaxInertiaBoundaryTranslation)); 1878bool validX = (DoubleUtil.GreaterThan(Math.Abs(translation.X), PanningInfo.PrePanTranslation)); 1879bool validY = (DoubleUtil.GreaterThan(Math.Abs(translation.Y), PanningInfo.PrePanTranslation)); 1889bool biggerX = (DoubleUtil.GreaterThanOrClose(Math.Abs(translation.X), Math.Abs(translation.Y))); 1902bool biggerY = (DoubleUtil.GreaterThanOrClose(Math.Abs(translation.Y), Math.Abs(translation.X)));
System\Windows\Controls\SinglePageViewer.cs (6)
704Math.Max(ia.OriginWidth, pagePadding.Left), 705Math.Max(ia.OriginHeight, pagePadding.Top), 706Math.Max(ia.MediaSizeWidth - (ia.OriginWidth + ia.ExtentWidth), pagePadding.Right), 707Math.Max(ia.MediaSizeHeight - (ia.OriginHeight + ia.ExtentHeight), pagePadding.Bottom)); 745SetCurrentValueInternal(ZoomProperty, Math.Min(Zoom + ZoomIncrement, MaxZoom)); 757SetCurrentValueInternal(ZoomProperty, Math.Max(Zoom - ZoomIncrement, MinZoom));
System\Windows\Controls\Slider.cs (15)
1018valueToSize = Math.Max(0.0, (trackSize.Width - thumbSize.Width) / range); 1024Canvas.SetLeft(rangeElement, (thumbSize.Width * 0.5) + Math.Max(Maximum - SelectionEnd, 0) * valueToSize); 1028Canvas.SetLeft(rangeElement, (thumbSize.Width * 0.5) + Math.Max(SelectionStart - Minimum, 0) * valueToSize); 1040valueToSize = Math.Max(0.0, (trackSize.Height - thumbSize.Height) / range); 1046Canvas.SetTop(rangeElement, (thumbSize.Height * 0.5) + Math.Max(SelectionStart - Minimum, 0) * valueToSize); 1050Canvas.SetTop(rangeElement, (thumbSize.Height * 0.5) + Math.Max(Maximum - SelectionEnd,0) * valueToSize); 1083valueToSize = Math.Max(0.0, (trackSize.Width - thumbSize.Width) / range); 1107valueToSize = Math.Max(0.0, (trackSize.Height - thumbSize.Height) / range); 1215previous = Minimum + (Math.Round(((value - Minimum) / TickFrequency)) * TickFrequency); 1216next = Math.Min(Maximum, previous + TickFrequency); 1236double next = SnapToTick(Math.Max(this.Minimum, Math.Min(this.Maximum, value + direction))); 1274double tickNumber = Math.Round((value - Minimum) / TickFrequency); 1435this.SetCurrentValueInternal(ValueProperty, Math.Max(this.Minimum, Math.Min(this.Maximum, snappedValue)));
System\Windows\Controls\Stack.cs (15)
604stackDesiredSize.Height = Math.Max(stackDesiredSize.Height, childDesiredSize.Height); 609stackDesiredSize.Width = Math.Max(stackDesiredSize.Width, childDesiredSize.Width); 669offset.Y = Math.Max(0, Math.Min(offset.Y, extent.Height - viewport.Height)); 677offset.X = Math.Max(0, Math.Min(offset.X, extent.Width - viewport.Width)); 682stackDesiredSize.Width = Math.Min(stackDesiredSize.Width, constraint.Width); 683stackDesiredSize.Height = Math.Min(stackDesiredSize.Height, constraint.Height); 761rcChild.Height = Math.Max(arrangeSize.Height, child.DesiredSize.Height); 768rcChild.Width = Math.Max(arrangeSize.Width, child.DesiredSize.Width); 902double left = Math.Max(targetRectOffset, minPhysicalOffset); 903targetRectSize = Math.Max(Math.Min(targetRectSize + targetRectOffset, minPhysicalOffset + viewportSize) - left, 0); 1001iNewOffset = Math.Max(Math.Min(numberOfItems - 1, iNewOffset), 0);
System\Windows\Controls\StickyNote.cs (4)
1150horizontalChange = Math.Min(Math.Max(minBoundary.X, horizontalChange), maxBoundary.X); 1151verticalChange = Math.Min(Math.Max(minBoundary.Y, verticalChange), maxBoundary.Y);
System\Windows\Controls\TextBlock.cs (12)
1275Size contentSize = new Size(Math.Max(0.0, constraint.Width - (padding.Left + padding.Right)), 1276Math.Max(0.0, constraint.Height - (padding.Top + padding.Bottom))); 1315desiredSize.Width = Math.Max(desiredSize.Width, line.GetCollapsedWidth()); 1541double contentBottom = Math.Max(0.0, RenderSize.Height - Padding.Bottom); 1978Size contentSize = new Size(Math.Max(0.0, _referenceSize.Width - (padding.Left + padding.Right)), 1979Math.Max(0.0, _referenceSize.Height - (padding.Top + padding.Bottom))); 2331int dcpStart = Math.Max(dcpLineStart, dcpPositionStart); 2332int dcpEnd = Math.Min(dcpLineEnd, dcpPositionEnd); 3116Size contentSize = new Size(Math.Max(0.0, computedSize.Width - (padding.Left + padding.Right)), 3117Math.Max(0.0, computedSize.Height - (padding.Top + padding.Bottom))); 3166double contentBottom = Math.Max(0.0, RenderSize.Height - Padding.Bottom); 3196width = Math.Max(0.0, width - paddingWidth);
System\Windows\Controls\TextBox.cs (3)
333return (int)Math.Floor((this.VerticalOffset / lineHeight) + epsilon); 357return (int)Math.Floor((this.VerticalOffset + this.ViewportHeight - 1) / GetLineHeight()); 1729if ( 2*(prefix + suffix) >= Math.Min(oldText.Length, newText.Length))
System\Windows\Controls\TextRangeAdaptor.cs (1)
995int absCount = (count == int.MinValue) ? int.MaxValue : Math.Abs(count);
System\Windows\Controls\ToolBar.cs (2)
558extraLength = Math.Max(0.0, desiredSize.Width - toolBarPanel.DesiredSize.Width + margin.Left + margin.Right); 562extraLength = Math.Max(0.0, desiredSize.Height - toolBarPanel.DesiredSize.Height + margin.Top + margin.Bottom);
System\Windows\Controls\ToolBarTray.cs (5)
389bandThickness = Math.Max(bandThickness, fHorizontal ? toolBar.DesiredSize.Height : toolBar.DesiredSize.Width); 404toolBarTrayDesiredSize.Width = Math.Max(toolBarTrayDesiredSize.Width, bandLength); 409toolBarTrayDesiredSize.Height = Math.Max(toolBarTrayDesiredSize.Height, bandLength); 800currentToolBar.Width = Math.Max(currentToolBar.MinLength, currentToolBar.RenderSize.Width - toolBarOffset + position); 802currentToolBar.Height = Math.Max(currentToolBar.MinLength, currentToolBar.RenderSize.Height - toolBarOffset + position);
System\Windows\Controls\VirtualizedCellInfoCollection.cs (12)
613int left = Math.Max(Left, region.Left); 614int top = Math.Max(Top, region.Top); 615int right = Math.Min(Right, region.Right); 616int bottom = Math.Min(Bottom, region.Bottom); 686Left = Math.Min(Left, region.Left); 687Top = Math.Min(Top, region.Top); 688Right = Math.Max(prevRight, region.Right); 689Bottom = Math.Max(prevBottom, region.Bottom); 729int top = Math.Max(Top, region.Top); 730int bottom = Math.Min(Bottom, region.Bottom); 737int top = Math.Max(Top, region.Top); 738int bottom = Math.Min(Bottom, region.Bottom);
System\Windows\Controls\VirtualizingStackPanel.cs (185)
516double delta = Math.Abs(scrollX - oldViewportOffset.X); 529_scrollData._offset.X = Math.Floor(_scrollData._offset.X); 530_scrollData._computedOffset.X = Math.Floor(_scrollData._computedOffset.X); 644double delta = Math.Abs(scrollY - oldViewportOffset.Y); 657_scrollData._offset.Y = Math.Floor(_scrollData._offset.Y); 658_scrollData._computedOffset.Y = Math.Floor(_scrollData._computedOffset.Y); 2336double factor = Math.Min(1.0, isHorizontal ? viewport.Width / extendedViewport.Width : viewport.Height / extendedViewport.Height); 2337int calcItemsInViewportCount = (int)Math.Ceiling(factor * _itemsInExtendedViewportCount); 2338excludeCount = Math.Max(excludeCount, 2632double spanBeforeViewport = Math.Max(isHorizontal ? viewport.X : viewport.Y, 0.0); 2689_firstItemInExtendedViewportIndex = Math.Max(_firstItemInExtendedViewportIndex - 1, 0); 2691_firstItemInExtendedViewportChildIndex = Math.Max(_firstItemInExtendedViewportChildIndex, 0); 3389arrangeLength = Math.Max(isHorizontal ? arrangeSize.Height : arrangeSize.Width, arrangeLength); 4767pixelSizeBeforeViewport = Math.Max(pixelSizeBeforeViewport, Math.Abs(_viewport.X - _extendedViewport.X)); 4771logicalSizeBeforeViewport = Math.Max(logicalSizeBeforeViewport, Math.Abs(_viewport.X - _extendedViewport.X)); 4803extendedViewport.Width = Math.Max(extendedViewport.Width + extendedViewport.X, 0.0); 4814extendedViewport.Width = Math.Max(_scrollData._extent.Width - extendedViewport.X, 0.0); 4843extendedViewport.Width = Math.Max(extendedViewport.Width / approxSizeOfLogicalUnit + extendedViewport.X, 0.0) * approxSizeOfLogicalUnit; 4854extendedViewport.Width = Math.Max(_scrollData._extent.Width - extendedViewport.X, 0.0) * approxSizeOfLogicalUnit; 4883pixelSizeBeforeViewport = Math.Max(pixelSizeBeforeViewport, Math.Abs(_viewport.Y - _extendedViewport.Y)); 4887logicalSizeBeforeViewport = Math.Max(logicalSizeBeforeViewport, Math.Abs(_viewport.Y - _extendedViewport.Y)); 4919extendedViewport.Height = Math.Max(extendedViewport.Height + extendedViewport.Y, 0.0); 4930extendedViewport.Height = Math.Max(_scrollData._extent.Height - extendedViewport.Y, 0.0); 4959extendedViewport.Height = Math.Max(extendedViewport.Height / approxSizeOfLogicalUnit + extendedViewport.Y, 0.0) * approxSizeOfLogicalUnit; 4970extendedViewport.Height = Math.Max(_scrollData._extent.Height - extendedViewport.Y, 0.0) * approxSizeOfLogicalUnit; 4982double factor = Math.Max(1.0, isHorizontal ? extendedViewport.Width / viewport.Width : extendedViewport.Height / viewport.Height); 4983int calcItemsInExtendedViewportCount = (int)Math.Ceiling(factor * _actualItemsInExtendedViewportCount); 4984itemsInExtendedViewportCount = Math.Max(calcItemsInExtendedViewportCount, itemsInExtendedViewportCount); 5095viewport.Width = Math.Max(viewport.Width - sizeAfterStartViewportEdge, 0); 5099cacheBeforeSize = Math.Max(cacheBeforeSize - sizeBeforeStartViewportEdge, 0); 5103cacheBeforeSize = Math.Max(cacheBeforeSize - Math.Floor(logicalSize.Width * sizeBeforeStartViewportEdge / pixelSize.Width), 0); 5130viewport.Width = Math.Max(0, parentViewport.Width - pixelSize.Width); 5145cacheAfterSize = Math.Max(cacheAfterSize - sizeAfterEndViewportEdge, 0); 5149cacheAfterSize = Math.Max(cacheAfterSize - Math.Floor(logicalSize.Width * sizeAfterEndViewportEdge / pixelSize.Width), 0); 5161cacheAfterSize = Math.Max(cacheAfterSize - pixelSize.Width, 0); 5165cacheAfterSize = Math.Max(cacheAfterSize - logicalSize.Width, 0); 5194viewport.Height = Math.Max(viewport.Height - sizeAfterStartViewportEdge, 0); 5198cacheBeforeSize = Math.Max(cacheBeforeSize - sizeBeforeStartViewportEdge, 0); 5202cacheBeforeSize = Math.Max(cacheBeforeSize - Math.Floor(logicalSize.Height * sizeBeforeStartViewportEdge / pixelSize.Height), 0); 5229viewport.Height = Math.Max(0, parentViewport.Height - pixelSize.Height); 5244cacheAfterSize = Math.Max(cacheAfterSize - sizeAfterEndViewportEdge, 0); 5248cacheAfterSize = Math.Max(cacheAfterSize - Math.Floor(logicalSize.Height * sizeAfterEndViewportEdge / pixelSize.Height), 0); 5260cacheAfterSize = Math.Max(cacheAfterSize - pixelSize.Height, 0); 5264cacheAfterSize = Math.Max(cacheAfterSize - logicalSize.Height, 0); 5329cacheBeforeSize = Math.Max(0, cacheBeforeSize - parentViewport.X); 5334viewport.Width = Math.Max(0, viewport.Width + viewport.X); 5354cacheBeforeSize = Math.Max(0, cacheBeforeSize - inset.Right); 5358cacheBeforeSize = Math.Max(0, cacheBeforeSize - 1); 5373viewport.Width = Math.Max(0, viewport.Width - inset.Left); 5384cacheAfterSize = Math.Max(0, cacheAfterSize - (inset.Left - viewport.Width)); 5401cacheAfterSize = Math.Max(0, cacheAfterSize - inset.Left); 5405cacheAfterSize = Math.Max(0, cacheAfterSize - 1); 5432cacheBeforeSize = Math.Max(0, cacheBeforeSize - parentViewport.Y); 5437viewport.Height = Math.Max(0, viewport.Height + viewport.Y); 5457cacheBeforeSize = Math.Max(0, cacheBeforeSize - inset.Bottom); 5461cacheBeforeSize = Math.Max(0, cacheBeforeSize - 1); 5476viewport.Height = Math.Max(0, viewport.Height - inset.Top); 5487cacheAfterSize = Math.Max(0, cacheAfterSize - (inset.Top - viewport.Height)); 5504cacheAfterSize = Math.Max(0, cacheAfterSize - inset.Top); 5508cacheAfterSize = Math.Max(0, cacheAfterSize - 1); 5564double spanBeforeViewport = Math.Max(isHorizontal ? viewport.X : viewport.Y, 0.0); 5576firstItemInViewportIndex = (int)Math.Floor(spanBeforeViewport / childSize); 6552double eps = (Math.Abs(value1) + Math.Abs(value2)) * Tolerance; 6733childViewport.X = Math.Min(childViewport.X, 0) - 6736childViewport.Width = Math.Max(childViewport.Width - stackPixelSizeInViewport.Width, 0.0); 6741childViewport.Width = Math.Max(childViewport.Width - stackPixelSizeInViewport.Width, 0.0); 6749Math.Max(parentCacheSize.CacheBeforeViewport - stackLogicalSizeInCacheBeforeViewport.Width, 0.0), 6752Math.Max(parentCacheSize.CacheAfterViewport - stackLogicalSizeInCacheAfterViewport.Width, 0.0)); 6760Math.Max(parentCacheSize.CacheBeforeViewport - stackPixelSizeInCacheBeforeViewport.Width, 0.0), 6763Math.Max(parentCacheSize.CacheAfterViewport - stackPixelSizeInCacheAfterViewport.Width, 0.0)); 6778childViewport.Y = Math.Min(childViewport.Y, 0) - 6782childViewport.Height = Math.Max(childViewport.Height - stackPixelSizeInViewport.Height, 0.0); 6787childViewport.Height = Math.Max(childViewport.Height - stackPixelSizeInViewport.Height, 0.0); 6795Math.Max(parentCacheSize.CacheBeforeViewport - stackLogicalSizeInCacheBeforeViewport.Height, 0.0), 6798Math.Max(parentCacheSize.CacheAfterViewport - stackLogicalSizeInCacheAfterViewport.Height, 0.0)); 6806Math.Max(parentCacheSize.CacheBeforeViewport - stackPixelSizeInCacheBeforeViewport.Height, 0.0), 6809Math.Max(parentCacheSize.CacheAfterViewport - stackPixelSizeInCacheAfterViewport.Height, 0.0)); 6914childLogicalSize.Width = Math.Max(itemDesiredSizes.LogicalSize.Width, logicalHeaderSize.Width); 6919childLogicalSize.Height = Math.Max(itemDesiredSizes.LogicalSize.Height, logicalHeaderSize.Height); 7118Size frontPixelSize = isHorizontal ? new Size(Math.Max(inset.Left,0), childDesiredSize.Height) 7119: new Size(childDesiredSize.Width, Math.Max(inset.Top, 0)); 7132Size backPixelSize = isHorizontal ? new Size(Math.Max(inset.Right,0), childDesiredSize.Height) 7133: new Size(childDesiredSize.Width, Math.Max(inset.Bottom,0)); 7146adjustedChildViewport.Width = Math.Max(0, adjustedChildViewport.Width - childPixelSizeInViewport.Width); 7152adjustedChildViewport.Height = Math.Max(0, adjustedChildViewport.Height - childPixelSizeInViewport.Height); 7237pixelSizeBeforeViewport = DoubleUtil.LessThan(childViewport.X, childPixelSize.Width) ? Math.Max(childViewport.X, 0.0) : childPixelSize.Width; 7238pixelSizeInViewport = Math.Min(childViewport.Width, childPixelSize.Width - pixelSizeBeforeViewport); 7239pixelSizeAfterViewport = Math.Max(childPixelSize.Width - pixelSizeInViewport - pixelSizeBeforeViewport, 0.0); // Please note that due to rounding errors this subtraction can lead to negative values. Hence the Math.Max call 7284logicalSizeBeforeViewport = Math.Floor(childLogicalSize.Width * pixelSizeBeforeViewport / childPixelSize.Width); 7285logicalSizeAfterViewport = Math.Floor(childLogicalSize.Width * pixelSizeAfterViewport / childPixelSize.Width); 7293double childPixelHeightInViewport = Math.Min(childViewport.Height, childPixelSize.Height - Math.Max(childViewport.Y, 0.0)); 7296childPixelSizeInViewport.Height = Math.Max(childPixelSizeInViewport.Height, childPixelHeightInViewport); 7298childPixelSizeInCacheBeforeViewport.Height = Math.Max(childPixelSizeInCacheBeforeViewport.Height, childPixelHeightInViewport); 7300childPixelSizeInCacheAfterViewport.Height = Math.Max(childPixelSizeInCacheAfterViewport.Height, childPixelHeightInViewport); 7303childLogicalSizeInViewport.Height = Math.Max(childLogicalSizeInViewport.Height, childLogicalSize.Height); 7305childLogicalSizeInCacheBeforeViewport.Height = Math.Max(childLogicalSizeInCacheBeforeViewport.Height, childLogicalSize.Height); 7307childLogicalSizeInCacheAfterViewport.Height = Math.Max(childLogicalSizeInCacheAfterViewport.Height, childLogicalSize.Height); 7329pixelSizeBeforeViewport = DoubleUtil.LessThan(childViewport.Y, childPixelSize.Height) ? Math.Max(childViewport.Y, 0.0) : childPixelSize.Height; 7330pixelSizeInViewport = Math.Min(childViewport.Height, childPixelSize.Height - pixelSizeBeforeViewport); 7331pixelSizeAfterViewport = Math.Max(childPixelSize.Height - pixelSizeInViewport - pixelSizeBeforeViewport, 0.0); // Please note that due to rounding errors this subtraction can lead to negative values. Hence the Math.Max call 7376logicalSizeBeforeViewport = Math.Floor(childLogicalSize.Height * pixelSizeBeforeViewport / childPixelSize.Height); 7377logicalSizeAfterViewport = Math.Floor(childLogicalSize.Height * pixelSizeAfterViewport / childPixelSize.Height); 7385double childPixelWidthInViewport = Math.Min(childViewport.Width, childPixelSize.Width - Math.Max(childViewport.X, 0.0)); 7388childPixelSizeInViewport.Width = Math.Max(childPixelSizeInViewport.Width, childPixelWidthInViewport); 7390childPixelSizeInCacheBeforeViewport.Width = Math.Max(childPixelSizeInCacheBeforeViewport.Width, childPixelWidthInViewport); 7392childPixelSizeInCacheAfterViewport.Width = Math.Max(childPixelSizeInCacheAfterViewport.Width, childPixelWidthInViewport); 7395childLogicalSizeInViewport.Width = Math.Max(childLogicalSizeInViewport.Width, childLogicalSize.Width); 7397childLogicalSizeInCacheBeforeViewport.Width = Math.Max(childLogicalSizeInCacheBeforeViewport.Width, childLogicalSize.Width); 7399childLogicalSizeInCacheAfterViewport.Width = Math.Max(childLogicalSizeInCacheAfterViewport.Width, childLogicalSize.Width); 7442sz1.Height = Math.Max(sz1.Height, sz2.Height); 7447sz1.Width = Math.Max(sz1.Width, sz2.Width); 7497childSize = new Size(Math.Max(headerDesiredSizes.PixelSize.Width, itemDesiredSizes.PixelSize.Width), 7502childSize = new Size(Math.Max(headerDesiredSizes.LogicalSize.Width, itemDesiredSizes.LogicalSize.Width), 7586uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes); 7670Math.Max(1, itemDesiredSizes.LogicalSize.Height)) 7671: new Size(Math.Max(1, itemDesiredSizes.LogicalSize.Width), 7812Math.Max(uniformOrAverageContainerPixelSize, dpiScale), // don't round down to 0 7822uniformOrAverageContainerSize = Math.Round(sumOfContainerSizes / numContainerSizes); 8485rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height); 8510previousChildSize.Width = Math.Max(previousChildSize.Width, pixelHeaderSize.Width); 8517rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width); 8542previousChildSize.Height = Math.Max(previousChildSize.Height, pixelHeaderSize.Height); 8572rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height); 8578rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width); 8616rcChild.Height = Math.Max(arrangeLength, childDesiredSize.Height); 8669rcChild.Width = Math.Max(arrangeLength, childDesiredSize.Width); 9544return Math.Max(0, _firstItemInExtendedViewportIndex); 9552return Math.Min(ItemCount, _firstItemInExtendedViewportIndex + _actualItemsInExtendedViewportCount); 9670_scrollData._maxDesiredSize.Height = Math.Max(_scrollData._maxDesiredSize.Height, stackPixelSize.Height); 9697_scrollData._maxDesiredSize.Width = Math.Max(_scrollData._maxDesiredSize.Width, stackPixelSize.Width); 9723Math.Min(stackPixelSize.Width, constraint.Width) : constraint.Width; 9728Math.Min(stackPixelSize.Height, constraint.Height) : constraint.Height; 9738Debug.Assert(DoubleUtil.AreClose(viewportSize.Width - Math.Floor(viewportSize.Width), 0.0), "The viewport size must not contain fractional values when in item scrolling mode."); 9739Debug.Assert(DoubleUtil.AreClose(extentSize.Width - Math.Floor(extentSize.Width), 0.0), "The extent size must not contain fractional values when in item scrolling mode."); 9743Debug.Assert(DoubleUtil.AreClose(viewportSize.Height - Math.Floor(viewportSize.Height), 0.0), "The viewport size must not contain fractional values when in item scrolling mode."); 9744Debug.Assert(DoubleUtil.AreClose(extentSize.Height - Math.Floor(extentSize.Height), 0.0), "The extent size must not contain fractional values when in item scrolling mode."); 9997double proposedViewportSize = Math.Floor(viewport.Width / approxSizeOfLogicalUnit); 10090if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.X)/extentSize.Width, Math.Floor(_scrollData._offset.X)/_scrollData._extent.Width)) 10093viewportOffset.X = Math.Floor((extentSize.Width * Math.Floor(_scrollData._offset.X)) / _scrollData._extent.Width); 10214double proposedViewportSize = Math.Floor(viewport.Height / approxSizeOfLogicalUnit); 10307if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.Y)/extentSize.Height, Math.Floor(_scrollData._offset.Y)/_scrollData._extent.Height)) 10310viewportOffset.Y = Math.Floor((extentSize.Height * Math.Floor(_scrollData._offset.Y)) / _scrollData._extent.Height); 10522_scrollData._maxDesiredSize.Height = Math.Max(_scrollData._maxDesiredSize.Height, stackPixelSize.Height); 10549_scrollData._maxDesiredSize.Width = Math.Max(_scrollData._maxDesiredSize.Width, stackPixelSize.Width); 10575Math.Min(stackPixelSize.Width, constraint.Width) : constraint.Width; 10580Math.Min(stackPixelSize.Height, constraint.Height) : constraint.Height; 10590Debug.Assert(DoubleUtil.AreClose(viewportSize.Width - Math.Floor(viewportSize.Width), 0.0), "The viewport size must not contain fractional values when in item scrolling mode."); 10591Debug.Assert(DoubleUtil.AreClose(extentSize.Width - Math.Floor(extentSize.Width), 0.0), "The extent size must not contain fractional values when in item scrolling mode."); 10595Debug.Assert(DoubleUtil.AreClose(viewportSize.Height - Math.Floor(viewportSize.Height), 0.0), "The viewport size must not contain fractional values when in item scrolling mode."); 10596Debug.Assert(DoubleUtil.AreClose(extentSize.Height - Math.Floor(extentSize.Height), 0.0), "The extent size must not contain fractional values when in item scrolling mode."); 10676lastPageSafeOffset = lastPageSafeOffset.HasValue ? Math.Min(computedViewportOffset.X, (double)lastPageSafeOffset) : computedViewportOffset.X; 10679double proposedViewportSize = Math.Floor(viewport.Width / approxSizeOfLogicalUnit); 10761if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.X)/extentSize.Width, Math.Floor(_scrollData._offset.X)/_scrollData._extent.Width)) 10764viewportOffset.X = Math.Floor((extentSize.Width * Math.Floor(_scrollData._offset.X)) / _scrollData._extent.Width); 10807lastPageSafeOffset = lastPageSafeOffset.HasValue ? Math.Min(computedViewportOffset.Y, (double)lastPageSafeOffset) : computedViewportOffset.Y; 10810double proposedViewportSize = Math.Floor(viewport.Height / approxSizeOfLogicalUnit); 10892if (!LayoutDoubleUtil.AreClose(Math.Floor(computedViewportOffset.Y)/extentSize.Height, Math.Floor(_scrollData._offset.Y)/_scrollData._extent.Height)) 10895viewportOffset.Y = Math.Floor((extentSize.Height * Math.Floor(_scrollData._offset.Y)) / _scrollData._extent.Height); 11193double visibleStart = Math.Max(start, 0); 11194double visibleEnd = Math.Max(Math.Min(end, viewportSize), visibleStart); 11239else if (childIndex > firstChildInView + Math.Max(viewportSize - 1, 0)) 11285maxChildLength = Math.Max(maxChildLength, childSize.Height); 11289maxChildLength = Math.Max(maxChildLength, childSize.Width); 11881else if (DoubleUtil.GreaterThan(Math.Abs(newOffset - oldOffset), _viewport.Width)) 11897else if (DoubleUtil.GreaterThan(Math.Abs(newOffset - oldOffset), _viewport.Height))
System\Windows\Controls\WrapPanel.cs (5)
253panelSize.U = Math.Max(curLineSize.U, panelSize.U); 259panelSize.U = Math.Max(sz.U, panelSize.U); 267curLineSize.V = Math.Max(sz.V, curLineSize.V); 272panelSize.U = Math.Max(curLineSize.U, panelSize.U); 327curLineSize.V = Math.Max(sz.V, curLineSize.V);
System\Windows\Documents\Block.cs (2)
489double maxLineHeight = Math.Min(1000000, PTS.MaxFontSize); 533double maxThickness = Math.Min(1000000, PTS.MaxPageSize);
System\windows\Documents\CaretElement.cs (6)
410deltaToScroll = Math.Abs(targetPoint.Y); 411scroller.ScrollToVerticalOffset(Math.Max(0, scroller.VerticalOffset - deltaToScroll - scrollerHeight / 4)); 417scroller.ScrollToVerticalOffset(Math.Min(scroller.ExtentHeight, scroller.VerticalOffset + deltaToScroll + scrollerHeight / 4)); 427deltaToScroll = Math.Abs(targetPoint.X); 428scroller.ScrollToHorizontalOffset(Math.Max(0, scroller.HorizontalOffset - deltaToScroll - scrollerWidth / 4)); 434scroller.ScrollToHorizontalOffset(Math.Min(scroller.ExtentWidth, scroller.HorizontalOffset + deltaToScroll + scrollerWidth / 4));
System\Windows\Documents\DocumentSequenceTextPointer.cs (1)
1039distance = Math.Abs(distance);
System\Windows\Documents\Figure.cs (1)
300double maxOffset = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\FixedPageStructure.cs (4)
138line = Math.Max(0, Math.Min(line, _lineResults.Length - 1)); 163double absVerDistance = Math.Max(0, (pt.Y > lineResult.LayoutBox.Y) ? (pt.Y - lineResult.LayoutBox.Bottom) : (lineResult.LayoutBox.Y - pt.Y)); 164double absHorDistance = Math.Max(0, (pt.X > lineResult.LayoutBox.X) ? (pt.X - lineResult.LayoutBox.Right) : (lineResult.LayoutBox.X - pt.X));
System\Windows\Documents\FixedSOMPageConstructor.cs (5)
558if (Math.Abs(textRunRect.Left - fixedBlockRect.Left) <= textRun.DefaultCharWidth || 559Math.Abs(textRunRect.Right - fixedBlockRect.Right) <= textRun.DefaultCharWidth) 1031if (Math.Abs(t.BoundingRect.Left - row.BoundingRect.Left) < fudge && 1032Math.Abs(t.BoundingRect.Right - row.BoundingRect.Right) < fudge && 1033Math.Abs(t.BoundingRect.Bottom - row.BoundingRect.Top) < fudge)
System\Windows\Documents\FixedSOMSemanticBox.cs (1)
218double overlap = Math.Abs(thisRectRefX - otherRectRefX);
System\Windows\Documents\FixedSOMTextRun.cs (2)
141double yScale = Math.Sqrt(mat.M12*mat.M12 + mat.M22*mat.M22); 142double xScale = Math.Sqrt(mat.M11 * mat.M11 + mat.M21 * mat.M21);
System\Windows\Documents\FixedTextBuilder.cs (2)
881double xDistance = Math.Abs(currentPt.X - prevPt.X); 882double maxHeight = Math.Max(box1.Height, box2.Height);
System\Windows\Documents\FixedTextView.cs (2)
848double horizontalDistance = Math.Max(0, (transformedPt.X > alignmentRect.X) ? (transformedPt.X - alignmentRect.Right) : (alignmentRect.X - transformedPt.X)); 849double verticalDistance = Math.Max(0, (transformedPt.Y > alignmentRect.Y) ? (transformedPt.Y - alignmentRect.Bottom) : (alignmentRect.Y - transformedPt.Y));
System\Windows\Documents\Floater.cs (1)
133double maxWidth = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\FlowDocument.cs (5)
1529double maxSize = Math.Min(1000000, PTS.MaxPageSize); 1544double maxSize = Math.Min(1000000, PTS.MaxPageSize); 1559double maxSize = Math.Min(1000000, PTS.MaxPageSize); 1580double maxRuleWidth = Math.Min(1000000, PTS.MaxPageSize); 1591double maxGap = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\FlowPosition.cs (2)
218maxLength = Math.Min(maxLength, remainingLength); 315distance = Math.Abs(distance);
System\Windows\Documents\Glyphs.cs (3)
157Math.Max(0, designRect.Right), 158Math.Max(0, designRect.Bottom) 534estimatedNumberOfGlyphs = Math.Max(estimatedNumberOfGlyphs, glyphsProp.Length / 5);
System\Windows\Documents\ImmComposition.cs (5)
674milPointTopLeft = new Point(Math.Min(rectStart.Left, rectEnd.Left), Math.Min(rectStart.Top, rectEnd.Top)); 675milPointBottomRight = new Point(Math.Max(rectStart.Left, rectEnd.Left), Math.Max(rectStart.Bottom, rectEnd.Bottom)); 1128_caretOffset = Math.Min(_caretOffset, text.Length);
System\Windows\Documents\List.cs (1)
327double maxOffset = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\Paragraph.cs (1)
303double maxIndent = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\RangeContentEnumerator.cs (1)
308newBuffer = new char[Math.Max(2*_buffer.Length, size)];
System\Windows\Documents\Speller.cs (7)
1017int timeOutOffset = Math.Min(data.TextMap.ContentEndOffset, sentenceEndOffset); 1201sTextRange = (SpellerInteropBase.ITextRange)segments[Math.Max(i, 0)]; 1204contextOffset = Math.Min(sTextRange.Start, contentOffset); 1209sTextRange = (SpellerInteropBase.ITextRange)segments[Math.Min(i, segments.Count-1)]; 1212contextOffset = Math.Max(sTextRange.Start + sTextRange.Length, contentOffset); 1718runCount = Math.Min(runCount, _text.Length - _textLength); 1719runCount = Math.Min(runCount, position.GetOffsetToPosition(contextEnd));
System\Windows\Documents\Table.cs (2)
207get { return Math.Max(CellSpacing, 0); } 387double maxSpacing = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\TableColumn.cs (1)
205double maxPixel = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\Documents\TableRowGroup.cs (1)
228_columnCount = Math.Max(_columnCount, Rows[i].ColumnCount);
System\Windows\Documents\TextContainerChangedEventArgs.cs (3)
240change.RemovedLength += Math.Max(0, length - change.AddedLength); 241change.AddedLength = Math.Max(0, change.AddedLength - length); 403int cancelledCount = Math.Min(overlap, newChange.RemovedLength);
System\windows\Documents\TextEditor.cs (2)
524_mouseSelectionState.Timer.Interval = TimeSpan.FromMilliseconds(Math.Max(SystemParameters.MenuShowDelay, 200)); 1191int extraCharsAllowed = Math.Max(0, this.MaxLength - currentLength);
System\Windows\Documents\TextElement.cs (1)
1606double maxFontSize = Math.Min(1000000, PTS.MaxFontSize);
System\Windows\Documents\TextFindEngine.cs (4)
216int textBlockLength = Math.Max(TextBlockLength, findPattern.Length * 2 * 2); 671runCount = Math.Min(runCount, findText.Length - findTextLength); 675runCount = Math.Min(runCount, navigator.GetOffsetToPosition(endPosition)); 685runCount = Math.Min(runCount, startPosition.GetOffsetToPosition(navigator));
System\Windows\Documents\TextPointer.cs (1)
1795finalCount += Math.Min(count - finalCount, textNode.SymbolCount - skipCount);
System\Windows\Documents\TextPointerBase.cs (5)
104maxCount = Math.Min(count, thisPointer.GetOffsetToPosition(limit)); 108maxCount = Math.Min(count, limit.GetOffsetToPosition(thisPointer)); 110maxCount = Math.Min(count, maxCount); 1429runLength = Math.Min(navigator.GetTextRunLength(LogicalDirection.Backward), SelectionWordBreaker.MinContextLength - preceedingCount); 1448runLength = Math.Min(navigator.GetTextRunLength(LogicalDirection.Forward), SelectionWordBreaker.MinContextLength - followingCount);
System\Windows\Documents\TextRangeEdit.cs (4)
2348new DoublePropertyRange (Paragraph.TextIndentProperty, -Math.Min(1000000, PTS.MaxPageSize), Math.Min(1000000, PTS.MaxPageSize)) 2370double retValue = Math.Max(_lowerBound, value); 2371retValue = Math.Min(retValue, _upperBound);
System\Windows\Documents\TextRangeEditTables.cs (10)
335int firstRowIndex = Math.Min(anchorCell.Row.Index, movingCell.Row.Index); 336int lastRowIndex = Math.Max(anchorCell.Row.Index + anchorCell.RowSpan - 1, movingCell.Row.Index + movingCell.RowSpan - 1); 337int firstColumnIndex = Math.Min(anchorCell.ColumnIndex, movingCell.ColumnIndex); 338int lastColumnIndex = Math.Max(anchorCell.ColumnIndex + anchorCell.ColumnSpan - 1, movingCell.ColumnIndex + movingCell.ColumnSpan - 1); 1428int cCols = Math.Abs(columnCount); 1710_dxr = Math.Max(_dxr, 0.0); 1733xPosAdorner = Math.Max(xPosAdorner, _columnRect.Left - this.LeftDragMax); 1734xPosAdorner = Math.Min(xPosAdorner, _columnRect.Right + this.RightDragMax); 1745dx = Math.Max(dx, - this.LeftDragMax); 1746dx = Math.Min(dx, this.RightDragMax);
System\windows\Documents\TextSelection.cs (2)
2251caretRectangle.Y += caretRectangle.Height - Math.Abs(bottom.Y - top.Y); 2252caretRectangle.Height = Math.Abs(bottom.Y - top.Y);
System\Windows\Documents\TextStore.cs (12)
1000milPointTopLeft = new Point(Math.Min(rectPrev.Left, rectCur.Left), Math.Min(rectPrev.Top, rectCur.Top)); 1001milPointBottomRight = new Point(Math.Max(rectPrev.Left, rectCur.Left), Math.Max(rectPrev.Bottom, rectCur.Bottom)); 2479runCount = TextPointerBase.GetTextWithLimit(navigator, LogicalDirection.Forward, text, charsCopied, Math.Min(cchReq, text.Length - charsCopied), limit); 2880double radSin = Math.Asin(tf.M12 / Math.Sqrt((tf.M11 * tf.M11) + (tf.M12 * tf.M12))); 2881double radCos = Math.Acos(tf.M11 / Math.Sqrt((tf.M11 * tf.M11) + (tf.M12 * tf.M12))); 2883double angleCos = Math.Round((radCos * 180) / Math.PI, 0); 3846int extraCharsAllowed = Math.Max(0, this.TextEditor.MaxLength - currentLength);
System\Windows\Documents\TextTreeText.cs (4)
104firstCount = Math.Min(count, firstBlock.Count - firstBlockLocalOffset); 301count = Math.Min(rightBlock.FreeCapacity, length - textOffset); 343count = Math.Min(neighborBlock.FreeCapacity, textEndOffset - textOffset); 357count = Math.Min(rightBlock.FreeCapacity, textEndOffset - textOffset);
System\Windows\Documents\TextTreeTextBlock.cs (4)
95newText = new char[Math.Min(this.Count + count, MaxBlockSize)]; 110count = Math.Min(count, _gapSize); 249copyCount = Math.Min(count, _gapOffset - logicalOffset); 264copyCount = Math.Min(count, _text.Length - logicalOffset);
System\Windows\Documents\Tracing\SpellerCOMActionTraceLogger.cs (3)
198(long)Math.Floor(1.0d * _instanceInfo.CumulativeCallTime100Ns[_action] / _instanceInfo.NumCallsMeasured[_action]); 219CallTimeForCOMCallMs = (long)Math.Floor(ticks * 1.0d / 10000), 220RunningAverageCallTimeForCOMCallsMs = (long)Math.Floor(runningAverage * 1.0d / 10000)
System\Windows\Documents\WinRTSpellerInteropExtensions.cs (1)
175int altFormsCount = Math.Min(missingFragmentText.Length, AlternateFormsMaximumCount);
System\Windows\Documents\XamlToRtfWriter.cs (2)
1732tableWidth = Math.Max(tableWidth, lastCellX); 2893formatState.FontSize = (long)Math.Round(fs);
System\Windows\FigureLength.cs (1)
101double maxPixel = Math.Min(1000000, PTS.MaxPageSize);
System\Windows\FrameworkElement.cs (59)
4059maxHeight = Math.Max(Math.Min(height, maxHeight), minHeight); 4062minHeight = Math.Max(Math.Min(maxHeight, height), minHeight); 4069maxWidth = Math.Max(Math.Min(width, maxWidth), minWidth); 4072minWidth = Math.Max(Math.Min(maxWidth, width), minWidth); 4174Double yCoverD = (yConstrInfinite ? Double.PositiveInfinity : Math.Abs(yConstr/d)); 4175Double xCoverA = (xConstrInfinite ? Double.PositiveInfinity : Math.Abs(xConstr/a)); 4195h = Math.Min(0.5*Math.Abs(xConstr/c), yCoverD); 4206w = Math.Min( 0.5*Math.Abs(yConstr/b), xCoverA); 4214Double yCoverB = Math.Abs(yConstr/b); 4215Double xCoverC = Math.Abs(xConstr/c); 4235h = Math.Min(0.5*Math.Abs(yConstr/d), xCoverC); 4246w = Math.Min( 0.5*Math.Abs(xConstr/a), yCoverB); 4252Double xCoverA = Math.Abs(xConstr / a); // w-intercept of x-constraint line. 4253Double xCoverC = Math.Abs(xConstr / c); // h-intercept of x-constraint line. 4255Double yCoverB = Math.Abs(yConstr / b); // w-intercept of y-constraint line. 4256Double yCoverD = Math.Abs(yConstr / d); // h-intercept of y-constraint line. 4263w = Math.Min(yCoverB, xCoverA) * 0.5; 4264h = Math.Min(xCoverC, yCoverD) * 0.5; 4281Double expandFactor = Math.Min(xConstr / childBoundsTr.Width, 4340Math.Max(availableSize.Width - marginWidth, 0), 4341Math.Max(availableSize.Height - marginHeight, 0)); 4389frameworkAvailableSize.Width = Math.Max(mm.minWidth, Math.Min(frameworkAvailableSize.Width, mm.maxWidth)); 4390frameworkAvailableSize.Height = Math.Max(mm.minHeight, Math.Min(frameworkAvailableSize.Height, mm.maxHeight)); 4403Math.Max(desiredSize.Width, mm.minWidth), 4404Math.Max(desiredSize.Height, mm.minHeight)); 4470ltd.TransformedUnroundedDS = new Size(Math.Max(0, clippedDesiredWidth), Math.Max(0, clippedDesiredHeight)); 4517return new Size(Math.Max(0, clippedDesiredWidth), Math.Max(0, clippedDesiredHeight)); 4579arrangeSize.Width = Math.Max(0, arrangeSize.Width - marginWidth); 4580arrangeSize.Height = Math.Max(0, arrangeSize.Height - marginHeight); 4589transformedUnroundedDS.Width = Math.Max(0, transformedUnroundedDS.Width - marginWidth); 4590transformedUnroundedDS.Height = Math.Max(0, transformedUnroundedDS.Height- marginHeight); 4599unclippedDesiredSize = new Size(Math.Max(0, this.DesiredSize.Width - marginWidth), 4600Math.Max(0, this.DesiredSize.Height - marginHeight)); 4605unclippedDesiredSize.Width = Math.Max(transformedUnroundedDS.Width, unclippedDesiredSize.Width); 4606unclippedDesiredSize.Height = Math.Max(transformedUnroundedDS.Height, unclippedDesiredSize.Height); 4693double effectiveMaxWidth = Math.Max(unclippedDesiredSize.Width, mm.maxWidth); 4700double effectiveMaxHeight = Math.Max(unclippedDesiredSize.Height, mm.maxHeight); 4731Size clippedInkSize = new Size(Math.Min(innerInkSize.Width, mm.maxWidth), 4732Math.Min(innerInkSize.Height, mm.maxHeight)); 4764Size clientSize = new Size(Math.Max(0, finalRect.Width - marginWidth), 4765Math.Max(0, finalRect.Height - marginHeight)); 4914inkSize.Width = Math.Min(inkSize.Width, mm.maxWidth); 4915inkSize.Height = Math.Min(inkSize.Height, mm.maxHeight); 4932Size clippingSize = new Size(Math.Max(0, layoutSlotSize.Width - marginWidth), 4933Math.Max(0, layoutSlotSize.Height - marginHeight)); 5245inkSize.Width = Math.Min(inkSize.Width, mm.maxWidth); 5246inkSize.Height = Math.Min(inkSize.Height, mm.maxHeight);
System\Windows\Input\KeyboardNavigation.cs (9)
2518rect.Height = Math.Min(Math.Max(before, 0.0d), rect.Height); 2522double height = Math.Min(Math.Max(after, 0.0d), rect.Height); 2538return Math.Sqrt(deltaX * deltaX + deltaY * deltaY); 2669startRange = Math.Min(startRange, _horizontalBaseline); 2670endRange = Math.Max(endRange, _horizontalBaseline); 2690startRange = Math.Min(startRange, _verticalBaseline); 2691endRange = Math.Max(endRange, _verticalBaseline);
System\Windows\Interop\HwndHost.cs (2)
707desiredSize.Width = Math.Min(_desiredSize.Width, constraint.Width); 708desiredSize.Height = Math.Min(_desiredSize.Height, constraint.Height);
System\Windows\Markup\Baml2006\SharedStream.cs (2)
150long end = Math.Min(_position + 1, _length); 175long end = Math.Min(_position + count, _length);
System\Windows\Markup\BamlRecordReader.cs (1)
1752defKeyList = new ArrayList(Math.Max (5, (int)(bamlRecord.ContentSize/400)));
System\Windows\Shapes\Ellipse.cs (4)
98width = Math.Min(width, height); 102width = Math.Max(width, height); 125Math.Max(0, finalSize.Width - penThickness), // Width 126Math.Max(0, finalSize.Height - penThickness)); // Height
System\Windows\Shapes\Rectangle.cs (4)
150width = Math.Min(width, height); 154width = Math.Max(width, height); 178Math.Max(0, finalSize.Width - penThickness), // Width 179Math.Max(0, finalSize.Height - penThickness)); // Height
System\Windows\Shapes\Shape.cs (6)
470return Math.Abs(StrokeThickness); 486thickness = Math.Abs(strokeThickness); 587xScale = Math.Max(availableSize.Width - strokeThickness, 0); 588yScale = Math.Max(availableSize.Height - strokeThickness, 0); 715return new Size(Math.Max(bounds.Right, 0), 716Math.Max(bounds.Bottom, 0));
System\Windows\Shell\TaskbarItemInfo.cs (2)
108progressValue = Math.Max(progressValue, 0); 109progressValue = Math.Min(1, progressValue);
System\Windows\Shell\WindowChromeWorker.cs (23)
1065double shortestDimension = Math.Min(windowSize.Width, windowSize.Height); 1068topLeftRadius = Math.Min(topLeftRadius, shortestDimension / 2); 1084topRightRadius = Math.Min(topRightRadius, shortestDimension / 2); 1092bottomLeftRadius = Math.Min(bottomLeftRadius, shortestDimension / 2); 1100bottomRightRadius = Math.Min(bottomRightRadius, shortestDimension / 2); 1127(int)Math.Floor(region.Left), 1128(int)Math.Floor(region.Top), 1129(int)Math.Ceiling(region.Right), 1130(int)Math.Ceiling(region.Bottom)); 1135(int)Math.Floor(region.Left), 1136(int)Math.Floor(region.Top), 1137(int)Math.Ceiling(region.Right) + 1, 1138(int)Math.Ceiling(region.Bottom) + 1, 1139(int)Math.Ceiling(radius), 1140(int)Math.Ceiling(radius)); 1228deviceGlassThickness.Top = Math.Max(0, deviceGlassThickness.Top); 1233deviceGlassThickness.Left = Math.Max(0, deviceGlassThickness.Left); 1238deviceGlassThickness.Bottom = Math.Max(0, deviceGlassThickness.Bottom); 1243deviceGlassThickness.Right = Math.Max(0, deviceGlassThickness.Right); 1250cxLeftWidth = (int)Math.Ceiling(deviceGlassThickness.Left), 1251cxRightWidth = (int)Math.Ceiling(deviceGlassThickness.Right), 1252cyTopHeight = (int)Math.Ceiling(deviceGlassThickness.Top), 1253cyBottomHeight = (int)Math.Ceiling(deviceGlassThickness.Bottom),
System\Windows\Standard\NativeMethods.cs (4)
2049Left = Math.Min(rect1.Left, rect2.Left), 2050Top = Math.Min(rect1.Top, rect2.Top), 2051Right = Math.Max(rect1.Right, rect2.Right), 2052Bottom = Math.Max(rect1.Bottom, rect2.Bottom),
System\Windows\SystemFonts.cs (1)
1017return (double)(Math.Abs(height) * 96 / dpi);
System\Windows\Window.cs (30)
1769frameworkAvailableSize.Width = Math.Max(mm.minWidth, Math.Min(frameworkAvailableSize.Width, mm.maxWidth)); 1770frameworkAvailableSize.Height = Math.Max(mm.minHeight, Math.Min(frameworkAvailableSize.Height, mm.maxHeight)); 1777Math.Max(desiredSize.Width, mm.minWidth), 1778Math.Max(desiredSize.Height, mm.minHeight)); 1799arrangeBounds.Width = Math.Max(mm.minWidth, Math.Min(arrangeBounds.Width, mm.maxWidth)); 1800arrangeBounds.Height = Math.Max(mm.minHeight, Math.Min(arrangeBounds.Height, mm.maxHeight)); 1834childArrangeBounds.Width = Math.Max(0.0, arrangeBounds.Width - frameSize.Width); 1835childArrangeBounds.Height = Math.Max(0.0, arrangeBounds.Height - frameSize.Height); 3311childConstraint.Width = ((constraint.Width == Double.PositiveInfinity) ? Double.PositiveInfinity : Math.Max(0.0, (constraint.Width - frameSize.Width))); 3312childConstraint.Height = ((constraint.Height == Double.PositiveInfinity) ? Double.PositiveInfinity : Math.Max(0.0, (constraint.Height - frameSize.Height))); 3356maxWidthDeviceUnits = Math.Max(_trackMaxWidthDeviceUnits, _windowMaxWidthDeviceUnits); 3357maxHeightDeviceUnits = Math.Max(_trackMaxHeightDeviceUnits, _windowMaxHeightDeviceUnits); 3366mm.minWidth = Math.Max(this.MinWidth, minSizeLogicalUnits.X); 3371mm.maxWidth = Math.Min(MinWidth, maxSizeLogicalUnits.X); 3377mm.maxWidth = Math.Min(MaxWidth, maxSizeLogicalUnits.X); 3388mm.minHeight = Math.Max(this.MinHeight, minSizeLogicalUnits.Y); 3393mm.maxHeight = Math.Min(this.MinHeight, maxSizeLogicalUnits.Y); 3399mm.maxHeight = Math.Min(MaxHeight, maxSizeLogicalUnits.Y); 3769leftDeviceUnits = Math.Min(leftDeviceUnits, workAreaRectDeviceUnits.right - currentSizeDeviceUnits.Width); 3770leftDeviceUnits = Math.Max(leftDeviceUnits, workAreaRectDeviceUnits.left); 3771topDeviceUnits = Math.Min(topDeviceUnits, workAreaRectDeviceUnits.bottom - currentSizeDeviceUnits.Height); 3772topDeviceUnits = Math.Max(topDeviceUnits, workAreaRectDeviceUnits.top); 4632_windowMaxWidthDeviceUnits = Math.Max(_windowMaxWidthDeviceUnits, windowSize.X); 4633_windowMaxHeightDeviceUnits = Math.Max(_windowMaxHeightDeviceUnits, windowSize.Y); 7523return new Size(Math.Max(0.0, pt.X), Math.Max(0.0, pt.Y));
PresentationFramework.Aero (21)
Microsoft\Windows\Themes\ButtonChrome.cs (4)
434desired = new Size(Math.Min(4.0, availableSize.Width), Math.Min(4.0, availableSize.Height)); 452childArrangeRect.Width = Math.Max(0d, finalSize.Width - 4.0); 453childArrangeRect.Height = Math.Max(0d, finalSize.Height - 4.0);
Microsoft\Windows\Themes\ListBoxChrome.cs (2)
255desired = new Size(Math.Min(borderX, availableSize.Width), Math.Min(borderY, availableSize.Height));
Microsoft\Windows\Themes\ScrollChrome.cs (5)
471bounds.Width = Math.Max(0.0, bounds.Width - 1.0); 542double height = Math.Min(7.0, bounds.Height); 565double width = Math.Min(7.0, bounds.Width); 729double widthScale = Math.Min(glyphWidth, bounds.Width) / glyphWidth; 730double heightScale = Math.Min(glyphHeight, bounds.Height) / glyphHeight;
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\DataGridHeaderBorder.cs (5)
193childWidth = Math.Max(0.0, childWidth - padding.Left - padding.Right); 198childHeight = Math.Max(0.0, childHeight - padding.Top - padding.Bottom); 233double childWidth = Math.Max(0.0, arrangeSize.Width - padding.Left - padding.Right); 234double childHeight = Math.Max(0.0, arrangeSize.Height - padding.Top - padding.Bottom); 300return Math.Max(0.0, d);
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\SystemDropShadowChrome.cs (5)
116double maxRadius = Math.Min(centerWidth * 0.5, centerHeight * 0.5); 117cornerRadius.TopLeft = Math.Min(cornerRadius.TopLeft, maxRadius); 118cornerRadius.TopRight = Math.Min(cornerRadius.TopRight, maxRadius); 119cornerRadius.BottomLeft = Math.Min(cornerRadius.BottomLeft, maxRadius); 120cornerRadius.BottomRight = Math.Min(cornerRadius.BottomRight, maxRadius);
PresentationFramework.Aero2 (21)
Microsoft\Windows\Themes\ButtonChrome.cs (4)
434desired = new Size(Math.Min(4.0, availableSize.Width), Math.Min(4.0, availableSize.Height)); 452childArrangeRect.Width = Math.Max(0d, finalSize.Width - 4.0); 453childArrangeRect.Height = Math.Max(0d, finalSize.Height - 4.0);
Microsoft\Windows\Themes\ListBoxChrome.cs (2)
255desired = new Size(Math.Min(borderX, availableSize.Width), Math.Min(borderY, availableSize.Height));
Microsoft\Windows\Themes\ScrollChrome.cs (5)
471bounds.Width = Math.Max(0.0, bounds.Width - 1.0); 542double height = Math.Min(7.0, bounds.Height); 565double width = Math.Min(7.0, bounds.Width); 729double widthScale = Math.Min(glyphWidth, bounds.Width) / glyphWidth; 730double heightScale = Math.Min(glyphHeight, bounds.Height) / glyphHeight;
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\DataGridHeaderBorder.cs (5)
193childWidth = Math.Max(0.0, childWidth - padding.Left - padding.Right); 198childHeight = Math.Max(0.0, childHeight - padding.Top - padding.Bottom); 233double childWidth = Math.Max(0.0, arrangeSize.Width - padding.Left - padding.Right); 234double childHeight = Math.Max(0.0, arrangeSize.Height - padding.Top - padding.Bottom); 300return Math.Max(0.0, d);
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\SystemDropShadowChrome.cs (5)
116double maxRadius = Math.Min(centerWidth * 0.5, centerHeight * 0.5); 117cornerRadius.TopLeft = Math.Min(cornerRadius.TopLeft, maxRadius); 118cornerRadius.TopRight = Math.Min(cornerRadius.TopRight, maxRadius); 119cornerRadius.BottomLeft = Math.Min(cornerRadius.BottomLeft, maxRadius); 120cornerRadius.BottomRight = Math.Min(cornerRadius.BottomRight, maxRadius);
PresentationFramework.AeroLite (14)
Microsoft\Windows\Themes\ScrollChrome.cs (2)
247double height = Math.Min(7.0, bounds.Height); 262double width = Math.Min(7.0, bounds.Width);
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\DataGridHeaderBorder.cs (5)
193childWidth = Math.Max(0.0, childWidth - padding.Left - padding.Right); 198childHeight = Math.Max(0.0, childHeight - padding.Top - padding.Bottom); 233double childWidth = Math.Max(0.0, arrangeSize.Width - padding.Left - padding.Right); 234double childHeight = Math.Max(0.0, arrangeSize.Height - padding.Top - padding.Bottom); 300return Math.Max(0.0, d);
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\ProgressBarBrushConverter.cs (2)
86int blocks = (int)Math.Ceiling(width / blockTotal); 161if (!isIndeterminate && remainder > 0.0 && Math.Abs(width - trackWidth) < 1.0e-5)
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\SystemDropShadowChrome.cs (5)
116double maxRadius = Math.Min(centerWidth * 0.5, centerHeight * 0.5); 117cornerRadius.TopLeft = Math.Min(cornerRadius.TopLeft, maxRadius); 118cornerRadius.TopRight = Math.Min(cornerRadius.TopRight, maxRadius); 119cornerRadius.BottomLeft = Math.Min(cornerRadius.BottomLeft, maxRadius); 120cornerRadius.BottomRight = Math.Min(cornerRadius.BottomRight, maxRadius);
PresentationFramework.Classic (23)
Microsoft\Windows\Themes\ClassicBorderDecorator.cs (11)
239float min = Math.Min(rgbColor.Red, Math.Min(rgbColor.Green, rgbColor.Blue)); 240float max = Math.Max(rgbColor.Red, Math.Max(rgbColor.Green, rgbColor.Blue)); 272saturation = Math.Max(0.0f, Math.Min(saturation, 1.0f)); 327float hue = (float)((hlsColor.Hue - Math.Floor(hlsColor.Hue)) * 6); 603Math.Max(0.0, rt.Width - thick.Left - thick.Right), 604Math.Max(0.0, rt.Height - thick.Top - thick.Bottom)); 692desired = new Size(Math.Min(borderSize.Width, availableSize.Width), Math.Min(borderSize.Height, availableSize.Height));
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\DataGridHeaderBorder.cs (5)
193childWidth = Math.Max(0.0, childWidth - padding.Left - padding.Right); 198childHeight = Math.Max(0.0, childHeight - padding.Top - padding.Bottom); 233double childWidth = Math.Max(0.0, arrangeSize.Width - padding.Left - padding.Right); 234double childHeight = Math.Max(0.0, arrangeSize.Height - padding.Top - padding.Bottom); 300return Math.Max(0.0, d);
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\ProgressBarBrushConverter.cs (2)
86int blocks = (int)Math.Ceiling(width / blockTotal); 161if (!isIndeterminate && remainder > 0.0 && Math.Abs(width - trackWidth) < 1.0e-5)
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\SystemDropShadowChrome.cs (5)
116double maxRadius = Math.Min(centerWidth * 0.5, centerHeight * 0.5); 117cornerRadius.TopLeft = Math.Min(cornerRadius.TopLeft, maxRadius); 118cornerRadius.TopRight = Math.Min(cornerRadius.TopRight, maxRadius); 119cornerRadius.BottomLeft = Math.Min(cornerRadius.BottomLeft, maxRadius); 120cornerRadius.BottomRight = Math.Min(cornerRadius.BottomRight, maxRadius);
PresentationFramework.Luna (27)
Microsoft\Windows\Themes\ButtonChrome.cs (4)
349desired = new Size(Math.Min(sideThickness2, availableSize.Width), Math.Min(sideThickness2, availableSize.Height)); 367childArrangeRect.Width = Math.Max(0d, finalSize.Width - sideThickness2); 368childArrangeRect.Height = Math.Max(0d, finalSize.Height - sideThickness2);
Microsoft\Windows\Themes\ScrollChrome.cs (5)
310bounds.Width = Math.Max(0.0, bounds.Width - 1.0); 384double height = Math.Min(6.0, bounds.Height); 406double width = Math.Min(6.0, bounds.Width); 588double widthScale = Math.Min(glyphWidth, bounds.Width) / glyphWidth; 589double heightScale = Math.Min(glyphHeight, bounds.Height) / glyphHeight;
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\BulletChrome.cs (6)
194desired = new Size(Math.Min(11.0 + borderX, availableSize.Width), Math.Min(11.0 + borderY, availableSize.Height)); 217Math.Max(0, bounds.Width - thickness.Left - thickness.Right), 218Math.Max(0, bounds.Height - thickness.Top - thickness.Bottom)); 459Math.Max(0.0, rt.Width - thick.Left - thick.Right), 460Math.Max(0.0, rt.Height - thick.Top - thick.Bottom));
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\DataGridHeaderBorder.cs (5)
193childWidth = Math.Max(0.0, childWidth - padding.Left - padding.Right); 198childHeight = Math.Max(0.0, childHeight - padding.Top - padding.Bottom); 233double childWidth = Math.Max(0.0, arrangeSize.Width - padding.Left - padding.Right); 234double childHeight = Math.Max(0.0, arrangeSize.Height - padding.Top - padding.Bottom); 300return Math.Max(0.0, d);
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\ProgressBarBrushConverter.cs (2)
86int blocks = (int)Math.Ceiling(width / blockTotal); 161if (!isIndeterminate && remainder > 0.0 && Math.Abs(width - trackWidth) < 1.0e-5)
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\SystemDropShadowChrome.cs (5)
116double maxRadius = Math.Min(centerWidth * 0.5, centerHeight * 0.5); 117cornerRadius.TopLeft = Math.Min(cornerRadius.TopLeft, maxRadius); 118cornerRadius.TopRight = Math.Min(cornerRadius.TopRight, maxRadius); 119cornerRadius.BottomLeft = Math.Min(cornerRadius.BottomLeft, maxRadius); 120cornerRadius.BottomRight = Math.Min(cornerRadius.BottomRight, maxRadius);
PresentationFramework.Royale (26)
Microsoft\Windows\Themes\ButtonChrome.cs (4)
307desired = new Size(Math.Min(sideThickness2, availableSize.Width), Math.Min(sideThickness2, availableSize.Height)); 325childArrangeRect.Width = Math.Max(0d, finalSize.Width - sideThickness2); 326childArrangeRect.Height = Math.Max(0d, finalSize.Height - sideThickness2);
Microsoft\Windows\Themes\ScrollChrome.cs (4)
344double height = Math.Min(6.0, bounds.Height); 366double width = Math.Min(6.0, bounds.Width); 548double widthScale = Math.Min(glyphWidth, bounds.Width) / glyphWidth; 549double heightScale = Math.Min(glyphHeight, bounds.Height) / glyphHeight;
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\BulletChrome.cs (6)
194desired = new Size(Math.Min(11.0 + borderX, availableSize.Width), Math.Min(11.0 + borderY, availableSize.Height)); 217Math.Max(0, bounds.Width - thickness.Left - thickness.Right), 218Math.Max(0, bounds.Height - thickness.Top - thickness.Bottom)); 459Math.Max(0.0, rt.Width - thick.Left - thick.Right), 460Math.Max(0.0, rt.Height - thick.Top - thick.Bottom));
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\DataGridHeaderBorder.cs (5)
193childWidth = Math.Max(0.0, childWidth - padding.Left - padding.Right); 198childHeight = Math.Max(0.0, childHeight - padding.Top - padding.Bottom); 233double childWidth = Math.Max(0.0, arrangeSize.Width - padding.Left - padding.Right); 234double childHeight = Math.Max(0.0, arrangeSize.Height - padding.Top - padding.Bottom); 300return Math.Max(0.0, d);
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\ProgressBarBrushConverter.cs (2)
86int blocks = (int)Math.Ceiling(width / blockTotal); 161if (!isIndeterminate && remainder > 0.0 && Math.Abs(width - trackWidth) < 1.0e-5)
src\Microsoft.DotNet.Wpf\src\Themes\Shared\Microsoft\Windows\Themes\SystemDropShadowChrome.cs (5)
116double maxRadius = Math.Min(centerWidth * 0.5, centerHeight * 0.5); 117cornerRadius.TopLeft = Math.Min(cornerRadius.TopLeft, maxRadius); 118cornerRadius.TopRight = Math.Min(cornerRadius.TopRight, maxRadius); 119cornerRadius.BottomLeft = Math.Min(cornerRadius.BottomLeft, maxRadius); 120cornerRadius.BottomRight = Math.Min(cornerRadius.BottomRight, maxRadius);
PresentationUI (6)
MS\Internal\Documents\CredentialManagerDialog.cs (1)
169int maxWidth = Math.Max(_addButton.Width, _removeButton.Width);
MS\Internal\Documents\SignatureSummaryDialog.cs (4)
575int h = Math.Max(Math.Max(Math.Max(Math.Max(IconHeight,heightSummary), heightIntent), heightLocale), heightSignBy);
TenFeetInstallationProgress.xaml.cs (1)
129double percentDone = Math.Floor((double)bytesDownloaded / (double)bytesTotal * 100.0);
ReachFramework (93)
AlphaFlattener\BrushProxy.cs (32)
516rb.RadiusX = Math.Abs(rb.RadiusX * bounds.Width); 517rb.RadiusY = Math.Abs(rb.RadiusY * bounds.Height); 1916double length = Math.Sqrt(dx * dx + dy * dy); 1930stopDistance = Math.Max(b.RadiusX, b.RadiusY) * (second.Offset - first.Offset); 1948int stopCount = (int)Math.Ceiling(-6.297427 + 4.591693 * Math.Log(stopDistance)); 2287double height = Math.Abs(start.Y - end.Y) * multiplier; 2296double width = Math.Abs(start.X - end.X) * multiplier; 2577if (Utility.AreClose(new Vector(Math.Abs(rbA.RadiusX), Math.Abs(rbA.RadiusY)) * rbA.Transform.Value, 2578new Vector(Math.Abs(rbB.RadiusX), Math.Abs(rbB.RadiusY)) * rbB.Transform.Value)) 3746min = Math.Min(min, offset); 3747max = Math.Max(max, offset); 3873return Math.Sqrt(sum); 3902return (int)Math.Ceiling(Math.Max(5, step)); // At least five. Radials look bad with less steps. 3951if (Math.Abs(di) < Double.Epsilon) 4045double right = Math.Ceiling(_bounds.Right / _bandDelta); 4046double left = Math.Floor(_bounds.Left / _bandDelta); 4145double rotateAngle = Math.Atan2(-gradientVector.Y, gradientVector.X) * 180.0 / Math.PI; 4190_rx = Math.Abs(b.RadiusX); 4191_ry = Math.Abs(b.RadiusY); 4272double right = Math.Ceiling(maxt * _bandSteps); 4273double left = Math.Floor(mint * _bandSteps); 4388double root = Math.Sqrt(B4AC); 4397maxt = Math.Max(maxt, one); 4398mint = Math.Min(mint, one); 4405maxt = Math.Max(maxt, two); 4406mint = Math.Min(mint, two); 4431double len = Math.Sqrt(dx * dx + dy * dy);
AlphaFlattener\DrawingContext.cs (3)
606int width = (int) Math.Round(bounds.Width * Configuration.RasterizationDPI / 96); 607int height = (int) Math.Round(bounds.Height * Configuration.RasterizationDPI / 96); 664return 512 + Configuration.RasterizationCost(Math.Max(bounds.Width, bounds.Height));
AlphaFlattener\Flattener.cs (2)
1231uint dcDpi = Math.Max(PrintQueue.GetDpiX(dc), PrintQueue.GetDpiY(dc)); 1232Configuration.RasterizationDPI = (int)(Math.Max(dcDpi, 300));
AlphaFlattener\ImageProxy.cs (6)
488int x0 = (int)Math.Max(Math.Floor(bounds.Left), 0); 489int y0 = (int)Math.Max(Math.Floor(bounds.Top), 0); 490int x1 = (int)Math.Ceiling(bounds.Right); 491int y1 = (int)Math.Ceiling(bounds.Bottom);
AlphaFlattener\Optimizer.cs (2)
51int width = (int)Math.Round(m_bounds.Width * Configuration.RasterizationDPI / 96); 52int height = (int)Math.Round(m_bounds.Height * Configuration.RasterizationDPI / 96);
AlphaFlattener\Primitive.cs (2)
767columnCount = (int)Math.Ceiling((bounds.Right - startTile.Left) / startTile.Width); 776rowCount = (int)Math.Ceiling((bounds.Bottom - startTile.Top) / startTile.Height);
AlphaFlattener\Utility.cs (10)
115return Math.Abs(value - 1.0) < Epsilon; 124return Math.Abs(value) < Epsilon; 161double s = Math.Round(scale); 186scale = Math.Sqrt(A); 197x = Math.Abs(x); 198y = Math.Abs(y); 219return y * Math.Sqrt(r * r + 1.0); 235return Math.Max(GetScaleX(trans), GetScaleY(trans)); 1695scale = Math.Min(viewport.Width / viewbox.Width, viewport.Height / viewbox.Height); 1704scale = Math.Max(viewport.Width / viewbox.Width, viewport.Height / viewbox.Height);
MS\Internal\Printing\Configuration\COMPSTUISRID.cs (2)
42resString.Length = Math.Max(0, Math.Min(charCount, resString.Length));
MS\Internal\Printing\Configuration\DevMode.cs (1)
632int charsToWrite = Math.Min(value.Length, maxCharsToWrite - 1);
PrintConfig\FallbackPTProvider.cs (2)
160defaultCopies = Math.Max(minCopies, Math.Min(defaultDevMode.Copies, maxCopies));
PrintConfig\PrintSchemaShim.cs (2)
1183return (short)Math.Max(min, Math.Min(value, max));
PrintConfig\PTProvider.cs (5)
684int bytesToWrite = Math.Min(data.Length, (int)(byteCount - totalBytesWritten)); 738int bytesToRead = Math.Min(data.Length, (int)(byteCount - totalBytesRead)); 826return (int)Math.Max(0, Math.Min(value, int.MaxValue)); 831return (int)Math.Min(value, int.MaxValue);
Serialization\DrawingContextFlattener.cs (12)
473const double PI_OVER_180 = Math.PI / 180; // PI/180 582rAngle = Math.Atan2(rSinArcAngle, rCosArcAngle); 588rAngle += Math.PI * 2; 595rAngle -= Math.PI * 2; 600rCosArcAngle = Math.Cos(rAngle); 601rSinArcAngle = Math.Sin(rAngle); 680rSin = Math.Sqrt(rSin); // = R*cos(a) 681rCos = Math.Sqrt(rCos); // = R*sin(a) 763double rCos = Math.Cos(rRotation); 764double rSin = Math.Sin(rRotation); 785r = Math.Sqrt(rHalfChord2); 799r = Math.Sqrt((1 - rHalfChord2) / rHalfChord2);
Serialization\Manager\ReachSerializationUtils.cs (2)
178System.Windows.DependencyProperty[] newList = new System.Windows.DependencyProperty[Math.Max(List.Length * 2, Count + delta)]; 185List = new System.Windows.DependencyProperty[Math.Max(delta, 2)];
Serialization\VisualSerializer.cs (10)
476scalex = Math.Min(dstwidth / srcwidth, dstheight / srcheight); 481scalex = Math.Max(dstwidth / srcwidth, dstheight / srcheight); 757WriteAttr("RadiusX", Math.Abs(rb.RadiusX * bounds.Width)); 758WriteAttr("RadiusY", Math.Abs(rb.RadiusY * bounds.Height)); 924WriteAttr("StrokeThickness", Math.Abs(pen.Thickness)); 934WriteAttr("StrokeMiterLimit", Math.Max(1.0, pen.MiterLimit)); 956dashes.Add(Math.Abs(d)); 2266WriteAttr("Opacity", Math.Min(Math.Max( opacity, 0.0),1.0)); 2329SetCoordinateFormat(Math.Min(Utility.GetScaleX(mat), Utility.GetScaleY(mat)));
SignalRSamples (2)
Hubs\UploadHub.cs (2)
44return $"{winner} wins with a total of {Math.Max(p1score, p2score)} points to {Math.Min(p1score, p2score)}";
Sockets.FunctionalTests (3)
src\Servers\Kestrel\test\FunctionalTests\MaxRequestBufferSizeTests.cs (2)
149var size = Math.Min(data.Length - bytesWritten, maxSendSize); 242var size = Math.Min(data.Length - bytesWritten, maxSendSize);
src\Servers\Kestrel\test\FunctionalTests\ResponseTests.cs (1)
1103var received = await stream.ReadAsync(receiveBuffer, 0, Math.Min(receiveBuffer.Length, expectedBytes - totalReceived));
Swaggatherer (2)
SwaggathererApplication.cs (2)
257var length = Math.Min(text.Length, Math.Max(5, part.Name.Length));
System.Collections (5)
src\libraries\System.Private.CoreLib\src\System\Collections\HashHelpers.cs (1)
44int limit = (int)Math.Sqrt(candidate);
System\Collections\Generic\PriorityQueue.cs (4)
62Debug.Assert(Log2Arity > 0 && Math.Pow(2, Log2Arity) == Arity); 624newcapacity = Math.Max(newcapacity, _nodes.Length + MinimumGrow); 786int childIndexUpperBound = Math.Min(i + Arity, size); 835int childIndexUpperBound = Math.Min(i + Arity, size);
System.Collections.Concurrent (8)
src\libraries\System.Private.CoreLib\src\System\Collections\HashHelpers.cs (1)
44int limit = (int)Math.Sqrt(candidate);
System\Collections\Concurrent\ConcurrentDictionary.cs (4)
238ICollection<KeyValuePair<TKey, TValue>> c => Math.Max(DefaultCapacity, c.Count), 239IReadOnlyCollection<KeyValuePair<TKey, TValue>> rc => Math.Max(DefaultCapacity, rc.Count), 682_budget = Math.Max(1, newTables._buckets.Length / newTables._locks.Length); 2020_budget = Math.Max(1, newBuckets.Length / newLocks.Length);
System\Collections\Concurrent\PartitionerStatic.cs (3)
451requestedChunkSize = Math.Min(_currentChunkSize.Value * 2, _maxChunkSize); 1101long newSharedIndex = Math.Min(SourceCount - 1, oldSharedIndex + requestedChunkSize); 1370(int quotient, int remainder) = Math.DivRem(SourceCount, partitionCount);
System.Collections.Immutable (11)
src\libraries\System.Private.CoreLib\src\System\Collections\HashHelpers.cs (1)
44int limit = (int)Math.Sqrt(candidate);
System\Collections\Frozen\FrozenHashTable.cs (1)
226Array.Clear(seenBuckets, 0, Math.Min(numBuckets, seenBuckets.Length));
System\Collections\Frozen\String\KeyAnalyzer.cs (1)
74int maxSubstringLength = Math.Min(minLength, MaxSubstringLengthLimit);
System\Collections\Immutable\ImmutableArray_1.Builder.cs (1)
740int newCapacity = Math.Max(_elements.Length * 2, capacity);
System\Collections\Immutable\ImmutableList_1.Node.cs (1)
1537private static byte ParentHeight(Node left, Node right) => checked((byte)(1 + Math.Max(left._height, right._height)));
System\Collections\Immutable\ImmutableSortedDictionary_2.Node.cs (2)
88_height = checked((byte)(1 + Math.Max(left._height, right._height))); 814_height = checked((byte)(1 + Math.Max(_left._height, _right._height)));
System\Collections\Immutable\ImmutableSortedSet_1.Node.cs (2)
90_height = checked((byte)(1 + Math.Max(left._height, right._height))); 797_height = checked((byte)(1 + Math.Max(_left._height, _right._height)));
System\Collections\Immutable\SortedInt32KeyNode.cs (2)
91_height = checked((byte)(1 + Math.Max(left._height, right._height))); 573_height = checked((byte)(1 + Math.Max(_left._height, _right._height)));
System.ComponentModel.TypeConverter (6)
System\ComponentModel\Container.cs (1)
226for (int i = 0; i < Math.Min(_siteCount, _sites!.Length); i++)
System\ComponentModel\EventDescriptorCollection.cs (1)
159int newSize = Math.Max(sizeNeeded, _events.Length * 2);
System\ComponentModel\PropertyDescriptorCollection.cs (1)
166int newSize = Math.Max(sizeNeeded, _properties.Length * 2);
System\Timers\Timer.cs (3)
56double roundedInterval = Math.Ceiling(interval); 139int i = (int)Math.Ceiling(_interval); 156int i = (int)Math.Ceiling(_interval);
System.Console (3)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\TermInfo.Database.cs (1)
240lastEnd = Math.Max(end, lastEnd);
System.Data.Common (88)
System\Data\Common\AdapterUtil.Common.cs (1)
794startIndex = Math.Min(startIndex, index);
System\Data\Common\ByteStorage.cs (3)
95return Math.Sqrt(var); 108min = Math.Min(_values[record], min); 124max = Math.Max(_values[record], max);
System\Data\Common\DBCommandBuilder.cs (1)
241int maxPrefixLength = Math.Max(
System\Data\Common\DbDataAdapter.cs (1)
987int maxBatchCommands = Math.Min(UpdateBatchSize, dataRows.Length);
System\Data\Common\DecimalStorage.cs (3)
98return Math.Sqrt(var); 111min = Math.Min(_values[record], min); 128max = Math.Max(_values[record], max);
System\Data\Common\DoubleStorage.cs (3)
95return Math.Sqrt(var); 108min = Math.Min(_values[record], min); 124max = Math.Max(_values[record], max);
System\Data\Common\Int16Storage.cs (3)
98return Math.Sqrt(var); 112min = Math.Min(_values[record], min); 129max = Math.Max(_values[record], max);
System\Data\Common\Int32Storage.cs (3)
98return Math.Sqrt(var); 111min = Math.Min(_values[record], min); 128max = Math.Max(_values[record], max);
System\Data\Common\Int64Storage.cs (3)
98return Math.Sqrt(var); 111min = Math.Min(_values[record], min); 128max = Math.Max(_values[record], max);
System\Data\Common\ObjectStorage.cs (1)
310Array.Copy(_values, newValues, Math.Min(capacity, _values.Length));
System\Data\Common\SByteStorage.cs (3)
95return Math.Sqrt(var); 108min = Math.Min(_values[record], min); 124max = Math.Max(_values[record], max);
System\Data\Common\SingleStorage.cs (3)
95return Math.Sqrt(var); 109min = Math.Min(_values[record], min); 125max = Math.Max(_values[record], max);
System\Data\Common\SQLTypes\SQLByteStorage.cs (1)
97return Math.Sqrt(var.Value);
System\Data\Common\SQLTypes\SQLDecimalStorage.cs (1)
97return Math.Sqrt(var.Value);
System\Data\Common\SQLTypes\SQLDoubleStorage.cs (1)
97return Math.Sqrt(var.Value);
System\Data\Common\SQLTypes\SQLInt16Storage.cs (1)
97return Math.Sqrt(var.Value);
System\Data\Common\SQLTypes\SQLInt32Storage.cs (1)
97return Math.Sqrt(var.Value);
System\Data\Common\SQLTypes\SQLInt64Storage.cs (1)
97return Math.Sqrt(var.Value);
System\Data\Common\SQLTypes\SQLMoneyStorage.cs (1)
97return Math.Sqrt(var.Value);
System\Data\Common\SQLTypes\SQLSingleStorage.cs (1)
97return Math.Sqrt(var.Value);
System\Data\Common\StringStorage.cs (1)
185Array.Copy(_values, newValues, Math.Min(capacity, _values.Length));
System\Data\Common\TimeSpanStorage.cs (4)
82return TimeSpan.FromTicks((long)Math.Round(sum)); 100return TimeSpan.FromTicks((long)Math.Round(meanSum / meanCount)); 129ulong stDev = (ulong)Math.Round(Math.Sqrt(varSum / (count - 1)));
System\Data\Common\UInt16Storage.cs (3)
98return Math.Sqrt(var); 111min = Math.Min(_values[record], min); 128max = Math.Max(_values[record], max);
System\Data\Common\UInt32Storage.cs (3)
98return Math.Sqrt(var); 111min = Math.Min(_values[record], min); 128max = Math.Max(_values[record], max);
System\Data\Common\UInt64Storage.cs (3)
98return Math.Sqrt(var); 111min = Math.Min(_values[record], min); 128max = Math.Max(_values[record], max);
System\Data\DataColumn.cs (1)
933_maxLength = Math.Max(value, -1);
System\Data\DataError.cs (1)
141int newCapacity = Math.Min(_count * 2, column.Table!.Columns.Count);
System\Data\DataTableReader.cs (2)
368int byteCount = Math.Min(tempBuffer.Length - srcIndex, length); 431int charCount = Math.Min(tempBuffer.Length - srcIndex, length);
System\Data\Filter\BinaryNode.cs (2)
1323DataTypePrecedence higherPrec = (DataTypePrecedence)Math.Max(leftPrecedence, rightPrecedence); 1437DataTypePrecedence higherPrec = (DataTypePrecedence)Math.Max(leftPrecedence, rightPrecedence);
System\Data\Filter\FunctionNode.cs (2)
325return (Math.Abs((long)argumentValues[0])); 327return (Math.Abs((double)argumentValues[0]));
System\Data\ProviderBase\SchemaMapping.cs (2)
299Debug.Assert(_mappedLength == Math.Min(_readerDataValues!.Length, _mappedDataValues!.Length), "incorrect precomputed length"); 1240_mappedLength = Math.Min(count, mappingCount);
System\Data\RecordManager.cs (1)
39Array.Copy(_rows, newRows, Math.Min(_lastFreeRecord, _rows.Length));
System\Data\SQLTypes\SQLBytes.cs (1)
326int count = Math.Min(buffer.Length, (int)(Length - offset));
System\Data\SQLTypes\SQLDecimal.cs (26)
414precision = Math.Max(precision, _bScale); 680double dInt = Math.Floor(dVal); 687dVal = Math.Floor(dInt / s_DUINT_BASE); 693dVal = Math.Floor(dInt / s_DUINT_BASE); 700dVal = Math.Floor(dInt / s_DUINT_BASE); 707dVal = Math.Floor(dInt / s_DUINT_BASE); 766dFrac -= Math.Floor(dFrac); 1138dRet /= System.Math.Pow(10.0, _bScale); 1251ResInteger = Math.Max(x._bPrec - MyScale, y._bPrec - OpScale); 1255ResScale = Math.Max(MyScale, OpScale); 1261ResPrec = Math.Min(MaxPrecision, ResPrec); 1465ResScale = Math.Min((ResPrec - ResInteger), ResScale); 1467ResScale = Math.Max(ResScale, Math.Min(ActualScale, s_cNumeDivScaleMin)); 1688ResScale = Math.Max(x._bScale + y._bPrec + 1, s_cNumeDivScaleMin); 1691MinScale = Math.Min(ResScale, s_cNumeDivScaleMin); 1693ResInteger = Math.Min(ResInteger, s_NUMERIC_MAX_PRECISION); 1700ResScale = Math.Min((ResPrec - ResInteger), ResScale); 1701ResScale = Math.Max(ResScale, MinScale); 2297bNewPrec = (byte)(Math.Min(s_NUMERIC_MAX_PRECISION, Math.Max(1, lAdjust + _bPrec))); 3168lPosition = Math.Min(s_NUMERIC_MAX_PRECISION, lPosition); 3175lPosition = Math.Max(-s_NUMERIC_MAX_PRECISION, lPosition); 3186int lAdjust = Math.Abs(lPosition - n._bScale); // Precision adjustment 3225lAdjust = Math.Abs(lPosition - n._bScale); 3261n = new SqlDecimal(Math.Pow(dBaseNum, exp));
System.Diagnostics.DiagnosticSource (8)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Diagnostics\Metrics\AggregationManager.cs (1)
200double alignUpSecsSinceStart = Math.Ceiling(secsSinceStart / collectionIntervalSecs) *
System\Diagnostics\Metrics\CounterAggregator.cs (1)
21private readonly PaddedDouble[] _deltas = new PaddedDouble[Math.Min(Environment.ProcessorCount, 8)];
System\Diagnostics\Metrics\ExponentialHistogramAggregator.cs (4)
77int mantissaBits = (int)Math.Ceiling(Math.Log(1 / _config.MaxRelativeError, 2)) - 1; 201return Math.Min(Math.Max(0, (int)(quantile * count)), count - 1);
System.Diagnostics.Process (6)
src\libraries\Common\src\System\Collections\Generic\ArrayBuilder.cs (2)
148nextCapacity = Math.Max(capacity + 1, Array.MaxLength); 151nextCapacity = Math.Max(nextCapacity, minimum);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Diagnostics\ProcessWaitState.Unix.cs (2)
427(int)Math.Max(millisecondsTimeout - Stopwatch.GetElapsedTime(startTime).TotalMilliseconds, 0); 538pollingIntervalMs = Math.Min(pollingIntervalMs * 2, MaxPollingIntervalMs);
System.Diagnostics.TextWriterTraceListener (1)
System\Diagnostics\XmlWriterTraceListener.cs (1)
231InternalWrite(Math.Clamp((int)eventType, 0, 255));
System.Drawing.Primitives (32)
System\Drawing\Point.cs (4)
123public static Point Ceiling(PointF value) => new Point(unchecked((int)Math.Ceiling(value.X)), unchecked((int)Math.Ceiling(value.Y))); 133public static Point Round(PointF value) => new Point(unchecked((int)Math.Round(value.X)), unchecked((int)Math.Round(value.Y)));
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\Drawing\RectangleF.cs (8)
273float x1 = Math.Max(a.X, b.X); 274float x2 = Math.Min(a.X + a.Width, b.X + b.Width); 275float y1 = Math.Max(a.Y, b.Y); 276float y2 = Math.Min(a.Y + a.Height, b.Y + b.Height); 297float x1 = Math.Min(a.X, b.X); 298float x2 = Math.Max(a.X + a.Width, b.X + b.Width); 299float y1 = Math.Min(a.Y, b.Y); 300float y2 = Math.Max(a.Y + a.Height, b.Y + b.Height);
System\Drawing\Size.cs (4)
157new Size(unchecked((int)Math.Ceiling(value.Width)), unchecked((int)Math.Ceiling(value.Height))); 174new Size(unchecked((int)Math.Round(value.Width)), unchecked((int)Math.Round(value.Height)));
System.Formats.Asn1 (7)
System\Formats\Asn1\AsnDecoder.cs (1)
641int len = Math.Min(longestPermitted, source.Length);
System\Formats\Asn1\AsnDecoder.Oid.cs (1)
171idx = Math.Max(0, nextStop - ContentByteCount);
System\Formats\Asn1\AsnWriter.BitString.cs (1)
113int fullSegments = Math.DivRem(contentLength, MaxCERContentSize, out int lastContentSize);
System\Formats\Asn1\AsnWriter.cs (1)
542int fullSegments = Math.DivRem(
System\Formats\Asn1\AsnWriter.OctetString.cs (1)
111int fullSegments = Math.DivRem(payload.Length, MaxCERSegmentSize, out int lastSegmentSize);
System\Formats\Asn1\AsnWriter.Oid.cs (1)
176oidValue = oidValue.Slice(Math.Min(oidValue.Length, endIndex + 1));
System\Formats\Asn1\SetOfValueComparer.cs (1)
17int min = Math.Min(x.Length, y.Length);
System.Formats.Tar (13)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Formats\Tar\SeekableSubReadStream.cs (1)
54count = Math.Max(0, (int)(_endInSuperStream - _positionInSuperStream));
System\Formats\Tar\TarHeader.Write.cs (2)
987int numToCopy = Math.Min(bytesToWrite.Length, destination.Length); 1004int numToCopy = Math.Min(bytesToWrite.Length, destination.Length - 1);
System\Formats\Tar\TarHelpers.cs (8)
61byte[] buffer = ArrayPool<byte>.Shared.Rent(minimumLength: (int)Math.Min(MaxBufferLength, bytesToDiscard)); 64int currentLengthToRead = (int)Math.Min(MaxBufferLength, bytesToDiscard); 83byte[] buffer = ArrayPool<byte>.Shared.Rent(minimumLength: (int)Math.Min(MaxBufferLength, bytesToDiscard)); 86int currentLengthToRead = (int)Math.Min(MaxBufferLength, bytesToDiscard); 97byte[] buffer = ArrayPool<byte>.Shared.Rent(minimumLength: (int)Math.Min(MaxBufferLength, bytesToCopy)); 100int currentLengthToRead = (int)Math.Min(MaxBufferLength, bytesToCopy); 113byte[] buffer = ArrayPool<byte>.Shared.Rent(minimumLength: (int)Math.Min(MaxBufferLength, bytesToCopy)); 116int currentLengthToRead = (int)Math.Min(MaxBufferLength, bytesToCopy);
System.IO.Compression (6)
System\IO\Compression\DeflateManaged\InflaterManaged.cs (1)
115bytes = bytes.Slice(0, (int)Math.Min(bytes.Length, _uncompressedSize - _currentInflatedCount));
System\IO\Compression\DeflateManaged\InputBuffer.cs (1)
149int length = Math.Min(output.Length, _buffer.Length);
System\IO\Compression\DeflateManaged\OutputWindow.cs (2)
88length = Math.Min(Math.Min(length, WindowSize - _bytesUsed), input.AvailableBytes);
System\IO\Compression\DeflateZLib\Inflater.cs (1)
101length = (int)Math.Min(length, _uncompressedSize - _currentInflatedCount);
System\IO\Compression\ZipHelper.cs (1)
162int numBytesToSkip = (int)Math.Min(numBytesLeft, buffer.Length);
System.IO.FileSystem.Watcher (2)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System.IO.Hashing (1)
System\IO\Hashing\XxHashShared.cs (1)
456return Math.BigMul(left, right, out lower);
System.IO.Pipelines (8)
System\IO\Pipelines\Pipe.cs (3)
262sizeHint = Math.Max(MinimumSegmentSize, sizeHint); 264int adjustedToMaximumSize = Math.Min(maxBufferSize, sizeHint); 1107int writable = Math.Min(destination.Length, source.Length);
System\IO\Pipelines\PipeReaderStream.cs (1)
126int actual = (int)Math.Min(bufferLength, buffer.Length);
System\IO\Pipelines\StreamPipeReader.cs (2)
537sizeHint = Math.Max(BufferSize, sizeHint); 539int adjustedToMaximumSize = Math.Min(maxBufferSize, sizeHint);
System\IO\Pipelines\StreamPipeWriter.cs (2)
178sizeHint = Math.Max(_minimumBufferSize, sizeHint); 180var adjustedToMaximumSize = Math.Min(maxBufferSize, sizeHint);
System.Linq (15)
System\Linq\Chunk.cs (3)
66TSource[] chunk = new ReadOnlySpan<TSource>(source, index, Math.Min(size, source.Length - index)).ToArray(); 82int arraySize = Math.Min(size, 4); 99arraySize = (int)Math.Min((uint)size, 2 * (uint)array.Length);
System\Linq\SegmentedArrayBuilder.cs (3)
144ReadOnlySpan<T> sourceSlice = sourceSpan.Slice(0, Math.Min(availableSpaceInCurrentSpan, sourceSpan.Length)); 332int newSegmentLength = (int)Math.Min(Math.Max(minimumRequired, currentSegmentLength * 2L), Array.MaxLength);
System\Linq\Select.SpeedOpt.cs (2)
851return _selector(_source[Math.Min(lastIndex, _maxIndexInclusive)]); 868return Math.Min(count - 1, _maxIndexInclusive) - _minIndexInclusive + 1;
System\Linq\SkipTake.SpeedOpt.cs (4)
97return _source[Math.Min(lastIndex, _maxIndexInclusive)]; 114return Math.Min(count - 1, _maxIndexInclusive) - _minIndexInclusive + 1; 258return Math.Max(_source.Count() - _minIndexInclusive, 0); 274return Math.Max((int)count - _minIndexInclusive, 0);
System\Linq\Take.cs (3)
135Debug.Assert(queue.Count == Math.Min(count, startIndex)); 184Math.Max(0, isStartIndexFromEnd ? count - startIndex : startIndex); 187Math.Min(count, isEndIndexFromEnd ? count - endIndex : endIndex);
System.Linq.Expressions (8)
src\libraries\Common\src\System\Collections\Generic\ArrayBuilder.cs (2)
148nextCapacity = Math.Max(capacity + 1, Array.MaxLength); 151nextCapacity = Math.Max(nextCapacity, minimum);
System\Linq\Expressions\Common\CachedReflectionInfo.cs (2)
135s_Math_Pow_Double_Double ??= typeof(Math).GetMethod(nameof(Math.Pow), new[] { typeof(double), typeof(double) })!;
System\Linq\Expressions\Compiler\LambdaCompiler.Statements.cs (1)
419keys.Sort((x, y) => Math.Sign(x.Key - y.Key));
System\Linq\Expressions\DebugViewWriter.cs (1)
203return (Flow)System.Math.Max((int)last, (int)flow);
System\Linq\Expressions\Interpreter\LocalVariables.cs (1)
76_maxLocalCount = Math.Max(_localCount, _maxLocalCount);
System\Runtime\CompilerServices\RuleCache.cs (1)
47int max = Math.Min(_rules.Length, i + count);
System.Linq.Parallel (5)
System\Linq\Parallel\QueryOperators\Binary\ZipQueryOperator.cs (1)
184_count = Math.Min(_leftChildResults.Count, _rightChildResults.Count);
System\Linq\Parallel\QueryOperators\Unary\TakeOrSkipQueryOperator.cs (2)
377return Math.Min(_childCount, _takeOrSkipOp._count); 381return Math.Max(_childCount - _takeOrSkipOp._count, 0);
System\Linq\Parallel\Scheduling\Scheduling.cs (1)
34internal static readonly int DefaultDegreeOfParallelism = Math.Min(Environment.ProcessorCount, MAX_SUPPORTED_DOP);
System\Linq\Parallel\Utils\Sorting.cs (1)
384_sharedBarriers[phase][Math.Min(_partitionIndex, partnerIndex)].SignalAndWait(cancelToken);
System.Memory (4)
src\libraries\Common\src\System\Buffers\ArrayBufferWriter.cs (2)
214int growBy = Math.Max(sizeHint, currentLength); 218growBy = Math.Max(growBy, DefaultInitialBufferSize);
System\Buffers\BuffersExtensions.cs (1)
137int writeSize = Math.Min(destination.Length, input.Length);
System\Buffers\SequenceReader.cs (1)
444int toCopy = Math.Min(nextSpan.Length, destination.Length - copied);
System.Memory.Data (1)
System\BinaryData.cs (1)
311bufferSize = longLength == 0 ? 1 : Math.Min((int)longLength, CopyToBufferSize);
System.Net.Http (48)
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\DynamicTable.cs (1)
83int headCount = Math.Min(_buffer.Length - _removeIndex, _count);
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackDecoder.cs (6)
420int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 458int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 580_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 629dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\QPack\QPackDecoder.cs (2)
287int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex); 373int count = Math.Min(_stringLength - _stringIndex, data.Length - currentIndex);
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (1)
140byteCount = Math.Min(byteCount, limit - ActiveMemory.Length);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Net\Http\Headers\AltSvcHeaderParser.cs (1)
140maxAge = Math.Min(maxAge.GetValueOrDefault(), maxAgeTmp);
System\Net\Http\HttpContent.cs (2)
994Math.Max(value, Array.MaxLength) : 995Math.Max(value, (int)twiceLength);
System\Net\Http\SocketsHttpHandler\ChunkedEncodingReadStream.cs (4)
73int bytesRead = _connection.Read(buffer.Slice(0, (int)Math.Min((ulong)buffer.Length, _chunkBytesRemaining))); 189int bytesRead = await _connection.ReadAsync(buffer.Slice(0, (int)Math.Min((ulong)buffer.Length, _chunkBytesRemaining))).ConfigureAwait(false); 367int bytesToConsume = Math.Min(maxBytesToRead, (int)Math.Min((ulong)connectionBuffer.Length, _chunkBytesRemaining));
System\Net\Http\SocketsHttpHandler\ConnectionPool\RequestQueue.cs (1)
93var newArray = new QueueItem[Math.Max(4, _array.Length * 2)];
System\Net\Http\SocketsHttpHandler\ContentLengthReadStream.cs (2)
184int bytesToConsume = Math.Min(maxBytesToRead, (int)Math.Min((ulong)connectionBuffer.Length, _contentBytesRemaining));
System\Net\Http\SocketsHttpHandler\CreditManager.cs (2)
106int granted = Math.Min(waiter.Amount, _current); 169int granted = Math.Min(amount, _current);
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (2)
434string response = Encoding.ASCII.GetString(_incomingBuffer.ActiveSpan.Slice(0, Math.Min(20, _incomingBuffer.ActiveLength))); 1700int frameSize = Math.Min(remaining.Length, FrameHeader.MaxPayloadLength);
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (3)
484int granted = Math.Min(_availableCredit, _creditWaiter.Amount); 1116int bytesRead = Math.Min(buffer.Length, activeBuffer.Length); 1285sendSize = Math.Min(buffer.Length, _availableCredit);
System\Net\Http\SocketsHttpHandler\Http2StreamWindowManager.cs (2)
114int extendedWindowSize = Math.Min(MaxStreamWindowSize, _streamWindowSize * 2); 273long minRtt = Math.Min(prevRtt, currentRtt.Ticks);
System\Net\Http\SocketsHttpHandler\Http3Connection.cs (2)
765_maxHeaderListSize = (uint)Math.Min((ulong)settingValue, uint.MaxValue); 829long readLength = Math.Min(payloadLength, buffer.ActiveLength);
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (9)
77_headerDecoder = new QPackDecoder(maxHeadersLength: (int)Math.Min(int.MaxValue, _headerBudgetRemaining)); 884int processLength = (int)Math.Min(headersLength, _recvBuffer.ActiveLength); 1084long readLength = Math.Min(payloadLength, _recvBuffer.ActiveLength); 1115int copyLen = (int)Math.Min(buffer.Length, Math.Min(_responseDataPayloadRemaining, _recvBuffer.ActiveLength)); 1135int copyLen = (int)Math.Min(buffer.Length, _responseDataPayloadRemaining); 1187int copyLen = (int)Math.Min(buffer.Length, Math.Min(_responseDataPayloadRemaining, _recvBuffer.ActiveLength)); 1207int copyLen = (int)Math.Min(buffer.Length, _responseDataPayloadRemaining);
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (3)
1709int toCopy = Math.Min(available.Length, buffer.Length); 1913remaining = (int)Math.Min((ulong)_readBuffer.ActiveLength, length); 1931int desiredBufferSize = (int)Math.Min((ulong)bufferSize, length);
System\Net\Http\SocketsHttpHandler\HttpConnectionPoolManager.cs (2)
114long heartBeatInterval = (long)Math.Max(1000, Math.Min(_settings._keepAlivePingDelay.TotalMilliseconds, _settings._keepAlivePingTimeout.TotalMilliseconds) / 4);
System\Net\Http\SocketsHttpHandler\HttpConnectionSettings.cs (1)
139public int MaxResponseHeadersByteLength => (int)Math.Min(int.MaxValue, _maxResponseHeadersLength * 1024L);
System.Net.HttpListener (10)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
35Log.DumpBuffer(IdOf(thisOrContextObject), memberName, buffer.Slice(0, Math.Min(buffer.Length, MaxDumpSize)).ToArray());
System\Net\Managed\ChunkedInputStream.cs (1)
142ares._count = Math.Min(8192, _decoder.ChunkLeft + 6);
System\Net\Managed\HttpListenerRequest.Managed.cs (1)
263length = (int)Math.Min(_contentLength, (long)length);
System\Net\Managed\HttpRequestStream.Managed.cs (6)
76int size = Math.Min(_length, count); 78size = (int)Math.Min(size, _remainingBody); 82size = Math.Min(size, _buffer.Length - _offset); 110size = (int)Math.Min(_remainingBody, (long)size); 149ares._synchRead = Math.Max(0, nread); 158size = (int)Math.Min(_remainingBody, (long)size);
System\Net\Managed\HttpResponseStream.Managed.cs (1)
184int new_count = Math.Min(size, 16384 - (int)ms.Position + (int)start);
System.Net.Mail (7)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Net\BufferedReadStream.cs (2)
53read = Math.Min(count, _storedLength - _storedOffset); 75read = Math.Min(count, _storedLength - _storedOffset);
System\Net\Mail\SmtpReplyReaderFactory.cs (2)
327int left = Math.Min(4 - statusRead, actual); 461int left = Math.Min(4 - _statusRead, actual);
System\Net\Mime\SmtpDateTime.cs (1)
343if (Math.Abs(sanitizedTimeSpan.Ticks) > TimeSpanMaxTicks)
System.Net.NameResolution (1)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
181buffer[0] = (byte)Math.Min(buffer.Length, 255);
System.Net.NetworkInformation (1)
System\Net\NetworkInformation\StringParsingHelpers.Statistics.cs (1)
459return (long)Math.Min(long.MaxValue, ulong.Parse(value, CultureInfo.InvariantCulture));
System.Net.Ping (4)
src\libraries\Common\src\System\Net\NetworkInformation\UnixCommandLinePing.cs (2)
121timeout = Math.DivRem(timeout, millisInSecond, out int remainder); 210return (long)Math.Round(parsedRtt);
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
181buffer[0] = (byte)Math.Min(buffer.Length, 255);
System\Net\NetworkInformation\Ping.PingUtility.cs (1)
140int addressLength = stdout.AsSpan(Math.Max(addressStart, 0)).IndexOfAny(' ', ':');
System.Net.Primitives (8)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
181buffer[0] = (byte)Math.Min(buffer.Length, 255);
System\Net\CookieContainer.cs (3)
423int min_count = Math.Min((int)(domain_count * remainingFraction), Math.Min(m_maxCookiesPerDomain, m_maxCookies) - 1); 1118int length = Math.Min(ll, lr);
System\Net\IPAddressParser.cs (4)
134(uint hundredsAndTens, number) = Math.DivRem(number, 10); 135(hundreds, tens) = Math.DivRem(hundredsAndTens, 10); 143(tens, number) = Math.DivRem(number, 10); 187(scopeId, uint digit) = Math.DivRem(scopeId, 10);
System.Net.Quic (5)
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (1)
140byteCount = Math.Min(byteCount, limit - ActiveMemory.Length);
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
181buffer[0] = (byte)Math.Min(buffer.Length, 255);
src\libraries\Common\src\System\Net\StreamBuffer.cs (2)
112int bytesWritten = Math.Min(buffer.Length, _buffer.AvailableMemory.Length); 205int bytesRead = Math.Min(buffer.Length, _buffer.ActiveMemory.Length);
System\Net\Quic\Internal\ReceiveBuffers.cs (1)
77copied = Math.Min(buffer.Length, activeBuffer.Length);
System.Net.Requests (4)
System\Net\HttpWebResponse.cs (2)
402int readBytes = innerStream.Read(buffer.Slice(0, Math.Min(buffer.Length, maxSize))); 414int readBytes = await innerStream.ReadAsync(buffer.Slice(0, Math.Min(buffer.Length, maxSize)), cancellationToken)
System\Net\ServicePoint\ServicePointManager.cs (1)
90set { s_dnsRefreshTimeout = Math.Max(-1, value); }
System\Net\TimerThread.cs (1)
549Math.Min(unchecked((uint)(nextTick - newNow)), (uint)(int.MaxValue - TickCountResolution)) + TickCountResolution :
System.Net.Security (6)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
35Log.DumpBuffer(IdOf(thisOrContextObject), memberName, buffer.Slice(0, Math.Min(buffer.Length, MaxDumpSize)).ToArray());
System\Net\Security\NegotiateStream.cs (3)
354int copyBytes = Math.Min(_readBufferCount, buffer.Length); 430int copyBytes = Math.Min(_readBufferCount, buffer.Length); 520int chunkBytes = Math.Min(buffer.Length, MaxWriteDataSize);
System\Net\Security\SslStream.IO.cs (2)
591int chunkBytes = Math.Min(buffer.Length, MaxDataSize); 975int copyBytes = Math.Min(_buffer.DecryptedLength, buffer.Length);
System.Net.Sockets (5)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
35Log.DumpBuffer(IdOf(thisOrContextObject), memberName, buffer.Slice(0, Math.Min(buffer.Length, MaxDumpSize)).ToArray());
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
181buffer[0] = (byte)Math.Min(buffer.Length, 255);
System\Net\Sockets\SocketAsyncEngine.Unix.cs (3)
57return Math.Max(1, (int)Math.Round(Environment.ProcessorCount / (double)coresPerEngine)); 102int engineIndex = Math.Abs(Interlocked.Increment(ref s_allocateFromEngine) % s_engines.Length);
System.Net.WebClient (6)
src\libraries\Common\src\System\IO\ChunkedMemoryStream.cs (2)
50int toCopy = Math.Min(remaining, buffer.Length); 90nextChunkLength = (int)Math.Min(count, MaxChunkSize);
System\Net\WebClient.cs (4)
527buffSize = (int)Math.Min(DefaultCopyBufferLength, fs.Length); 540buffSize = (int)Math.Min(DefaultCopyBufferLength, fs.Length); 1435chunkSize = (int)Math.Min((long)DefaultCopyBufferLength, data.Length); 1511chunkSize = (int)Math.Min((long)DefaultCopyBufferLength, buffer.Length);
System.Net.WebSockets (5)
System\Net\WebSockets\Compression\WebSocketDeflater.cs (1)
49_buffer = ArrayPool<byte>.Shared.Rent(Math.Max(payload.Length, MinInitialBufferLength));
System\Net\WebSockets\Compression\WebSocketInflater.cs (1)
83_buffer = ArrayPool<byte>.Shared.Rent((int)Math.Min(userBufferLength, payloadLength));
System\Net\WebSockets\ManagedWebSocket.cs (2)
826int limit = (int)Math.Min(header.Compressed ? _inflater!.Span.Length : payloadBuffer.Length, header.PayloadLength); 830int receiveBufferBytesToCopy = Math.Min(limit, _receiveBufferCount);
System\Net\WebSockets\WebSocket.cs (1)
117return new ArraySegment<byte>(new byte[Math.Max(receiveBufferSize, sendBufferSize)]);
System.Numerics.Tensors (22)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IAggregationOperator.cs (6)
226(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector128<T>.Count); 395(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector256<T>.Count); 564(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector512<T>.Count); 1323(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector128<T>.Count); 1514(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector256<T>.Count); 1705(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector512<T>.Count);
System\Numerics\Tensors\netcore\Tensor.Factory.cs (4)
153values[i] = T.CreateChecked(Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2));
System\Numerics\Tensors\netcore\TensorHelpers.cs (4)
88intermediateShape[^i] = Math.Max(intermediateShape[^i], shape1[^i]); 92intermediateShape[^i] = Math.Max(intermediateShape[^i], shape2[^i]); 101int newShapeIndex = Math.Max(shape1.Length, shape2Length) - 1; 102nint[] newShape = new nint[Math.Max(shape1.Length, shape2Length)];
System\Numerics\Tensors\netcore\TensorPrimitives.CopySign.cs (3)
67Math.Abs(int.MinValue); // throw OverflowException 95Math.Abs(int.MinValue); // throw OverflowException 123Math.Abs(int.MinValue); // throw OverflowException
System\Numerics\Tensors\netcore\TensorSpanHelpers.cs (2)
153(nint Quotient, nint Remainder) result = Math.DivRem(curIndexes[curIndex], length[curIndex]); 173(nint Quotient, nint Remainder) result = Math.DivRem(curIndexes[curIndex], shape[curIndex]);
System\Numerics\Tensors\netcore\TensorSpanHelpers.T.cs (3)
43nuint toClear = Math.Min(len, int.MaxValue); 54nuint toFill = Math.Min(numElements, int.MaxValue); 66nuint toCompare = Math.Min(length, int.MaxValue);
System.Private.CoreLib (530)
src\libraries\Common\src\System\Collections\Concurrent\SingleProducerSingleConsumerQueue.cs (1)
111int newSegmentSize = Math.Min(_tail._array.Length * 2, MaxSegmentSize);
src\libraries\Common\src\System\Collections\Generic\ArrayBuilder.cs (2)
148nextCapacity = Math.Max(capacity + 1, Array.MaxLength); 151nextCapacity = Math.Max(nextCapacity, minimum);
src\libraries\Common\src\System\Number.Formatting.Common.cs (1)
843int zeroes = Math.Min(-digPos, nMaxDigits);
src\libraries\Common\src\System\Number.Parsing.Common.cs (1)
227numberOfTrailingZeros = Math.Min(numberOfTrailingZeros, numberOfFractionalDigits);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
src\libraries\System.Private.CoreLib\src\System\Array.cs (1)
67(uint)Math.Min(newSize, larray.Length));
src\libraries\System.Private.CoreLib\src\System\Buffers\SharedArrayPool.cs (1)
508return Math.Min(partitionCount, Environment.ProcessorCount);
src\libraries\System.Private.CoreLib\src\System\Buffers\StandardFormat.cs (1)
182(div, precision) = Math.DivRem(precision, 10);
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Number.cs (2)
113int numNonLeadingDigitsBeforeDecimalToCopy = Math.Min(numNonLeadingDigitsBeforeDecimal, maxDigitCount); 177int numDigitsAfterDecimalToCopy = Math.Min(srcIndex - startIndexOfDigitsAfterDecimalToCopy, maxDigitCount - dstIndex);
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\Char.cs (4)
1501static char INumberBase<char>.MaxMagnitude(char x, char y) => (char)Math.Max(x, y); 1504static char INumberBase<char>.MaxMagnitudeNumber(char x, char y) => (char)Math.Max(x, y); 1507static char INumberBase<char>.MinMagnitude(char x, char y) => (char)Math.Min(x, y); 1510static char INumberBase<char>.MinMagnitudeNumber(char x, char y) => (char)Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\CodeDom\Compiler\IndentedTextWriter.cs (1)
45set { _indentLevel = Math.Max(value, 0); }
src\libraries\System.Private.CoreLib\src\System\Collections\Concurrent\ConcurrentQueue.cs (2)
97length = (int)Math.Min(BitOperations.RoundUpToPowerOf2((uint)count), MaxSegmentLength); 645int nextSize = tail._preservedForObservation ? InitialSegmentLength : Math.Min(tail.Capacity * 2, MaxSegmentLength);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\Queue.cs (2)
112int firstPart = Math.Min(_array.Length - _head, numToCopy); 409newcapacity = Math.Max(newcapacity, _array.Length + MinimumGrow);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
180int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 190nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
src\libraries\System.Private.CoreLib\src\System\Collections\HashHelpers.cs (1)
44int limit = (int)Math.Sqrt(candidate);
src\libraries\System.Private.CoreLib\src\System\Convert.cs (4)
1305return checked((long)Math.Round(value)); 1422return checked((ulong)Math.Round(value)); 2620(uint newLines, uint remainder) = Math.DivRem(outlen, Base64LineBreakPosition); 2992(int quotient, int remainder) = Math.DivRem(source.Length, 2);
src\libraries\System.Private.CoreLib\src\System\DateTime.cs (7)
889if (Math.Abs(value) > maxUnitCount) 894double integralPart = Math.Truncate(value); 1388(uint y100, uint r1) = Math.DivRem(((uint)(UTicks / TicksPer6Hours) | 3U) + 1224, DaysPer400Years); 1389ulong u2 = Math.BigMul(EafMultiplier, r1 | 3U); 1451ulong u2 = Math.BigMul(EafMultiplier, r1 | 3U); 1528ulong u2 = Math.BigMul(EafMultiplier, r1 | 3U); 1587(uint y100, uint r1) = Math.DivRem(((uint)(UTicks / TicksPer6Hours) | 3U), DaysPer400Years);
src\libraries\System.Private.CoreLib\src\System\Decimal.cs (1)
1273public static decimal Clamp(decimal value, decimal min, decimal max) => Math.Clamp(value, min, max);
src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (63)
182ulong high = Math.BigMul(a, b, out ulong low); 334(ulong quo64, bufNum.Low64) = Math.DivRem(num, den); 376ulong prod = Math.BigMul(quo, (uint)den); // quo * lo divisor 422ulong prod1 = Math.BigMul(quo, bufDen.U0); // quo * lo divisor 423ulong prod2 = Math.BigMul(quo, bufDen.U1); // quo * mid divisor 482ulong tmp = Math.BigMul(bufNum.U0, power); 485tmp += Math.BigMul(bufNum.U1, power); 488tmp += Math.BigMul(bufNum.U2, power); 495ulong tmp = Math.BigMul(bufNum.U0, power); 498tmp += Math.BigMul(bufNum.U1, power); 674(quotient, remainder) = Math.DivRem(high, power); 914low64 = Math.BigMul((uint)low64, UInt32Powers10[scale]); 918low64 = Math.BigMul((uint)low64, TenToPowerNine); 927tmpLow = Math.BigMul((uint)low64, power); 928tmp64 = Math.BigMul((uint)(low64 >> 32), power) + (tmpLow >> 32); 943tmpLow = Math.BigMul((uint)low64, power); 944tmp64 = Math.BigMul((uint)(low64 >> 32), power) + (tmpLow >> 32); 947tmp64 += Math.BigMul(high, power); 979tmp64 += Math.BigMul(rgulNum[cur], power); 1182ulong high = Math.BigMul(pwr, pdecIn.Mid); 1185ulong low = Math.BigMul(pwr, pdecIn.Low); 1270ulong tmpLow = Math.BigMul((uint)low64, power); 1271ulong tmp = Math.BigMul((uint)(low64 >> 32), power) + (tmpLow >> 32); 1274tmp += Math.BigMul(high, power); 1317ulong low64 = Math.BigMul(d1.Low, d2.Low); 1330(low64, ulong remainder) = Math.DivRem(low64, power); 1348tmp = Math.BigMul(d1.Low, d2.Low); 1351tmp = Math.BigMul(d1.Low, d2.Mid) + (tmp >> 32); 1357tmp += Math.BigMul(d1.Low, d2.High); 1372tmp = Math.BigMul(d2.Low, d1.Low); 1375tmp = Math.BigMul(d2.Low, d1.Mid) + (tmp >> 32); 1381tmp += Math.BigMul(d2.Low, d1.High); 1416tmp = Math.BigMul(d1.Low, d2.Low); 1419ulong tmp2 = Math.BigMul(d1.Low, d2.Mid) + (tmp >> 32); 1421tmp = Math.BigMul(d1.Mid, d2.Low); 1429tmp = Math.BigMul(d1.Mid, d2.Mid) + tmp2; 1435tmp2 = Math.BigMul(d1.Low, d2.High); 1441tmp2 = Math.BigMul(d1.High, d2.Low); 1448tmp = Math.BigMul(d1.Mid, d2.High); 1454tmp2 = Math.BigMul(d1.High, d2.Mid); 1461bufProd.High64 = Math.BigMul(d1.High, d2.High) + tmp; 1565mant = (uint)(int)Math.Round(dbl); 1584result.Low64 = Math.BigMul(mant, UInt32Powers10[power]); 1592ulong low64 = Math.BigMul(mant, UInt32Powers10[power - 18]); 1597ulong low64 = Math.BigMul(mant, UInt32Powers10[power - 9]); 1598ulong hi64 = Math.BigMul(TenToPowerNine, (uint)(low64 >> 32)); 1599low64 = Math.BigMul(TenToPowerNine, (uint)low64); 1624(uint div, uint rem) = Math.DivRem(mant, 10000); 1635(uint div, uint rem) = Math.DivRem(mant, 100); 1646(uint div, uint rem) = Math.DivRem(mant, 10); 1729mant = (ulong)(long)Math.Round(dbl); 1749ulong low64 = Math.BigMul((uint)mant, pow10); 1750ulong hi64 = Math.BigMul((uint)(mant >> 32), pow10); 1910curScale = Math.Min(9, -scale); 1954ulong num = Math.BigMul(remainder, power); 2005curScale = Math.Min(9, -scale); 2067curScale = Math.Min(9, -scale); 2187ulong tmp = Math.BigMul(d2.Low, power); 2214ulong tmp = Math.BigMul(bufQuo.U0, power); 2275ulong tmp64 = Math.BigMul(b.Buf24.U0, power); 2280tmp64 += Math.BigMul(buf[i], power); 2364(d.uhi, remainder) = Math.DivRem(n, divisor); 2405(d.uhi, remainder) = Math.DivRem(n, power);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\CounterGroup.cs (3)
257_nextPollingTimeStamp += TimeSpan.FromMilliseconds(_pollingIntervalInMilliseconds * Math.Ceiling(delta.TotalMilliseconds / _pollingIntervalInMilliseconds)); 292millisecondsTillNextPoll = Math.Max(1, millisecondsTillNextPoll); 293sleepDurationInMilliseconds = Math.Min(sleepDurationInMilliseconds, millisecondsTillNextPoll);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventCounter.cs (1)
108payload.StandardDeviation = Math.Sqrt(_sumSquared / _count - _sum * _sum / _count / _count);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (4)
2014int paramCount = Math.Min(eventTypes.typeInfos.Length, args.Length); // parameter count mismatch get logged in LogEventArgsMismatches 2075args = new object?[Math.Min(eventDataCount, metadata.Parameters.Length)]; 2876dataDescrs[1].Size = (uint)Math.Min(dataLeft, chunkSize); 3436EventMetadata[] newValues = new EventMetadata[Math.Max(eventData.Length + 16, eventAttribute.EventId + 1)];
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\NameInfo.cs (1)
26newIdentity = Math.Max(newIdentity, snapshot); // Should be redundant. as we only create descriptors once.
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\XplatEventLogger.cs (1)
90eventDataCount = Math.Min(payloadName.Count, payload.Count);
src\libraries\System.Private.CoreLib\src\System\Double.cs (57)
67public const double E = Math.E; 71public const double Pi = Math.PI; 75public const double Tau = Math.Tau; 579public static double Log2(double value) => Math.Log2(value); 633public static double Exp(double x) => Math.Exp(x); 636public static double ExpM1(double x) => Math.Exp(x) - 1; 639public static double Exp2(double x) => Math.Pow(2, x); 642public static double Exp2M1(double x) => Math.Pow(2, x) - 1; 645public static double Exp10(double x) => Math.Pow(10, x); 648public static double Exp10M1(double x) => Math.Pow(10, x) - 1; 656public static double Ceiling(double x) => Math.Ceiling(x); 682public static double Floor(double x) => Math.Floor(x); 686public static double Round(double x) => Math.Round(x); 689public static double Round(double x, int digits) => Math.Round(x, digits); 692public static double Round(double x, MidpointRounding mode) => Math.Round(x, mode); 695public static double Round(double x, int digits, MidpointRounding mode) => Math.Round(x, digits, mode); 699public static double Truncate(double x) => Math.Truncate(x); 826static double IFloatingPointConstants<double>.E => Math.E; 855public static double Atan2(double y, double x) => Math.Atan2(y, x); 861public static double BitDecrement(double x) => Math.BitDecrement(x); 864public static double BitIncrement(double x) => Math.BitIncrement(x); 868public static double FusedMultiplyAdd(double left, double right, double addend) => Math.FusedMultiplyAdd(left, right, addend); 871public static double Ieee754Remainder(double left, double right) => Math.IEEERemainder(left, right); 874public static int ILogB(double x) => Math.ILogB(x); 881public static double ReciprocalEstimate(double x) => Math.ReciprocalEstimate(x); 885public static double ReciprocalSqrtEstimate(double x) => Math.ReciprocalSqrtEstimate(x); 888public static double ScaleB(double x, int n) => Math.ScaleB(x, n); 899public static double Acosh(double x) => Math.Acosh(x); 903public static double Asinh(double x) => Math.Asinh(x); 907public static double Atanh(double x) => Math.Atanh(x); 911public static double Cosh(double x) => Math.Cosh(x); 915public static double Sinh(double x) => Math.Sinh(x); 919public static double Tanh(double x) => Math.Tanh(x); 934public static double Log(double x) => Math.Log(x); 937public static double Log(double x, double newBase) => Math.Log(x, newBase); 940public static double LogP1(double x) => Math.Log(x + 1); 943public static double Log2P1(double x) => Math.Log2(x + 1); 947public static double Log10(double x) => Math.Log10(x); 950public static double Log10P1(double x) => Math.Log10(x + 1); 988public static double Clamp(double value, double min, double max) => Math.Clamp(value, min, max); 991public static double CopySign(double value, double sign) => Math.CopySign(value, sign); 995public static double Max(double x, double y) => Math.Max(x, y); 1022public static double Min(double x, double y) => Math.Min(x, y); 1048public static int Sign(double value) => Math.Sign(value); 1065public static double Abs(double value) => Math.Abs(value); 1161public static double MaxMagnitude(double x, double y) => Math.MaxMagnitude(x, y); 1191public static double MinMagnitude(double x, double y) => Math.MinMagnitude(x, y); 1497public static double Pow(double x, double y) => Math.Pow(x, y); 1505public static double Cbrt(double x) => Math.Cbrt(x); 1789public static double Sqrt(double x) => Math.Sqrt(x); 1821public static double Acos(double x) => Math.Acos(x); 1831public static double Asin(double x) => Math.Asin(x); 1841public static double Atan(double x) => Math.Atan(x); 1851public static double Cos(double x) => Math.Cos(x); 1962public static double Sin(double x) => Math.Sin(x); 1965public static (double Sin, double Cos) SinCos(double x) => Math.SinCos(x); 2170public static double Tan(double x) => Math.Tan(x);
src\libraries\System.Private.CoreLib\src\System\Globalization\CalendarData.Icu.cs (1)
346occurrences = Math.Max(occurrences, 3);
src\libraries\System.Private.CoreLib\src\System\Globalization\CalendricalCalculationsHelper.cs (16)
37return degree * Math.PI / 180; 42return Math.Sin(RadiansFromDegrees(degree)); 47return Math.Cos(RadiansFromDegrees(degree)); 52return Math.Tan(RadiansFromDegrees(degree)); 67return new DateTime(Math.Min((long)(Math.Floor(numberOfDays) * Calendar.TicksPerDay), DateTime.MaxValue.Ticks)).Year; 106double whole = Math.Floor(divisor / dividend); 151return ((Math.Pow(x, 2) / 41048480) - 15) / SecondsPerDay; 240- (0.5 * Math.Pow(y, 2) * SinOfDegree(4 * lambda)) 241- (1.25 * Math.Pow(eccentricity, 2) * SinOfDegree(2 * anomaly))); 242const double Divisor = 2 * Math.PI; 247return Math.CopySign(Math.Min(Math.Abs(equation), TwelveHours), equation); 366return Math.Min(time, timeSunLastAtLongitude - (MeanSpeedOfSun * longitudeErrorDelta)); 377long lowerBoundNewYearDay = (long)Math.Floor(approx) - 1;
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Icu.cs (4)
362int length = Math.Min(source.Length, prefix.Length); 444int length = Math.Min(source.Length, prefix.Length); 546int length = Math.Min(source.Length, suffix.Length); 629int length = Math.Min(source.Length, suffix.Length);
src\libraries\System.Private.CoreLib\src\System\Globalization\CultureData.Icu.cs (1)
76int length = Math.Min(WINDOWS_MAX_COLLATION_NAME_LENGTH, endOfCollation - collationIndex); // Windows doesn't allow collation names longer than 8 characters
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (8)
464FormatDigits(ref result, hour12, Math.Min(tokenLen, 2)); 469FormatDigits(ref result, dateTime.Hour, Math.Min(tokenLen, 2)); 474FormatDigits(ref result, dateTime.Minute, Math.Min(tokenLen, 2)); 479FormatDigits(ref result, dateTime.Second, Math.Min(tokenLen, 2)); 638FormatDigits(ref result, year, Math.Min(tokenLen, 2)); 824(int tens, int ones) = Math.DivRem(offset.Hours, 10); 1499(int offsetHours, int offsetMinutes) = Math.DivRem(offsetTotalMinutes, 60); 1703(int offsetHours, offsetMinutes) = Math.DivRem(offsetMinutes, 60);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeParse.cs (4)
2713if (!time.TryAddTicks((long)Math.Round(raw.fraction * Calendar.TicksPerSecond), out time)) 3074if (!time.TryAddTicks((long)Math.Round(partSecond * Calendar.TicksPerSecond), out time)) 4742if (!result.parsedDate.TryAddTicks((long)Math.Round(result.fraction * Calendar.TicksPerSecond), out result.parsedDate)) 5087if (!dateTime.TryAddTicks((long)Math.Round(fraction * Calendar.TicksPerSecond), out result.parsedDate))
src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.Icu.cs (1)
22int estimatedLength = (int)Math.Min(count * 3L + 4, StackallocThreshold);
src\libraries\System.Private.CoreLib\src\System\Globalization\InvariantModeCasing.cs (1)
185int length = Math.Min(lengthA, lengthB);
src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Nls.cs (1)
99realLength = Math.Abs(realLength);
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.cs (1)
18int length = Math.Min(lengthA, lengthB);
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.Utf8.cs (6)
23int length = Math.Min(lengthA, lengthB); 111nuint lengthU = Math.Min((uint)lengthA, (uint)lengthB); 176int length = Math.Min(lengthA, lengthB); 336int length = Math.Min(sourceLength, prefixLength); 421nuint lengthU = Math.Min((uint)sourceLength, (uint)prefixLength); 486int length = Math.Min(sourceLength, prefixLength);
src\libraries\System.Private.CoreLib\src\System\Globalization\OrdinalCasing.Icu.cs (1)
191int length = Math.Min(lengthA, lengthB);
src\libraries\System.Private.CoreLib\src\System\Globalization\PersianCalendar.cs (2)
154int y = (int)(Math.Floor(((yearStart - s_persianEpoch) / CalendricalCalculationsHelper.MeanTropicalYearInDays) + 0.5)) + 1; 204year = (int)(Math.Floor(((yearStart - s_persianEpoch) / CalendricalCalculationsHelper.MeanTropicalYearInDays) + 0.5)) + 1;
src\libraries\System.Private.CoreLib\src\System\Globalization\TimeSpanFormat.cs (4)
137(totalSecondsRemaining, fraction64) = Math.DivRem((ulong)ticks, TimeSpan.TicksPerSecond); 181(totalMinutesRemaining, seconds) = Math.DivRem(totalSecondsRemaining, 60 /* seconds per minute */); 189(totalHoursRemaining, minutes) = Math.DivRem(totalMinutesRemaining, 60 /* minutes per hour */); 200(days, hours) = Math.DivRem((uint)totalHoursRemaining, 24 /* hours per day */);
src\libraries\System.Private.CoreLib\src\System\Half.cs (1)
1674public static Half Clamp(Half value, Half min, Half max) => (Half)Math.Clamp((float)value, (float)min, (float)max);
src\libraries\System.Private.CoreLib\src\System\Int16.cs (7)
282public static (short Quotient, short Remainder) DivRem(short left, short right) => Math.DivRem(left, right); 629public static short Clamp(short value, short min, short max) => Math.Clamp(value, min, max); 645Math.ThrowNegateTwosCompOverflow(); 655public static short Max(short x, short y) => Math.Max(x, y); 661public static short Min(short x, short y) => Math.Min(x, y); 667public static int Sign(short value) => Math.Sign(value); 683public static short Abs(short value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\Int32.cs (7)
291public static (int Quotient, int Remainder) DivRem(int left, int right) => Math.DivRem(left, right); 664public static int Clamp(int value, int min, int max) => Math.Clamp(value, min, max); 680Math.ThrowNegateTwosCompOverflow(); 690public static int Max(int x, int y) => Math.Max(x, y); 696public static int Min(int x, int y) => Math.Min(x, y); 702public static int Sign(int value) => Math.Sign(value); 718public static int Abs(int value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\Int64.cs (7)
288public static (long Quotient, long Remainder) DivRem(long left, long right) => Math.DivRem(left, right); 661public static long Clamp(long value, long min, long max) => Math.Clamp(value, min, max); 677Math.ThrowNegateTwosCompOverflow(); 687public static long Max(long x, long y) => Math.Max(x, y); 693public static long Min(long x, long y) => Math.Min(x, y); 699public static int Sign(long value) => Math.Sign(value); 715public static long Abs(long value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (7)
299public static (nint Quotient, nint Remainder) DivRem(nint left, nint right) => Math.DivRem(left, right); 672public static nint Clamp(nint value, nint min, nint max) => Math.Clamp(value, min, max); 688Math.ThrowNegateTwosCompOverflow(); 698public static nint Max(nint x, nint y) => Math.Max(x, y); 704public static nint Min(nint x, nint y) => Math.Min(x, y); 710public static int Sign(nint value) => Math.Sign(value); 726public static nint Abs(nint value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\IO\BinaryReader.cs (2)
265int readLength = Math.Min(MaxCharBytesSize, stringLength - currPos); 286sb ??= StringBuilderCache.Acquire(Math.Min(stringLength, StringBuilderCache.MaxBuilderSize)); // Actual string length in chars may be smaller.
src\libraries\System.Private.CoreLib\src\System\IO\BufferedStream.cs (4)
124byte[] shadowBuffer = new byte[Math.Min(_bufferSize + _bufferSize, MaxShadowBufferSize)]; 448int readbytes = Math.Min(_readLen - _readPos, destination.Length); 768int bytesToWrite = Math.Min(_bufferSize - _writePos, count); 783int bytesToWrite = Math.Min(_bufferSize - _writePos, buffer.Length);
src\libraries\System.Private.CoreLib\src\System\IO\File.cs (6)
1035newLength = (uint)Math.Max(Array.MaxLength, rentedArray.Length + 1); 1238newLength = (uint)Math.Max(Array.MaxLength, buffer.Length + 1); 1287int bytesNeeded = preambleSize + encoding.GetMaxByteCount(Math.Min(contents.Length, ChunkSize)); 1306ReadOnlySpan<char> toEncode = remaining.Slice(0, Math.Min(remaining.Length, ChunkSize)); 1344byte[] bytes = ArrayPool<byte>.Shared.Rent(preambleSize + encoding.GetMaxByteCount(Math.Min(contents.Length, ChunkSize))); 1361ReadOnlyMemory<char> toEncode = remaining.Slice(0, Math.Min(remaining.Length, ChunkSize));
src\libraries\System.Private.CoreLib\src\System\IO\MemoryStream.cs (3)
137int newCapacity = Math.Max(value, 256); 150newCapacity = Math.Max(value, Array.MaxLength); 357int n = Math.Min(_length - _position, buffer.Length);
src\libraries\System.Private.CoreLib\src\System\IO\Path.cs (1)
910sb.EnsureCapacity(Math.Max(relativeTo.Length, path.Length));
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (3)
373int n = Math.Min(_readLen - _readPos, destination.Length); 407bytesFromBuffer = Math.Min(buffer.Length, _readLen - _readPos); 447bytesFromBuffer = Math.Min(_readLen, buffer.Length);
src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs (1)
148bufferSize = (int)Math.Min(bufferSize, remaining);
src\libraries\System.Private.CoreLib\src\System\IO\StreamReader.cs (1)
554int len = Math.Min(_byteLen, preamble.Length);
src\libraries\System.Private.CoreLib\src\System\IO\StreamWriter.cs (2)
440int n = Math.Min(charBuffer.Length - dstPos, count); 791int n = Math.Min(_charLen - _charPos, source.Length - copied);
src\libraries\System.Private.CoreLib\src\System\IO\UnmanagedMemoryStream.cs (1)
371long n = Math.Min(len - pos, buffer.Length);
src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
247long high = Math.BigMul(a, b, out long low);
src\libraries\System.Private.CoreLib\src\System\MathF.cs (4)
49return Math.Abs(x); 248return Math.Max(x, y); 280return Math.Min(x, y); 449return Math.Sign(x);
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (1)
3539nuint length = Math.Min((nuint)(uint)span.Length, (nuint)(uint)other.Length);
src\libraries\System.Private.CoreLib\src\System\Number.BigInteger.cs (2)
465(uint quotient, uint remainder) = Math.DivRem(lhs._blocks[0], rhs._blocks[0]); 484(digit, carry) = Math.DivRem(value, rhsValue);
src\libraries\System.Private.CoreLib\src\System\Number.Dragon4.cs (1)
236int digitExponent = (int)(Math.Ceiling(((int)(mantissaHighBitIdx) + exponent) * Log10V2 - 0.69));
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (36)
615nMaxDigits = Math.Max(number.DigitsCount, DoublePrecision); 726nMaxDigits = Math.Max(number.DigitsCount, SinglePrecision); 821nMaxDigits = Math.Max(number.DigitsCount, HalfPrecision); 1623int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length; 1649int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length; 1678int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value)); 1697int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value)); 1734int bufferLength = Math.Max(digits, 32 - (int)uint.LeadingZeroCount(value)); 1753int bufferLength = Math.Max(digits, 32 - (int)uint.LeadingZeroCount(value)); 1828(value, uint remainder) = Math.DivRem(value, 100); 1870(value, uint remainder) = Math.DivRem(value, 100); 1898(value, remainder) = Math.DivRem(value, 100); 1905(value, remainder) = Math.DivRem(value, 10); 1952int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value)); 1988int bufferLength = Math.Max(digits, countedDigits); 2056int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length; 2082int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length; 2111int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value)); 2130int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value)); 2183int bufferLength = Math.Max(digits, 64 - (int)ulong.LeadingZeroCount(value)); 2202int bufferLength = Math.Max(digits, 64 - (int)ulong.LeadingZeroCount(value)); 2299(value, ulong remainder) = Math.DivRem(value, 100); 2338(value, remainder) = Math.DivRem(value, 100); 2345(value, remainder) = Math.DivRem(value, 10); 2380int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value)); 2415int bufferLength = Math.Max(digits, countedDigits); 2484int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length; 2512int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length; 2543int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits(uValue)); 2564int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits(uValue)); 2593return Int64ToHexChars(buffer, lower, hexBase, Math.Max(digits, 1)); 2606int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value)); 2627int bufferLength = Math.Max(digits, 128 - (int)UInt128.LeadingZeroCount((UInt128)value)); 2656return UInt64ToBinaryChars(buffer, lower, Math.Max(digits, 1)); 2742int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value)); 2756int bufferLength = Math.Max(digits, countedDigits);
src\libraries\System.Private.CoreLib\src\System\Number.Grisu3.cs (3)
628(digit, integrals) = Math.DivRem(integrals, divisor); 807(digit, integrals) = Math.DivRem(integrals, divisor); 890double k = Math.Ceiling((minExponent + DiyFp.SignificandSize - 1) * D1Log210);
src\libraries\System.Private.CoreLib\src\System\Number.NumberToFloatingPointBits.cs (7)
708uint count = Math.Min(remaining, 9); 849(uint topBlockIndex, uint topBlockBits) = Math.DivRem(integerBitsOfPrecision, 32); 993uint positiveExponent = (uint)(Math.Max(0, number.Scale)); 995uint integerDigitsPresent = Math.Min(positiveExponent, totalDigits); 1006int fastExponent = Math.Abs(exponent); 1395ulong high = Math.BigMul(w, Pow5128Table[index], out ulong low); 1401ulong high2 = Math.BigMul(w, Pow5128Table[index + 1], out ulong _);
src\libraries\System.Private.CoreLib\src\System\Number.Parsing.cs (1)
736value = new decimal(0, 0, 0, sign, (byte)Math.Clamp(-e, 0, 28));
src\libraries\System.Private.CoreLib\src\System\Numerics\INumber.cs (1)
29Math.ThrowMinMaxException(min, max);
src\libraries\System.Private.CoreLib\src\System\Numerics\Matrix4x4.cs (2)
383/// <paramref name="fieldOfView" /> is greater than or equal to <see cref="Math.PI" />. 400/// <paramref name="fieldOfView" /> is greater than or equal to <see cref="Math.PI" />.
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector.cs (2)
224/// <seealso cref="Math.Ceiling(double)" /> 636/// <seealso cref="Math.Floor(double)" />
src\libraries\System.Private.CoreLib\src\System\Random.ImplBase.cs (2)
61ulong randomProduct = Math.BigMul(maxValue, xoshiro.NextUInt64(), out ulong lowPart); 69randomProduct = Math.BigMul(maxValue, xoshiro.NextUInt64(), out lowPart);
src\libraries\System.Private.CoreLib\src\System\Random.Net5CompatImpl.cs (1)
264int subtraction = (seed == int.MinValue) ? int.MaxValue : Math.Abs(seed);
src\libraries\System.Private.CoreLib\src\System\Reflection\AssemblyName.cs (1)
353short maxSize = (short)Math.Min(end - i, (int)c_MaxUnicodeCharsReallocate - 1);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\DefaultInterpolatedStringHandler.cs (4)
96Math.Max(MinimumArrayPoolLength, literalLength + (formattedCount * GuessedLengthPerHole)); 631uint newCapacity = Math.Max(requiredMinCapacity, Math.Min((uint)_chars.Length * 2, string.MaxLength)); 632int arraySize = (int)Math.Clamp(newCapacity, MinimumArrayPoolLength, int.MaxValue);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ArrayMarshaller.cs (2)
42int spaceToAllocate = Math.Max(checked(sizeof(TUnmanagedElement) * numElements), 1); 148int spaceToAllocate = Math.Max(bufferSize, 1);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\PointerArrayMarshaller.cs (2)
43int spaceToAllocate = Math.Max(checked(sizeof(TUnmanagedElement) * numElements), 1); 149int spaceToAllocate = Math.Max(bufferSize, 1);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ReadOnlySpanMarshaller.cs (1)
52int spaceToAllocate = Math.Max(checked(sizeof(TUnmanagedElement) * numElements), 1);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\SpanMarshaller.cs (1)
47int spaceToAllocate = Math.Max(checked(sizeof(TUnmanagedElement) * numElements), 1);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NativeMemory.Unix.cs (2)
43nuint adjustedAlignment = Math.Max(alignment, (uint)sizeof(void*)); 104nuint adjustedAlignment = Math.Max(alignment, (uint)sizeof(void*));
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Scalar.cs (11)
145return (T)(object)Math.Abs((double)(object)value); 194return (T)(object)Math.Abs((float)(object)value); 266return (T)(object)Math.Ceiling((double)(object)value); 538return (T)(object)Math.Floor((double)(object)value); 1093return (T)(object)(double)Math.Sqrt((double)(object)value); 1101return (T)(object)(int)Math.Sqrt((int)(object)value); 1105return (T)(object)(long)Math.Sqrt((long)(object)value); 1109return (T)(object)(nint)Math.Sqrt((nint)(object)value); 1113return (T)(object)(nuint)Math.Sqrt((nuint)(object)value); 1129return (T)(object)(uint)Math.Sqrt((uint)(object)value); 1133return (T)(object)(ulong)Math.Sqrt((ulong)(object)value);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.cs (2)
368/// <seealso cref="Math.Ceiling(double)" /> 1565/// <seealso cref="Math.Floor(double)" />
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector256.cs (2)
303/// <seealso cref="Math.Ceiling(double)" /> 1545/// <seealso cref="Math.Floor(double)" />
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector512.cs (2)
303/// <seealso cref="Math.Ceiling(double)" /> 1592/// <seealso cref="Math.Floor(double)" />
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector64.cs (2)
283/// <seealso cref="Math.Ceiling(double)" /> 1342/// <seealso cref="Math.Floor(double)" />
src\libraries\System.Private.CoreLib\src\System\Runtime\MemoryFailPoint.cs (2)
153ulong segmentSize = (ulong)(Math.Ceiling((double)size / s_GCSegmentSize) * s_GCSegmentSize); 157ulong requestedSizeRounded = (ulong)(Math.Ceiling((double)sizeInMegabytes / MemoryCheckGranularity) * MemoryCheckGranularity);
src\libraries\System.Private.CoreLib\src\System\SByte.cs (7)
285public static (sbyte Quotient, sbyte Remainder) DivRem(sbyte left, sbyte right) => Math.DivRem(left, right); 590public static sbyte Clamp(sbyte value, sbyte min, sbyte max) => Math.Clamp(value, min, max); 606Math.ThrowNegateTwosCompOverflow(); 616public static sbyte Max(sbyte x, sbyte y) => Math.Max(x, y); 622public static sbyte Min(sbyte x, sbyte y) => Math.Min(x, y); 628public static int Sign(sbyte value) => Math.Sign(value); 644public static sbyte Abs(sbyte value) => Math.Abs(value);
src\libraries\System.Private.CoreLib\src\System\SearchValues\SearchValues.cs (1)
107? new Any1CharPackedIgnoreCaseSearchValues((char)Math.Max(value0, value1))
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\AhoCorasickNode.cs (1)
145maxValue = Math.Max(maxValue, childChar);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\RabinKarp.cs (1)
47minimumLength = Math.Min(minimumLength, value.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\StringSearchValues.cs (1)
458minLength = Math.Min(minLength, value.Length);
src\libraries\System.Private.CoreLib\src\System\Security\SecureString.Unix.cs (1)
19return Math.Max(length, 1) * sizeof(char);
src\libraries\System.Private.CoreLib\src\System\Single.cs (1)
971public static float Clamp(float value, float min, float max) => Math.Clamp(value, min, max);
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.T.cs (1)
1683char lowerCase = (char)Math.Max(char0, char1);
src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (9)
86int length = Math.Min(strA.Length, strB.Length); 322lengthA = Math.Min(lengthA, strA.Length - indexA); 327lengthB = Math.Min(lengthB, strB.Length - indexB); 357lengthA = Math.Min(lengthA, strA.Length - indexA); 362lengthB = Math.Min(lengthB, strB.Length - indexB); 402int lengthA = Math.Min(length, strA.Length - indexA); 403int lengthB = Math.Min(length, strB.Length - indexB); 483int lengthA = Math.Min(length, strA.Length - indexA); 484int lengthB = Math.Min(length, strB.Length - indexB);
src\libraries\System.Private.CoreLib\src\System\Text\ASCIIEncoding.cs (4)
375int bytesWritten = (int)Ascii.NarrowUtf16ToAscii(pChars, pBytes, (uint)Math.Min(charsLength, bytesLength)); 393int numElementsToConvert = Math.Min(chars.Length, bytes.Length); 666bytesConsumed = (int)Ascii.WidenAsciiToUtf16(pBytes, pChars, (uint)Math.Min(charsLength, bytesLength)); 681int numElementsToConvert = Math.Min(bytes.Length, chars.Length);
src\libraries\System.Private.CoreLib\src\System\Text\CompositeFormat.cs (1)
55argsRequired = Math.Max(argsRequired, segment.ArgIndex + 1);
src\libraries\System.Private.CoreLib\src\System\Text\Latin1Encoding.cs (2)
321int bytesWritten = (int)Latin1Utility.NarrowUtf16ToLatin1(pChars, pBytes, (uint)Math.Min(charsLength, bytesLength)); 621int charsWritten = Math.Min(bytesLength, charsLength);
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (18)
135capacity = Math.Max(capacity, length); 159capacity = Math.Min(DefaultCapacity, maxCapacity); 207persistedCapacity = Math.Min(Math.Max(DefaultCapacity, persistedString.Length), persistedMaxCapacity); 417int capacityToPreserve = Math.Min(Capacity, Math.Max(Length * 6 / 5, m_ChunkChars.Length)); 845int length = Math.Min(m_ChunkChars.Length - m_ChunkLength, count); 849length = Math.Min(m_ChunkChars.Length - m_ChunkLength, count); 908chunkEndIndex = Math.Min(chunkEndIndex, chunk.m_ChunkLength); 2108ReadOnlySpan<char> remainingChunk = chunk.m_ChunkChars.AsSpan(indexInChunk, Math.Min(chunk.m_ChunkLength - indexInChunk, count)); 2144Debug.Assert(oldValue.Length > Math.Min(count, chunk.m_ChunkLength - indexInChunk), 2230int curInChunk = Math.Max(startIndexInChunk, 0); 2231int endInChunk = Math.Min(chunk.m_ChunkLength, endIndexInChunk); 2475int lengthToCopy = Math.Min(lengthInChunk, count); 2561int newBlockLength = Math.Max(minBlockCharCount, Math.Min(Length, MaxChunkSize)); 2669StringBuilder newChunk = new StringBuilder(Math.Max(count, DefaultCapacity), chunk.m_MaxCapacity, chunk.m_ChunkPrevious); 2673int copyCount1 = Math.Min(count, indexInChunk);
src\libraries\System.Private.CoreLib\src\System\Text\TranscodingStream.cs (4)
353int bytesToReturn = Math.Min(_readBufferCount, buffer.Length); 432int bytesToReturn = Math.Min(_readBufferCount, buffer.Length); 484int rentalLength = Math.Clamp(buffer.Length, MinWriteRentedArraySize, MaxWriteRentedArraySize); 560int rentalLength = Math.Clamp(remainingOuterEncodedBytes.Length, MinWriteRentedArraySize, MaxWriteRentedArraySize);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.Transcoding.cs (4)
30nuint numElementsConverted = Ascii.WidenAsciiToUtf16(pInputBuffer, pOutputBuffer, (uint)Math.Min(inputLength, outputCharsRemaining)); 95uint maxIters = Math.Min(remainingInputBytes, (uint)outputCharsRemaining) / (2 * sizeof(uint)); 851nuint numElementsConverted = Ascii.NarrowUtf16ToAscii(pInputBuffer, pOutputBuffer, (uint)Math.Min(inputLength, outputBytesRemaining)); 939uint minElementsRemaining = (uint)Math.Min(inputCharsRemaining, outputBytesRemaining);
src\libraries\System.Private.CoreLib\src\System\Threading\LowLevelLifoSemaphore.cs (1)
226(int)Math.Min(newCounts.SignalCount, (uint)counts.WaiterCount + counts.SpinnerCount) -
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.cs (6)
189_legacy_minIOCompletionThreads = (short)Math.Max(1, ioCompletionThreads); 191short newMinThreads = (short)Math.Max(1, workerThreads); 272_legacy_maxIOCompletionThreads = (short)Math.Min(ioCompletionThreads, MaxPossibleThreadCount); 274short newMaxThreads = (short)Math.Min(workerThreads, MaxPossibleThreadCount); 311workerThreads = Math.Max(0, _maxThreads - counts.NumProcessingWork); 476_memoryUsageBytes = Math.Min(gcMemoryInfo.MemoryLoadBytes, gcMemoryInfo.HighMemoryLoadThresholdBytes);
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.GateThread.cs (1)
294uint nextDelay = Math.Min(nextDelayForGateActivities, nextDelayForBlockingAdjustment);
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.HillClimbing.Complex.cs (1)
35public double Abs() => Math.Sqrt(Real * Real + Imaginary * Imaginary);
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\Threading\PortableThreadPool.ThreadCounts.cs (3)
43SetInt16Value(Math.Max((short)0, value), NumProcessingWorkShift); 61SetInt16Value(Math.Max((short)0, value), NumExistingThreadsShift); 79SetInt16Value(Math.Max((short)1, value), NumThreadsGoalShift);
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.WaitThread.cs (2)
226int handleTimeoutDurationMs = Math.Max(0, registeredWait.TimeoutTimeMs - currentTimeMs); 234timeoutDurationMs = Math.Min(handleTimeoutDurationMs, timeoutDurationMs);
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.WorkerThread.cs (3)
219Math.Max( 221Math.Min(newNumExistingThreads, counts.NumThreadsGoal)); 294newNumExistingThreads = Math.Max(numExistingThreads, newNumProcessingWork);
src\libraries\System.Private.CoreLib\src\System\Threading\ProcessorIdCache.cs (3)
94minID = Math.Min(minID, (double)t / iters); 111minTLS = Math.Min(minTLS, (double)t / iters); 136s_processorIdRefreshRate = Math.Min((int)(minID * 5 / minTLS), MaxIdRefreshRate);
src\libraries\System.Private.CoreLib\src\System\Threading\SemaphoreSlim.cs (1)
791int waitersToNotify = Math.Min(currentCount, waitCount) - m_countOfWaitersPulsedToWake;
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolWorkQueue.cs (1)
371return Math.Max(0, m_tailIndex - m_headIndex);
src\libraries\System.Private.CoreLib\src\System\Threading\Timer.cs (1)
125uint actualDuration = Math.Min(requestedDuration, maxPossibleDuration);
src\libraries\System.Private.CoreLib\src\System\Threading\WaitHandle.cs (2)
222safeWaitHandles = new SafeWaitHandle[Math.Max(capacity, 223Math.Min(MaxWaitHandles, 2 * currentLength))];
src\libraries\System.Private.CoreLib\src\System\TimeSpan.cs (17)
351Int128 totalMicroseconds = Math.BigMul(days, MicrosecondsPerDay) 352+ Math.BigMul(hours, MicrosecondsPerHour) 353+ Math.BigMul(minutes, MicrosecondsPerMinute) 354+ Math.BigMul(seconds, MicrosecondsPerSecond) 355+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond) 387Int128 totalMicroseconds = Math.BigMul(hours, MicrosecondsPerHour) 388+ Math.BigMul(minutes, MicrosecondsPerMinute) 389+ Math.BigMul(seconds, MicrosecondsPerSecond) 390+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond) 421Int128 totalMicroseconds = Math.BigMul(minutes, MicrosecondsPerMinute) 422+ Math.BigMul(seconds, MicrosecondsPerSecond) 423+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond) 453Int128 totalMicroseconds = Math.BigMul(seconds, MicrosecondsPerSecond) 454+ Math.BigMul(milliseconds, MicrosecondsPerMillisecond) 472Int128 totalMicroseconds = Math.BigMul(milliseconds, MicrosecondsPerMillisecond) 783double ticks = Math.Round(timeSpan.Ticks * factor); 798double ticks = Math.Round(timeSpan.Ticks / divisor);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.cs (2)
1201index += (int)Math.Min(t.IsStdCount, t.TypeCount); 1210index += (int)Math.Min(t.IsGmtCount, t.TypeCount);
src\libraries\System.Private.CoreLib\src\System\UInt16.cs (4)
276public static (ushort Quotient, ushort Remainder) DivRem(ushort left, ushort right) => Math.DivRem(left, right); 554public static ushort Clamp(ushort value, ushort min, ushort max) => Math.Clamp(value, min, max); 560public static ushort Max(ushort x, ushort y) => Math.Max(x, y); 566public static ushort Min(ushort x, ushort y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\UInt32.cs (4)
286public static (uint Quotient, uint Remainder) DivRem(uint left, uint right) => Math.DivRem(left, right); 587public static uint Clamp(uint value, uint min, uint max) => Math.Clamp(value, min, max); 593public static uint Max(uint x, uint y) => Math.Max(x, y); 599public static uint Min(uint x, uint y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\UInt64.cs (4)
285public static (ulong Quotient, ulong Remainder) DivRem(ulong left, ulong right) => Math.DivRem(left, right); 586public static ulong Clamp(ulong value, ulong min, ulong max) => Math.Clamp(value, min, max); 592public static ulong Max(ulong x, ulong y) => Math.Max(x, y); 598public static ulong Min(ulong x, ulong y) => Math.Min(x, y);
src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (4)
295public static (nuint Quotient, nuint Remainder) DivRem(nuint left, nuint right) => Math.DivRem(left, right); 605public static nuint Clamp(nuint value, nuint min, nuint max) => Math.Clamp(value, min, max); 611public static nuint Max(nuint x, nuint y) => Math.Max(x, y); 617public static nuint Min(nuint x, nuint y) => Math.Min(x, y);
src\System\Reflection\Emit\RuntimeILGenerator.cs (3)
90m_ILStream = new byte[Math.Max(size, DefaultSize)]; 261byte[] temp = new byte[Math.Max(m_ILStream.Length * 2, m_length + size)]; 333return (int)Math.Min(ushort.MaxValue, m_maxDepth + m_depthAdjustment);
src\System\RuntimeType.CoreCLR.cs (2)
574newSize = Math.Max(Math.Max(4, 2 * cachedMembers.Length), list.Length);
src\System\StubHelpers.cs (1)
446int numChars = Math.Min(managed.Length, length - 1);
System.Private.CoreLib.Generators (3)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
180int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 190nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
System.Private.DataContractSerialization (52)
System\Runtime\Serialization\Json\JsonEncodingStreamWrapper.cs (1)
266int size = Math.Min(_chars.Length, buffer.Length);
System\Runtime\Serialization\Json\XmlJsonReader.cs (1)
755actual = Math.Min(count, value.Length);
System\Runtime\Serialization\SchemaExporter.cs (1)
458return isFlags ? (long)Math.Pow(2, index) : index;
System\Runtime\Serialization\XmlReaderDelegator.cs (1)
793return Math.Min(context.RemainingItemCount, dictionaryReader.Quotas.MaxArrayLength);
System\Xml\ArrayHelper.cs (1)
69count = Math.Min(count, 256);
System\Xml\EncodingStreamWrapper.cs (2)
312int max = offset + Math.Min(count, BufferLength); 470int inputCount = Math.Min(count, BufferLength * 2);
System\Xml\ValueHandle.cs (4)
663actual = Math.Min(_length, count); 673int charCount = Math.Min(count / 3 * 4, _length); 742actualByteCount = Math.Min(charCount, byteCount); 807int charCount = Math.Min(count, _length / sizeof(char));
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\Xml\XmlBinaryReaderSession.cs (3)
43_strings = new XmlDictionaryString[Math.Max(id + 1, 16)]; 47XmlDictionaryString[] newStrings = new XmlDictionaryString[Math.Min(Math.Max(id + 1, _strings.Length * 2), MaxArrayEntries)];
System\Xml\XmlBinaryWriterSession.cs (2)
64IntArray keys = new IntArray(Math.Max(minCount, 16)); 247int[] newArray = new int[Math.Max(index + 1, _array.Length * 2)];
System\Xml\XmlBufferReader.cs (7)
163TryEnsureBytes(Math.Min(count, _windowOffsetMax - offset)); 228byte[] newBuffer = new byte[Math.Max(256, _buffer.Length * 2)]; 230newOffsetMax = Math.Min(newOffsetMax, newBuffer.Length); 284_windowOffsetMax = Math.Max(windowOffset + windowLength, _offsetMax); 872int length = Math.Min(byteLength, charLength); 886int length = Math.Min(byteLength, charLength); 918int length = Math.Min(length1, length2);
System\Xml\XmlCanonicalWriter.cs (3)
346_xmlnsBuffer = new byte[Math.Max(byteCount, 128)]; 350byte[] newBuffer = new byte[Math.Max(_xmlnsOffset + byteCount, _xmlnsBuffer.Length * 2)]; 832int length = Math.Min(length1, length2);
System\Xml\XmlConverter.cs (2)
1073offset += ToCharsD2(Math.Abs(ts.Hours), chars, offset); 1075offset += ToCharsD2(Math.Abs(ts.Minutes), chars, offset);
System\Xml\XmlSigningNodeWriter.cs (1)
360int byteCount = Math.Min(_base64Chars.Length / 4 * 3, count - count % 3);
System\Xml\XmlUTF8TextWriter.cs (2)
654int byteCount = Math.Min(bufferLength / 4 * 3, count - count % 3); 673int byteCount = Math.Min(bufferLength / 4 * 3, count - count % 3);
System.Private.Uri (4)
src\libraries\Common\src\System\Collections\Generic\ArrayBuilder.cs (2)
148nextCapacity = Math.Max(capacity + 1, Array.MaxLength); 151nextCapacity = Math.Max(nextCapacity, minimum);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System.Private.Xml (28)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Xml\Core\XmlReader.cs (1)
1712int bytesToRead = Math.Min(bytes.Length, 2);
System\Xml\Core\XmlTextReaderImpl.cs (1)
2885int bytesToRead = Math.Min(4, _ps.bytes.Length - _ps.bytesUsed);
System\Xml\Core\XmlTextReaderImplAsync.cs (1)
913int bytesToRead = Math.Min(4, _ps.bytes.Length - _ps.bytesUsed);
System\Xml\Core\XmlTextWriter.cs (1)
1450_textWriter.Write(_indentChars, 0, Math.Min(i, _indentChars.Length));
System\Xml\Dom\XmlCharacterData.cs (2)
143count = Math.Max(len - offset, 0); 169count = Math.Max(len - offset, 0);
System\Xml\Schema\BitSet.cs (1)
219int i = Math.Min(_bits.Length, other._bits.Length);
System\Xml\Serialization\ReflectionXmlSerializationWriter.cs (2)
1237for (int j = 0; j < Math.Min(pLength, mapping.Members.Length); j++) 1268for (int j = 0; j < Math.Min(pLength, mapping.Members.Length); j++)
System\Xml\Serialization\XmlSerializationReader.cs (2)
482currentSize = Math.Min(currentSize * 2, MAX_ALLOC_SIZE); 503currentSize = Math.Min(block.Length, total);
System\Xml\XmlConvert.cs (1)
1105double temp = Math.Round(value);
System\Xml\XPath\Internal\NumberFunctions.cs (2)
99return Math.Floor((double)_arg.Evaluate(nodeIterator)); 105return Math.Ceiling((double)_arg.Evaluate(nodeIterator));
System\Xml\Xsl\Runtime\NumberFormatter.cs (1)
82Debug.Assert(Math.Pow(totalChars, MaxAlphabeticLength) >= MaxAlphabeticValue);
System\Xml\Xsl\Runtime\XslNumber.cs (2)
308Debug.Assert(val >= 0 && val == Math.Round(val), "ConvertToArabic operates on non-negative integer numbers only"); 314int newLen = Math.Max(oldLen, minLen);
System\Xml\Xsl\Runtime\XsltFunctions.cs (1)
209double temp = Math.Round(value);
System\Xml\Xsl\Runtime\XsltLibrary.cs (3)
39public static readonly MethodInfo Floor = typeof(Math).GetMethod("Floor", new[] { typeof(double) })!; 40public static readonly MethodInfo Ceiling = typeof(Math).GetMethod("Ceiling", new[] { typeof(double) })!; 578idx += Math.Max(count - 4, 0);
System\Xml\Xsl\XPathConvert.cs (4)
745if (wExp2 >= 1023 && wExp2 <= 1075 && dbl == Math.Floor(dbl)) 992Debug.Assert(dblInt == Math.Floor(dblInt) && 1 <= dblInt && dblInt <= 9007199254740991.0d); 1020Debug.Assert(dblInt == Math.Floor(dblInt) && 0 <= dblInt && dblInt < C10toN[iT]); 1042(idx == mantissaSize - 1) && Math.Abs(mantissa[idx] - mantissaPrec[idx]) <= 1
System\Xml\Xsl\XsltOld\NumberAction.cs (1)
122if (Math.Floor(val) == val)
System.Reflection.Emit (3)
System\Reflection\Emit\ILGeneratorImpl.cs (3)
41_builder = new BlobBuilder(Math.Max(size, DefaultSize)); 48internal int GetMaxStack() => Math.Min(ushort.MaxValue, _maxStackDepth + _depthAdjustment); 250_maxStackDepth = Math.Max(_maxStackDepth, _currentStackDepth);
System.Reflection.Metadata (25)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Reflection\Internal\Utilities\ImmutableMemoryStream.cs (2)
69int result = Math.Min(count, _array.Length - _position); 80int result = Math.Min(buffer.Length, _array.Length - _position);
System\Reflection\Internal\Utilities\MemoryBlock.cs (1)
67displayedBytes = Math.Min(Length, 64);
System\Reflection\Internal\Utilities\ReadOnlyUnmanagedMemoryStream.cs (2)
33int bytesRead = Math.Min(count, _length - _position); 44int bytesRead = Math.Min(buffer.Length, _length - _position);
System\Reflection\Internal\Utilities\StreamExtensions.cs (2)
24byte[] buffer = new byte[Math.Min(StreamCopyBufferSize, size)]; 27int readSize = Math.Min(size, buffer.Length);
System\Reflection\Metadata\BlobBuilder.cs (8)
63_buffer = new byte[Math.Max(MinChunkSize, capacity)]; 68return new BlobBuilder(Math.Max(_buffer.Length, minimalSize)); 236int minLength = Math.Min(left.Length - leftStart, right.Length - rightStart); 287int bytesToCopy = Math.Min(bufferEnd, chunkEnd) - bufferStart; 534var newChunk = AllocateChunk(Math.Max(newLength, MinChunkSize)); 634int bytesToCurrent = Math.Min(FreeBytes, byteCount); 674int bytesToCurrent = Math.Min(FreeBytes, buffer.Length); 712int bytesToCurrent = Math.Min(FreeBytes, byteCount);
System\Reflection\Metadata\Ecma335\Encoding\ControlFlowBuilder.cs (2)
30internal int OperandSize => Math.Min(_instructionEndDisplacement, 4); 303int chunkSize = Math.Min(branch.OperandOffset - srcOffset, srcBlob.Length - srcBlobOffset);
System\Reflection\Metadata\Ecma335\MetadataBuilder.Heaps.cs (3)
24return new HeapBlobBuilder(Math.Max(Math.Max(minimalSize, ChunkCapacity), _capacityExpansion)); 29_capacityExpansion = Math.Max(0, capacity - Count - FreeBytes);
System\Reflection\PortableExecutable\PEBuilder.cs (2)
446length = Math.Min(remainingHeaderToSign, blobLength); 452length = Math.Min(remainingHeader, blobLength);
System\Reflection\PortableExecutable\PEReader.cs (1)
416int size = Math.Min(
System.Reflection.MetadataLoadContext (1)
System\Reflection\TypeLoading\General\HashHelpers.cs (1)
36int limit = (int)Math.Sqrt(candidate);
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net9.0\System.Runtime.Forwards.cs (1)
341[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Math))]
System.Runtime.Caching (18)
System\Runtime\Caching\CacheExpires.cs (3)
142return Math.Max(0, (int)((utcExpires - _utcLastCountReset).Ticks / s_COUNT_INTERVAL.Ticks)); 390newLength = Math.Max(oldLength + MIN_PAGES_INCREMENT, newLength); 391newLength = Math.Min(newLength, oldLength + MAX_PAGES_INCREMENT);
System\Runtime\Caching\CacheMemoryMonitor.cs (2)
119memoryLimit = Math.Min(usableMemory, recommendedPrivateByteLimit); 215percent = Math.Min(100, (int)((cacheSize - _memoryLimit) * 100L / cacheSize));
System\Runtime\Caching\CacheUsage.cs (4)
28Debug.Assert((Math.Abs(entryIndex) & ENTRY_MASK) == (Math.Abs(entryIndex)), "(Math.Abs(entryIndex) & ENTRY_MASK) == Math.Abs(entryIndex)"); 375newLength = Math.Max(oldLength + MIN_PAGES_INCREMENT, newLength); 376newLength = Math.Min(newLength, oldLength + MAX_PAGES_INCREMENT);
System\Runtime\Caching\MemoryCacheStatistics.cs (3)
81int newPollingInterval = Math.Min(_configPollingInterval, MEMORYSTATUS_INTERVAL_30_SECONDS); 116return Math.Max(_physicalMemoryMonitor.GetPercentToTrim(_lastTrimTime, _lastTrimPercent), _cacheMemoryMonitor.GetPercentToTrim(_lastTrimTime, _lastTrimPercent)); 285int percent = Math.Max(minPercent, GetPercentToTrim());
System\Runtime\Caching\MemoryCacheStore.cs (1)
382toTrim = (int)Math.Ceiling(((long)count * (long)percent) / 100D);
System\Runtime\Caching\PhysicalMemoryMonitor.cs (4)
89percent = Math.Min(50, (int)((lastTrimPercent * TargetTotalMemoryTrimIntervalTicks) / ticksSinceTrim)); 90percent = Math.Max(MinTotalMemoryTrimPercent, percent); 108_pressureHigh = Math.Max(3, physicalMemoryLimitPercentage); 109_pressureLow = Math.Max(1, _pressureHigh - 9);
System\Runtime\Caching\PhysicalMemoryMonitor.Unix.cs (1)
45return Math.Max(1, memoryLoad);
System.Runtime.Extensions (1)
System.Runtime.Extensions.cs (1)
21[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Math))]
System.Runtime.Numerics (103)
src\libraries\Common\src\System\Number.Formatting.Common.cs (2)
134(value, uint remainder) = Math.DivRem(value, 10); 843int zeroes = Math.Min(-digPos, nMaxDigits);
src\libraries\Common\src\System\Number.Parsing.Common.cs (1)
227numberOfTrailingZeros = Math.Min(numberOfTrailingZeros, numberOfFractionalDigits);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
180int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 190nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
System\Number.BigInteger.cs (11)
369int remainingIntDigitCount = Math.Max(numberScale - totalDigitCount, 0); 370ReadOnlySpan<byte> intDigitsSpan = chunkDigits.Slice(0, Math.Min(remainingIntDigitCount, chunkDigits.Length)); 433totalDigitCount = Math.Min(number.DigitsCount, numberScale); 450ReadOnlySpan<byte> intDigitsSpan = digitsChunkSpan.Slice(0, Math.Min(remainingIntDigitCount, digitsChunkSpan.Length)); 506int len = Math.Min(bufferSize - i, blockSize * 2); 507int lowerLen = Math.Min(len, blockSize); 567currentBufferSize = Math.Min((int)(bufferSize * digitRatio) + 1, bufferSize); 775int charsIncludeDigits = Math.Max(digits, charsForBits); 919(ulong quo, ulong rem) = Math.DivRem(uuRes, kuBase); 925(uCarry, base1E9Buffer[cuDst++]) = Math.DivRem(uCarry, kuBase); 939int strDigits = Math.Max(digits, valueDigits);
System\Numerics\BigInteger.cs (20)
355int wholeUInt32Count = Math.DivRem(byteCount, 4, out int unalignedBytes); 747(quotient, remainder) = Math.DivRem(dividend._sign, divisor._sign); 829return Log(value, Math.E); 841return Math.Log(value._sign, baseValue); 856return Math.Log(x, baseValue) + (b - 64) / Math.Log(baseValue, 2); 1601double significand = (double)highBits * Math.Pow(10, exponentLow - exponent); 1604double log10 = Math.Log10(significand); 1608significand /= Math.Pow(10, Math.Floor(log10)); 1613significand = Math.Round(significand, 8); 2351size = Math.Max(x.Length, y.Length); 2407size = Math.Max(x.Length, y.Length); 2458size = Math.Max(x.Length, y.Length); 2495(int digitShift, int smallShift) = Math.DivRem(shift, kcbitUint); 2554(int digitShift, int smallShift) = Math.DivRem(shift, kcbitUint); 2587int zl = Math.Max(xl - digitShift, 0) + (trackSignBit ? 1 : 0); 3246(int digitShift, int smallShift) = Math.DivRem(rotateAmount, kcbitUint); 3381(int digitShift, int smallShift) = Math.DivRem(rotateAmount, kcbitUint); 5228(int digitShift, int smallShift) = Math.DivRem(shiftAmount, kcbitUint);
System\Numerics\BigIntegerCalculator.PowMod.cs (2)
218int size = Math.Max(value.Length, bits.Length); 266int size = Math.Max(value.Length, bits.Length);
System\Numerics\Complex.cs (62)
42private static readonly double s_sqrtRescaleThreshold = double.MaxValue / (Math.Sqrt(2.0) + 1.0); 45private static readonly double s_asinOverflowThreshold = Math.Sqrt(double.MaxValue) / 2.0; 48private static readonly double s_log2 = Math.Log(2.0); 64public double Phase { get { return Math.Atan2(m_imaginary, m_real); } } 68return new Complex(magnitude * Math.Cos(phase), magnitude * Math.Sin(phase)); 228if (Math.Abs(d) < Math.Abs(c)) 277if (Math.Abs(d) < Math.Abs(c)) 300a = Math.Abs(a); 301b = Math.Abs(b); 328return (large * Math.Sqrt(1.0 + ratio * ratio)); 350return x * Math.Log(xp1) / (xp1 - 1.0); 354return Math.Log(xp1); 419double p = Math.Exp(value.m_imaginary); 423return new Complex(Math.Sin(value.m_real) * cosh, Math.Cos(value.m_real) * sinh); 440Asin_Internal(Math.Abs(value.Real), Math.Abs(value.Imaginary), out b, out bPrime, out v); 445u = Math.Asin(b); 449u = Math.Atan(bPrime); 460double p = Math.Exp(value.m_imaginary); 464return new Complex(Math.Cos(value.m_real) * cosh, -Math.Sin(value.m_real) * sinh); 476Asin_Internal(Math.Abs(value.Real), Math.Abs(value.Imaginary), out b, out bPrime, out v); 481u = Math.Acos(b); 485u = Math.Atan(1.0 / bPrime); 488if (value.Real < 0.0) u = Math.PI - u; 507double p = Math.Exp(y2); 510if (Math.Abs(value.m_imaginary) <= 4.0) 513double D = Math.Cos(x2) + cosh; 514return new Complex(Math.Sin(x2) / D, sinh / D); 518double D = 1.0 + Math.Cos(x2) / cosh; 519return new Complex(Math.Sin(x2) / cosh / D, Math.Tanh(y2) / D); 598v = s_log2 + Math.Log(big) + 0.5 * Log1P(ratio * ratio); 613bPrime = x / Math.Sqrt((a + x) * amx); 621bPrime = x / y / Math.Sqrt((a + x) * t); 638v = Log1P(am1 + y * Math.Sqrt(t * (a + 1.0))); 643v = Log1P(am1 + Math.Sqrt(am1 * (a + 1.0))); 649v = Math.Log(a + Math.Sqrt((a - 1.0) * (a + 1.0))); 662return new Complex(Math.Log(Abs(value)), Math.Atan2(value.m_imaginary, value.m_real)); 678double expReal = Math.Exp(value.m_real); 679double cosImaginary = expReal * Math.Cos(value.m_imaginary); 680double sinImaginary = expReal * Math.Sin(value.m_imaginary); 692return new Complex(0.0, Math.Sqrt(-value.m_real)); 695return new Complex(Math.Sqrt(value.m_real), 0.0); 727if ((Math.Abs(realCopy) >= s_sqrtRescaleThreshold) || (Math.Abs(imaginaryCopy) >= s_sqrtRescaleThreshold)) 746x = Math.Sqrt((Hypot(realCopy, imaginaryCopy) + realCopy) * 0.5); 751y = Math.Sqrt((Hypot(realCopy, imaginaryCopy) - realCopy) * 0.5); 783double theta = Math.Atan2(valueImaginary, valueReal); 784double newRho = powerReal * theta + powerImaginary * Math.Log(rho); 786double t = Math.Pow(rho, powerReal) * Math.Pow(Math.E, -powerImaginary * theta); 788return new Complex(t * Math.Cos(newRho), t * Math.Sin(newRho));
System.Runtime.Serialization.Formatters (8)
src\libraries\System.Private.CoreLib\src\System\Collections\HashHelpers.cs (1)
44int limit = (int)Math.Sqrt(candidate);
System\Runtime\Serialization\Formatters\Binary\BinaryFormatterWriter.cs (1)
244int numArrayItems = Math.Min(ChunkSize / typeLength, array.Length - arrayOffset);
System\Runtime\Serialization\Formatters\Binary\BinaryParser.cs (1)
887int numArrayItems = Math.Min(ChunkSize / typeLength, array.Length - arrayOffset);
System\Runtime\Serialization\Formatters\Binary\BinaryUtilClasses.cs (4)
262int size = Math.Max(_negObjects.Length * 2, (-index) + 1); 269int size = Math.Max(_objects.Length * 2, index + 1); 339int size = Math.Max(_negObjects.Length * 2, (-index) + 1); 346int size = Math.Max(_objects.Length * 2, index + 1);
System\Runtime\Serialization\FormatterServices.cs (1)
157Array.Resize(ref parentTypes, Math.Max(parentTypeCount * 2, 12));
System.Security.Cryptography (23)
src\libraries\Common\src\System\Security\Cryptography\ECDiffieHellmanDerivation.cs (1)
220int len = Math.Min(p.Length, retSpan.Length);
src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (1)
289Span<byte> nullTerminator = destination.Slice(0, Math.Min(2, destination.Length));
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Security\Cryptography\Base64Transforms.cs (2)
33int inputBlocks = Math.DivRem(inputCount, InputBlockSize, out int inputRemainder); 71int inputBlocks = Math.DivRem(inputCount, InputBlockSize, out int inputRemainder);
System\Security\Cryptography\CryptoStream.cs (1)
315int bytesToCopy = Math.Min(_outputBufferIndex, buffer.Length);
System\Security\Cryptography\LiteHashProvider.cs (2)
125maxRead = Math.Max(maxRead, read); 156maxRead = Math.Max(maxRead, read);
System\Security\Cryptography\LiteHashProvider.Xof.cs (1)
141maxRead = Math.Max(maxRead, read);
System\Security\Cryptography\PemEncoding.cs (1)
324int lineCount = Math.DivRem(encodedDataLength, EncodedLineLength, out int remainder);
System\Security\Cryptography\PKCS1MaskGenerationMethod.cs (1)
52Buffer.BlockCopy(hash, 0, rgbT, ib, Math.Min(rgbT.Length - ib, hash.Length));
System\Security\Cryptography\RandomNumberGenerator.cs (2)
322Span<byte> remainingRandom = randomBuffer.Slice(0, Math.Min(RandomBufferSize, needed)); 342remainingRandom = randomBuffer.Slice(0, Math.Min(RandomBufferSize, needed));
System\Security\Cryptography\SymmetricAlgorithm.cs (2)
323int wholeBlocks = Math.DivRem(plaintextLength, blockSizeBytes, out int remainder) * blockSizeBytes; 402int feedbackAligned = Math.DivRem(plaintextLength, feedbackSizeInBytes, out int remainder) * feedbackSizeInBytes;
System\Security\Cryptography\SymmetricPadding.cs (1)
16int wholeBlocks = Math.DivRem(plaintextLength, paddingSizeInBytes, out int remainder) * paddingSizeInBytes;
System\Security\Cryptography\X509Certificates\CertificatePolicy.cs (1)
222restriction = Math.Min(restriction, policyRestriction.Value);
System\Security\Cryptography\X509Certificates\OpenSslX509ChainProcessor.cs (3)
1382int size = Math.Max(DefaultChainCapacity, errorDepth + 1); 1400LastError = Math.Max(errorDepth, LastError); 1567bucket = Math.DivRem(val, 32, out int localBitNumber);
System\Security\Cryptography\XmlKeyHelper.cs (2)
81int idx = Math.Max(0, buf.Length - sizeof(int)); 144int localLength = Math.Min(ByteLimit, length);
System.Security.Cryptography.Cose (2)
System\Security\Cryptography\Cose\CoseMultiSignMessage.cs (2)
793byte[] buffer = ArrayPool<byte>.Shared.Rent(Math.Max(toBeSignedLength, CoseHelpers.ComputeSignatureSize(signer))); 869byte[] buffer = ArrayPool<byte>.Shared.Rent(Math.Max(toBeSignedLength, CoseHelpers.ComputeSignatureSize(signer)));
System.Text.Encodings.Web (6)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
System\Text\Encodings\Web\TextEncoder.cs (4)
161int minBufferBumpEachIteration = Math.Max(MaxOutputCharactersPerInputCharacter, EncodeStartingOutputBufferSize); 166Span<char> destBuffer = stringBuilder.AppendSpan(Math.Max(remainingInput.Length, minBufferBumpEachIteration)); 520int minBufferBumpEachIteration = Math.Max(MaxOutputCharactersPerInputCharacter, EncodeStartingOutputBufferSize); 521char[] rentedArray = ArrayPool<char>.Shared.Rent(Math.Max(value.Length, minBufferBumpEachIteration));
System.Text.Json (24)
src\libraries\Common\src\System\Text\Json\PooledByteBufferWriter.cs (2)
186sizeHint = Math.Max(sizeHint, MaximumBufferSize - currentLength); 191int growBy = Math.Max(sizeHint, currentLength);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
src\libraries\System.Text.Json\Common\JsonHelpers.cs (1)
117var adjacencyRow = new bool[Math.Max(nodes.Count, count)];
System\Text\Json\BitStack.cs (1)
138int nextDouble = Math.Max(minSize + 1, _array.Length * 2);
System\Text\Json\Document\JsonDocument.Parse.cs (2)
774long expectedLength = Math.Max(utf8Bom.Length, stream.Length - stream.Position) + 1; 857long expectedLength = Math.Max(utf8BomLength, stream.Length - stream.Position) + 1;
System\Text\Json\JsonHelpers.Date.cs (1)
308int fractionEnd = Math.Min(sourceIndex + JsonConstants.DateTimeParseNumFractionDigits, source.Length);
System\Text\Json\Reader\Utf8JsonReader.MultiSegment.cs (4)
555int amountToWrite = Math.Min(span.Length, (int)_bytePositionInLine + 1); 565int amountToWrite = Math.Min(span.Length, (int)_bytePositionInLine + 1); 592int amountToWrite = Math.Min(span.Length, readSoFar.Length - written); 612amountToWrite = Math.Min(span.Length, (int)_bytePositionInLine + 1);
System\Text\Json\Serialization\Converters\Object\ObjectWithParameterizedConstructorConverter.cs (2)
353ArrayPool<FoundProperty>.Shared.Rent(Math.Max(1, state.Current.JsonTypeInfo.PropertyCache!.Count)); 561argumentState.FoundPropertiesAsync = ArrayPool<FoundPropertyAsync>.Shared.Rent(Math.Max(1, state.Current.JsonTypeInfo.PropertyCache!.Count));
System\Text\Json\Serialization\Metadata\JsonTypeInfo.Cache.cs (3)
112int iForward = Math.Min(propertyIndex, count); 267int iForward = Math.Min(parameterIndex, count); 428key |= (ulong)Math.Min(length, 0xff) << 56;
System\Text\Json\Serialization\ReadBufferState.cs (1)
25_buffer = ArrayPool<byte>.Shared.Rent(Math.Max(initialBufferSize, JsonConstants.Utf8Bom.Length));
System\Text\Json\Serialization\WriteStack.cs (2)
314int stackSize = Math.Max(_count, _continuationCount); 352int stackSize = Math.Max(_count, _continuationCount);
System\Text\Json\ThrowHelper.cs (1)
495int printFirst10 = Math.Min(value.Length, 10);
System\Text\Json\Writer\Utf8JsonWriter.cs (2)
1069int sizeHint = Math.Max(DefaultGrowthSize, requiredSize); 1106int sizeHint = Math.Max(InitialGrowthSize, requiredSize);
System.Text.Json.SourceGeneration (1)
src\libraries\System.Text.Json\Common\JsonHelpers.cs (1)
117var adjacencyRow = new bool[Math.Max(nodes.Count, count)];
System.Text.RegularExpressions (37)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
180int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 190nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
System\Text\RegularExpressions\RegexCompiler.cs (3)
102private static readonly MethodInfo s_mathMinIntInt = typeof(Math).GetMethod("Min", [typeof(int), typeof(int)])!; 846int setsToUse = Math.Min(sets.Count, MaxSets); 1090maxDistance = Math.Max(maxDistance, sets[i].Distance);
System\Text\RegularExpressions\RegexFindOptimizations.cs (1)
686int endMinusRequiredLength = textSpan.Length - Math.Max(1, MinRequiredLength);
System\Text\RegularExpressions\RegexInterpreterCode.cs (1)
234string Indent() => new string(' ', Math.Max(1, 25 - sb.Length));
System\Text\RegularExpressions\RegexNode.cs (8)
1279int minLength = Math.Min(startingSpan.Length, startingNode.Str.Length); 2284return (int)Math.Min(int.MaxValue - 1, (long)M * Child(0).ComputeMinLength()); 2294min = Math.Min(min, Child(i).ComputeMinLength()); 2301return Math.Min(Child(0).ComputeMinLength(), Child(1).ComputeMinLength()); 2305return Math.Min(Child(1).ComputeMinLength(), Child(2).ComputeMinLength()); 2316return (int)Math.Min(int.MaxValue - 1, sum); 2420maxLength = Math.Max(maxLength, next); 2432Math.Max(yes, no) :
System\Text\RegularExpressions\RegexParser.cs (1)
1436int c = Math.Min(3, _pattern.Length - _pos);
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\Symbolic\BDD.cs (1)
316m = Math.Max(serialized[i], m);
System\Text\RegularExpressions\Symbolic\BitVector.cs (2)
74(int block, int bit) = Math.DivRem(i, 64); 82(int block, int bit) = Math.DivRem(i, 64);
System\Text\RegularExpressions\Symbolic\RegexNodeConverter.cs (2)
400BDD cond = MapCategoryCodeToCondition((UnicodeCategory)(Math.Abs(categoryCode) - 1)); 427int cat = Math.Abs((int)categoryCode) - 1;
System\Text\RegularExpressions\Symbolic\SparseIntMap.cs (1)
79newLength = Math.Max(2 * _sparse.Length, newLength);
System\Text\RegularExpressions\Symbolic\SymbolicRegexMatcher.Automata.cs (1)
231int newsize = Math.Max(_nfaCoreIdArray.Length * 2, InitialNfaStateCapacity);
System\Text\RegularExpressions\Symbolic\SymbolicRegexNode.cs (2)
2337return (int)Math.Min((long)m + n, int.MaxValue); 2344return (int)Math.Min((long)m * n, int.MaxValue);
System.Text.RegularExpressions.Generator (26)
RegexGenerator.Emitter.cs (2)
1107int setsToUse = Math.Min(sets.Count, MaxSets); 1217maxDistance = Math.Max(maxDistance, sets[i].Distance);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (2)
304int newCapacity = (int)Math.Max( 306Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
180int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 190nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexNode.cs (8)
1279int minLength = Math.Min(startingSpan.Length, startingNode.Str.Length); 2284return (int)Math.Min(int.MaxValue - 1, (long)M * Child(0).ComputeMinLength()); 2294min = Math.Min(min, Child(i).ComputeMinLength()); 2301return Math.Min(Child(0).ComputeMinLength(), Child(1).ComputeMinLength()); 2305return Math.Min(Child(1).ComputeMinLength(), Child(2).ComputeMinLength()); 2316return (int)Math.Min(int.MaxValue - 1, sum); 2420maxLength = Math.Max(maxLength, next); 2432Math.Max(yes, no) :
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexParser.cs (1)
1436int c = Math.Min(3, _pattern.Length - _pos);
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));
Stubs.cs (1)
47int length = Math.Min(span.Length, other.Length);
System.Threading (2)
System\Threading\Barrier.cs (2)
874int waitTime = totalTimeout == Timeout.Infinite ? maxWait : Math.Min(maxWait, totalTimeout); 888maxWait = maxWait >= waitTimeCeiling ? waitTimeCeiling : Math.Min(maxWait << 1, waitTimeCeiling);
System.Threading.Channels (1)
src\libraries\Common\src\System\Collections\Concurrent\SingleProducerSingleConsumerQueue.cs (1)
111int newSegmentSize = Math.Min(_tail._array.Length * 2, MaxSegmentSize);
System.Threading.RateLimiting (3)
System\Threading\RateLimiting\FixedWindowRateLimiter.cs (1)
217int replenishWindow = Math.Max(replenishAmount / _options.PermitLimit, 1);
System\Threading\RateLimiting\TokenBucketRateLimiter.cs (2)
224int replenishPeriods = Math.Max(replenishAmount / _options.TokensPerPeriod, 1); 318_tokenCount = Math.Min(_options.TokenLimit, _tokenCount + add);
System.Threading.Tasks.Dataflow (1)
src\libraries\Common\src\System\Collections\Concurrent\SingleProducerSingleConsumerQueue.cs (1)
111int newSegmentSize = Math.Min(_tail._array.Length * 2, MaxSegmentSize);
System.Threading.Tasks.Parallel (1)
System\Threading\Tasks\Parallel.cs (1)
116rval = (rval == -1) ? schedulerMax : Math.Min(schedulerMax, rval);
System.Windows.Controls.Ribbon (105)
Microsoft\Windows\Controls\KeyTipAdorner.cs (2)
316if (DoubleUtil.LessThan(Math.Abs(keyTipTopY), RibbonGroupKeyTipAxisNudgeSpace)) 321else if (DoubleUtil.LessThan(Math.Abs(itemsPresenter.ActualHeight - keyTipBottomY), RibbonGroupKeyTipAxisNudgeSpace))
Microsoft\Windows\Controls\Ribbon\NativeMethods.cs (1)
596handleCount = Math.Max(0, handleCount);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonContextualTabGroupsPanel.cs (5)
77if (Math.Abs(tabGroupHeader.TabsDesiredWidth - remainingSpace) > _desiredWidthEpsilon) 80width = Math.Min(tabGroupHeader.TabsDesiredWidth, remainingSpace); 93desiredSize.Height = Math.Max(desiredSize.Height, tabGroupHeader.DesiredSize.Height); 113double width = Math.Max(tabGroupHeader.ArrangeWidth,0); 118tabGroupHeader.Arrange(new Rect(startX, y, width, Math.Max(0.0, height - 1)));
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGalleryCategoriesPanel.cs (10)
392maxChildWidth = Math.Max(maxChildWidth, childSize.Width); 393maxChildHeight = Math.Max(maxChildHeight, childSize.Height); 467stackDesiredSize.Width = Math.Max(stackDesiredSize.Width, childDesiredSize.Width); 477stackDesiredSize.Width = Math.Min(stackDesiredSize.Width, constraint.Width); 478stackDesiredSize.Height = Math.Min(stackDesiredSize.Height, constraint.Height); 497logicalVisibleSpace = DoubleUtil.LessThanOrClose((viewportOffsetY + logicalVisibleSpace) - stackDesiredSize.Height, 0.0) ? 0.0 : Math.Min((viewportOffsetY + logicalVisibleSpace) - stackDesiredSize.Height, constraint.Height); 498viewportOffsetY = Math.Max(viewportOffsetY - logicalVisibleSpace, 0.0); 501offset.X = Math.Max(0, Math.Min(offset.X, extent.Width - viewport.Width)); 607rcChild.Width = Math.Max(finalSize.Width, child.DesiredSize.Width);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGalleryItemsPanel.cs (25)
346maxColumnWidth = Math.Max(maxColumnWidth, childSize.Width); 347maxItemHeight = Math.Max(maxItemHeight, childSize.Height); 368columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount); 380columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount); 381arrangeWidth = Math.Max(availableSize.Width / columnCount, maxColumnWidth); 387columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / arrangeWidth), childrenCount)), maxColumnCount); 396columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount); 397_arrangeWidth = Math.Max(availableSize.Width / columnCount, maxColumnWidth); 403columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / _arrangeWidth), childrenCount)), maxColumnCount); 410columnCount = Math.Max(minColumnCount, Math.Min(childrenCount, maxColumnCount)); 419maxRowHeight = Math.Max(maxRowHeight, childSize.Height); 572finalColumnCount = Math.Max(minColumnCount, Math.Min((int)(finalSize.Width / arrangeWidth), maxColumnCount)); 581maxRowHeight = Math.Max(maxRowHeight, children[i].DesiredSize.Height);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGroupItemsPanel.cs (14)
85remainingHeightInColumn = Math.Max(0, finalSize.Height - childDesiredSize.Height); 107columnWidth = Math.Max(columnWidth, arrangeWidth); 138maxStarColumnWidth = Math.Max(maxStarColumnWidth, child.MaxWidth); 143maxStarColumnWidth = Math.Max(maxStarColumnWidth, Math.Min(child.MaxWidth, child.DesiredSize.Width)); 225desiredHeight = Math.Min(Math.Max(desiredHeight, columnHeight), availableSize.Height); 250columnWidth = Math.Max(columnWidth, GetStarChildMinWidth(child as FrameworkElement, ref maxStarColumnWidth)); 254columnWidth = Math.Max(columnWidth, childDesiredSize.Width); 255maxStarColumnWidth = Math.Max(maxStarColumnWidth, columnWidth); 260desiredHeight = Math.Min(Math.Max(desiredHeight, columnHeight), availableSize.Height); 360columnDesiredWidth = Math.Max(columnDesiredWidth, child.DesiredSize.Width); 377desiredWidth += Math.Max((columnDesiredWidth - starLayoutInfo.RequestedStarMinWidth), 0);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGroupsPanel.cs (2)
161remainingSpace = Math.Max(0, remainingSpace - 1); 487double targetValue = Math.Min(basePerStar * starInfo.RequestedStarWeight, starInfo.RequestedStarMaxWidth);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonMenuItemsPanel.cs (3)
142maxChildWidth = Math.Max(availableSize.Width, maxChildWidth); 159double surplusHeight = Math.Max(remainingHeight, 0.0) / _registeredStarLayoutProviders.Count; 176desiredSize.Width = Math.Max(starLayoutTarget.DesiredSize.Width, desiredSize.Width);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonQuickAccessToolBarOverflowPanel.cs (2)
35panelDesiredSize.Height = Math.Max(panelDesiredSize.Height, child.DesiredSize.Height); 54rcChild.Height = Math.Max(finalSize.Height, child.DesiredSize.Height);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonQuickAccessToolBarPanel.cs (2)
223panelDesiredSize.Height = Math.Max(panelDesiredSize.Height, childDesiredSize.Height); 291rcChild.Height = Math.Max(finalSize.Height, child.DesiredSize.Height);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonScrollButtonVisibilityConverter.cs (2)
96double percent = Math.Min(100.0, Math.Max(0.0, (offset * 100.0 / (extent - viewport))));
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonTabHeadersPanel.cs (11)
93_separatorOpacity = Math.Max(0.0, reducePaddingRegularTabHeader * 0.2); 126double availableExtraWidth = Math.Min(desiredExtraPaddingPerTab, availableExtraWidthPerTab); 146if (Math.Abs(desiredSize.Width - availableSize.Width) < _desiredWidthEpsilon) 399desiredSize.Height = Math.Max(desiredSize.Height, ribbonTabHeader.DesiredSize.Height); 416desiredSize.Height = Math.Max(desiredSize.Height, child.DesiredSize.Height); 447double leftPadding = Math.Max(0, ribbonTabHeader.DefaultPadding.Left - (isContextualTab ? reducePaddingContextualTabHeader : reducePaddingRegularTabHeader)); 448double rightPadding = Math.Max(0, ribbonTabHeader.DefaultPadding.Right - (isContextualTab ? reducePaddingContextualTabHeader : reducePaddingRegularTabHeader)); 454desiredSize.Height = Math.Max(desiredSize.Height, ribbonTabHeader.DesiredSize.Height); 465desiredSize.Height = Math.Max(desiredSize.Height, child.DesiredSize.Height); 530return Math.Max(_tabHeaderMinWidth, maxTabHeaderWidth); 1067return Math.Max(0.0, offset);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonTabsPanel.cs (3)
46returnSize = new Size(Math.Max(returnSize.Width, childSize.Width), Math.Max(returnSize.Height, childSize.Height)); 305return Math.Max(0.0, offset);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonTitlePanel.cs (14)
81startContextualTabX = Math.Min(CalculateContextualTabGroupStartX(firstContextualTab), availableSize.Width); 87endContextualTabX = Math.Min(CalculateContextualTabGroupEndX(lastContextualTab), availableSize.Width); 90groupHeaderItemsControl.Measure(new Size(Math.Max(endContextualTabX - startContextualTabX, 0), availableSize.Height)); 92desiredSize.Height = Math.Max(desiredSize.Height, groupHeaderItemsControl.DesiredSize.Height); 127availableToQat = Math.Max(availableToQat, 0); 134desiredSize.Height = Math.Max(desiredSize.Height, qat.DesiredSize.Height); 139endContextualTabX = Math.Max(endContextualTabX, availableToQat); 152availableToTitle = Math.Max(leftSpace, rightSpace); 158availableToTitle = Math.Max(availableToTitle, 0); 162desiredSize.Height = Math.Max(desiredSize.Height, titleHost.DesiredSize.Height); 165desiredSize.Width = Math.Min(desiredSize.Width, availableSize.Width); // Prevent clipping 190startContextualTabX = Math.Min(CalculateContextualTabGroupStartX(firstContextualTab), finalSize.Width); 193endContextualTabX = Math.Min(startContextualTabX + tabGroups.DesiredSize.Width, finalSize.Width); 206endContextualTabX = Math.Max(endContextualTabX, qatDesiredWidth);
Microsoft\Windows\Controls\Ribbon\Ribbon.cs (2)
979if (DoubleUtil.GreaterThan(Math.Abs(_mouseWheelCumulativeDelta), MouseWheelSelectionChangeThreshold)) 1622double screenWidth = Math.Abs(popupPlacementTarget.PointFromScreen(screenRect.BottomRight).X -
Microsoft\Windows\Controls\Ribbon\RibbonTwoLineText.cs (3)
398_textBlock1.Width = Math.Max(1.0, width / 2.0); 415extraLength += Math.Abs(lastCharacter.X - firstCharacter.X); 423extraLength += Math.Abs(lastCharacter.X - firstCharacter.X);
MS\Internal\Generated\DoubleUtil.cs (4)
42double eps = (Math.Abs(value1) + Math.Abs(value2) + 10.0) * DBL_EPSILON; 141return Math.Abs(value - 1.0) < 10.0 * DBL_EPSILON; 154return Math.Abs(value) < 10.0 * DBL_EPSILON;
System.Windows.Input.Manipulations (34)
System\Windows\Input\Manipulations\DoubleUtil.cs (1)
158return Math.Abs(d) <= DBL_EPSILON;
System\Windows\Input\Manipulations\InertiaProcessor2D.cs (9)
618initialTranslationX.AbsoluteOffset = Math.Abs(desiredTranslationXY.X); 619initialTranslationY.AbsoluteOffset = Math.Abs(desiredTranslationXY.Y); 629initialTranslationX.AbsoluteDeceleration = Math.Abs(desiredDecelerationXY.X); 630initialTranslationY.AbsoluteDeceleration = Math.Abs(desiredDecelerationXY.Y); 697state.Duration = 2 * Math.Abs(state.Offset / state.InitialVelocity); 706state.AbsoluteDeceleration = Math.Abs(state.InitialVelocity) / state.Duration; 723state.Duration = Math.Abs(state.InitialVelocity) / state.AbsoluteDeceleration; 1081result = new VectorD(Math.Abs(baseVector.X * scale), 1082Math.Abs(baseVector.Y * scale));
System\Windows\Input\Manipulations\ManipulationSequence.cs (16)
900double oldAngle = Math.Atan2(oldVectorForRotationCalc.Y, oldVectorForRotationCalc.X); 901double newAngle = Math.Atan2(newVectorForRotationCalc.Y, newVectorForRotationCalc.X); 903if (delta > Math.PI) 904delta -= Math.PI * 2.0; 905if (delta < -Math.PI) 906delta += Math.PI * 2.0; 959torqueFactor = (float)Math.Min(1.0, Math.Pow(oldVector.Length / settings.Pivot.Radius, singleManipulatorTorqueFactor)); 1170float value2 = value + (float)(2 * Math.PI); 1171float value3 = value - (float)(2 * Math.PI); 1172float delta = Math.Abs(baseValue - value); 1173if (Math.Abs(baseValue - value2) < delta) 1177else if (Math.Abs(baseValue - value3) < delta) 1344smoothingLevel = Math.Max(0, Math.Min(1, smoothingLevel)); 1347int newHistoryLength = (int)Math.Round(smoothingLevel * MaxHistoryLength);
System\Windows\Input\Manipulations\VectorD.cs (1)
361return Math.Sqrt(LengthSquared);
System\Windows\Input\Manipulations\VectorF.cs (7)
349return (float)Math.Sqrt(LengthSquared); 414double angle = Math.Atan2(vector2.y, vector2.x) - Math.Atan2(vector1.y, vector1.x); 415if (angle > Math.PI) 417angle -= Math.PI * 2.0; 419else if (angle < -Math.PI) 421angle += Math.PI * 2.0;
System.Xaml (1)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Utility\FrugalList.cs (1)
1527int newCapacity = Math.Max(newCount + (newCount >> 2), MINSIZE);
UIAutomationClientSideProviders (27)
MS\Internal\AutomationProxies\WindowsEditBox.cs (4)
369clientLocation.x = Math.Max(clientLocation.x, clientRect.left); 370clientLocation.x = Math.Min(clientLocation.x, clientRect.right); 371clientLocation.y = Math.Max(clientLocation.y, clientRect.top); 372clientLocation.y = Math.Min(clientLocation.y, clientRect.bottom);
MS\Internal\AutomationProxies\WindowsEditBoxRange.cs (13)
134End = Math.Min(Math.Max(End, Start + 1), text.Length); 168End = Math.Min(Math.Max(End, Start + 1), text.Length); 302return text.Substring(Start, maxLength >= 0 ? Math.Min(Length, maxLength) : Length); 476Math.Max(0, _provider.LineFromChar(End) - _provider.LinesPerPage() + 1); 661int height = Math.Abs(_provider.GetLogfont().lfHeight);; 688ArrayList rects = new ArrayList(Math.Max(endLine - startLine + 1, 0)); 783return Math.Round((double)(-logfont.lfHeight) * 72 / lpy); 830moved = Math.Min(count, limit - index); 875moved = Math.Min(count, lineMax - line - 1); 943moved = Math.Max(count, -oneBasedIndex); 988int actualCount = Math.Max(count, -line);
MS\Internal\AutomationProxies\WindowsListView.cs (2)
1050int rowCount = (int) System.Math.Ceiling (((double) itemCount) / columnCount); 1695int future = (int) Math.Round (((si.nMax - deltaPage) - si.nMin) * fScrollPos / 100.0 + si.nMin);
MS\Internal\AutomationProxies\WindowsListViewItem.cs (1)
951clickPoint.x = Math.Min ((itemRectangle.left + 5), (itemRectangle.left + itemRectangle.right) / 2);
MS\Internal\AutomationProxies\WindowsMenu.cs (1)
2324cMoves = Math.Abs (cMoves);
MS\Internal\AutomationProxies\WindowsRichEditRange.cs (4)
82_range.SetRange(Math.Max(charRange.Start, paraRange.Start), Math.Min(charRange.End, paraRange.End)); 165int start = Math.Max(_range.Start, visibleRange.Start); 166int end = Math.Min(_range.End, visibleRange.End);
MS\Internal\AutomationProxies\WindowsScroll.cs (1)
307int newPos = (int) Math.Round (((si.nMax - delta) - si.nMin) * fScrollPos / 100.0 + si.nMin);
MS\Internal\AutomationProxies\WindowsTab.cs (1)
518int newPos = (int) Math.Round ((maxPos - minPos) * horizontalPercent / 100) + minPos;
UIAutomationTypes (3)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\HandleCollector.cs (1)
171handleCount = Math.Max(0, handleCount);
src\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\NativeMethodsCLR.cs (2)
5941int count = Math.Min(bytes.Length, buffer.Length - offset); 5997int count = Math.Min(s.Length, buffer.Length - offset);
WasmAppBuilder (1)
EmccCompile.cs (1)
133int allowedParallelism = DisableParallelCompile ? 1 : Math.Min(SourceFiles.Length, Environment.ProcessorCount);
WindowsFormsIntegration (13)
System\Windows\Integration\ElementHost.cs (2)
320int maxWidth = Math.Min(priorMaxSize.Width, maxElementSize.Width); 321int maxHeight = Math.Min(priorMaxSize.Height, maxElementSize.Height);
System\Windows\Integration\HostUtils.cs (7)
77Math.Max(size1.Width, size2.Width), 78Math.Max(size1.Height, size2.Height)); 84Math.Min(size1.Width, size2.Width), 85Math.Min(size1.Height, size2.Height)); 271(int)Math.Ceiling(element.ActualWidth), 272(int)Math.Ceiling(element.ActualHeight), 397return Math.Abs(value) < 10d * DBL_EPSILON;
System\Windows\Integration\WindowsFormsHost.cs (4)
254returnSize.Width = Math.Min(returnSize.Width, constraint.Width); 255returnSize.Height = Math.Min(returnSize.Height, constraint.Height); 289returnSize.Width = Math.Min(returnSize.Width, finalSize.Width); 290returnSize.Height = Math.Min(returnSize.Height, finalSize.Height);