Bug 17636 - int.Parse() does not support negative exponents
Summary: int.Parse() does not support negative exponents
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 3.2.x
Hardware: All All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-02-06 10:04 UTC by Martin Midtgaard
Modified: 2014-02-12 09:55 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Short test program that tries to parse "350E-1" (201 bytes, text/plain)
2014-02-06 10:04 UTC, Martin Midtgaard
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Martin Midtgaard 2014-02-06 10:04:23 UTC
Created attachment 5989 [details]
Short test program that tries to parse "350E-1"

Trying to parse "350E-1" should result in 35, but instead I get an exception thrown.

I have attached an example that runs using Microsoft .Net framework, but throws using Mono.
Comment 1 Miguel de Icaza [MSFT] 2014-02-11 18:08:01 UTC
Fixed on master
Comment 2 Martin Midtgaard 2014-02-12 05:50:07 UTC
I don't see it fixed on master!

https://github.com/mono/mono/blob/master/mcs/class/corlib/System/Int32.cs

on line 295 there is a comment saying "negative exponent not valid for Int32" followed by a check for the negativity of the exponent. This code needs to be rewritten to support negative exponents.

If the commit have not been pushed yet, then I apologize and the bug can be set to fixed again, I would though like a commit reference in that case.
Comment 3 Miguel de Icaza [MSFT] 2014-02-12 09:55:20 UTC
.
Comment 4 Miguel de Icaza [MSFT] 2014-02-12 09:55:31 UTC
.