Search

Wrong logarithm of BigInteger when size of BigInteger exceeds ¼ gigabyte by JeppeSN1

Closed
as Won't Fix Help for as Won't Fix

1
0
Sign in
to vote
Type: Bug
ID: 776946
Opened: 1/18/2013 2:19:44 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
When the size of a (positive) BigInteger (from System.Numerics.dll) exceeds ¼ gigabyte, the logarithm returned by BigInteger.Log is incorrect. In the calculation, an Int32 accidentally overflows and therefore it may become negative.

Please also see http://stackoverflow.com/questions/14402877/ for a discussion of the problem.

This is seen in .NET 4.5 and .NET 4.0.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

.NET Framework 4.5

Steps to reproduce

Run the following Visual C# code:

var i = BigInteger.Pow(256, 300000000);
double log = BigInteger.Log(i);
Console.WriteLine(log);

Product Language

English

Operating System

Windows 7

Operating System Language

Danish

Actual results

A negative value -1313491238.4757 is output. As the number i is not between 0 and 1, its logarithm should not be negative.

Expected results

The value should be positive 1663553233.34387.
Mathematically, equal to 300000000.0 * Math.Log(256.0);
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 2/21/2013 at 7:24 AM
Thank you for your feedback. We are not going to be able to address this issue in our next release due to other priorities.

Regards,
Immo Landwerth
.NET Framework team
Posted by Microsoft on 2/21/2013 at 7:23 AM
Thank you for your feedback. We are not going to be able to address this issue in our next release due to other priorities.

Regards,
Immo Landwerth
.NET Framework team
Posted by Microsoft on 1/20/2013 at 8:28 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 1/18/2013 at 2:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.