BigInteger Log10 can produce incorrect result
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 88/100
Línea de trabajo
Comienza en la ubicación de BigInteger.cs enlazada en el issue y reproduce las llamadas genérica y directa a BigInteger.Log10 con BigInteger.Pow(10, 21306). Inspecciona el coeficiente utilizado para la estimación y verifica que la llamada genérica devuelva 21306 sin cambiar el resultado correcto de la llamada directa.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
BigInteger BigInteger.Log10 can produce an incorrect result for the IBinaryInteger<T> implementation. The coefficient 1292913986 / 2^32 is slightly below log10(2), so the estimate can be too small.
Reproduction Steps
using System;
using System.Numerics;
static T IntegerLog10<T>(T value) where T : IBinaryInteger<T> => T.Log10(value);
Console.WriteLine(IntegerLog10(BigInteger.Pow(10, 21306))); // Incorrect, prints 21305
Console.WriteLine(BigInteger.Log10(BigInteger.Pow(10, 21306))); // Correct, prints 21306
Expected behavior
Both should print 21306.
Actual behavior
The first invocation prints 21305, the second line is 21306.
Regression?
No, this API is new in .NET 11.
Known Workarounds
No response
Configuration
.NET SDK:
Version: 11.0.100-rc.1.26425.128
Commit: 3551975be0
Workload version: 11.0.100-manifests.a6e318ce
MSBuild version: 18.11.0-1.26425.128+3551975be
Runtime Environment:
OS Name: Mac OS X
OS Version: 27.0
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/11.0.100-rc.1.26425.128
Other information
This appears to be off-by-one. https://github.com/dotnet/runtime/blob/0598ca0a45c1f29be94f889a1fc6e9b30c40ea64/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs#L3958
it should probably be 1292913987L not 1292913986L.
- Lenguaje dominante
- C#
- Estrellas
- 18.3k
- Forks
- 5.6k
- Merge medio
- 2 d 18 h
- PR fusionados (30 d)
- 617
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dotnet/runtime
-
area-System.Linq untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
dotnet/runtime#134736 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
area-System.Numerics.Tensors untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dotnet/runtime#134691 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
area-System.Threading blocking-clean-ci Known Build Error untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
dotnet/runtime#134679 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
ARM64: conditional compare rejects negative immediates the emitter can already encode as `ccmn`Abiertoarea-CodeGen-coreclr performance
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
dotnet/runtime#134663 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area-System.Security untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
dotnet/runtime#134659 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de dotnet/runtime
Issues similares
-
[Simple] NavigationBar primary commands do not render AppBarButton.Content when it is a UIElementAbiertocontrol/navigationbar kind/bug triage/untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
unoplatform/uno.toolkit.ui#1652 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
microsoft/copilot-camp#1053 ·
Los mantenedores suelen responder en 1 día
-
bug effort:S P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
nightscout/nocturne#1861 ·
Los mantenedores suelen responder en 1 día
-
agentic-workflows area/Docs partner/agentic-workflows
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/fluentui-blazor#5364 ·
Los mantenedores suelen responder en 1 día