Jeff Key

It works on my machine

Sponsors

My Job

My stuff

Old stuff

Useful Stuff

Convert.ToInt32(5.5) != (int)5.5

The documentation clearly states that Convert.ToInt32(double) rounds, but it's not something one would assume.

Have you read the docs today?™
Posted: Sep 11 2004, 02:31 PM by jeffreykey | with 3 comment(s)
Filed under:

Comments

Jeff Atwood said:

CURSE YOU, DECIMAL POINT! YOU ARE AN ENIGMA WRAPPED IN A MYSTERY SLATHERED WITH SECRET SAUCE!
# September 12, 2004 3:47 AM

Julie Lerman said:

you might want to check out the discussion in the comments on this post I wrote about this as it relates to VB6. Basically it's about floating point conversion etc.
http://www.thedatafarm.com/blog/CommentView.aspx?guid=99b9edf1-237e-4ade-91d5-e6d00d186e89
# September 12, 2004 8:49 AM

TrackBack said:

# September 22, 2004 3:33 PM