Click here to Skip to main content
15,896,153 members

Jeff Bramwell - Professional Profile



Summary

    Blog RSS
2,817
Author
45
Authority
14
Debator
87
Organiser
227
Participant
0
Editor
0
Enquirer
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Reputation

Weekly Data. Recent events may not appear immediately. For information on Reputation please see the FAQ.

Privileges

Members need to achieve at least one of the given member levels in the given reputation categories in order to perform a given action. For example, to store personal files in your account area you will need to achieve Platinum level in either the Author or Authority category. The "If Owner" column means that owners of an item automatically have the privilege. The member types column lists member types who gain the privilege regardless of their reputation level.

ActionAuthorAuthorityDebatorEditorEnquirerOrganiserParticipantIf OwnerMember Types
Have no restrictions on voting frequencysilversilversilversilver
Bypass spam checks when posting contentsilversilversilversilversilversilvergoldSubEditor, Mentor, Protector, Editor
Store personal files in your account areaplatinumplatinumSubEditor, Editor
Have live hyperlinks in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Have the ability to include a biography in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Edit a Question in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Edit an Answer in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Delete a Question in Q&AYesSubEditor, Protector, Editor
Delete an Answer in Q&AYesSubEditor, Protector, Editor
Report an ArticlesilversilversilversilverSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending ArticlegoldgoldgoldgoldSubEditor, Mentor, Protector, Editor
Edit other members' articlesSubEditor, Protector, Editor
Create an article without requiring moderationplatinumSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending QuestionProtector
Approve/Disapprove a pending AnswerProtector
Report a forum messagesilversilverbronzeProtector, Editor
Approve/Disapprove a pending Forum MessageProtector
Have the ability to send direct emails to members in the forumsProtector
Create a new tagsilversilversilversilver
Modify a tagsilversilversilversilver

Actions with a green tick can be performed by this member.


 
Generaldouble.TryParse Sometimes Fails Pin
Jeff Bramwell19-Nov-05 10:39
Jeff Bramwell19-Nov-05 10:39 
I was writing some code to test numeric boundaries for values being inserted into various cells within an application and came across an interesting discovery (at least it's a discovery to me). I set the default minimum and maximum values for a particular method to double.MinValue and double.MaxValue, respectively. If the user attempted to enter a value outside this range a message would be displayed and the value would be set to the minimum or maximum value allowed, depending on which range was exceeded.

What I found out is that the double.TryParse (as well as the double.Parse) method will fail if you attempt to parse out double.MinValue.ToString() or double.MaxValue.ToString(). The decimal.TryParse (within VS2005), as well as decimal.Parse, both succeed when parsing decimal.MinValue or decimal.MaxValue.

Upon further investigation, I noticed something interesting. The MaxValue for a double is returned as "1.79769313486232E+308" when converted to a string. If you print out double.MaxValue in the immediate window, it is returned as 1.7976931348623157E+308. Notice that when it was converted to a string (via ToString) the value has been rounded up which causes the value to exceed a doubles maximum value.

A workaround for this, although not perfect but good enough for most situations, is to drop the final digit (i.e. the "2"). For example:

double.TryParse(double.MaxValue.ToString().Replace("2E", "E"), out value);

There are probably other (more elegant) solutions but I just happened to find this kind of interesting and thought I'd write a post about it since it could cause issues within an application if you are using this approach for testing boundaries.
GeneralC# Class Pin
Jeff Bramwell18-Nov-05 16:04
Jeff Bramwell18-Nov-05 16:04 
GeneralVisual Studio 2005 - FREE Pin
Jeff Bramwell15-Nov-05 1:39
Jeff Bramwell15-Nov-05 1:39 
GeneralGetting back to it all... Pin
Jeff Bramwell11-Oct-05 2:27
Jeff Bramwell11-Oct-05 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.