Click here to Skip to main content
15,886,578 members
Home / Discussions / C#
   

C#

 
AnswerRe: How come I get a rounded number when I multiply doubles?? Pin
ely_bob28-Jul-10 3:43
professionalely_bob28-Jul-10 3:43 
GeneralRe: How come I get a rounded number when I multiply doubles?? Pin
Charvak Karpe28-Jul-10 4:12
Charvak Karpe28-Jul-10 4:12 
GeneralRe: How come I get a rounded number when I multiply doubles?? Pin
ely_bob28-Jul-10 4:32
professionalely_bob28-Jul-10 4:32 
GeneralRe: How come I get a rounded number when I multiply doubles?? Pin
Member 315345731-Jul-10 18:13
Member 315345731-Jul-10 18:13 
AnswerRe: How come I get a rounded number when I multiply doubles?? Pin
Kenneth Kasajian28-Jul-10 8:29
Kenneth Kasajian28-Jul-10 8:29 
GeneralRe: How come I get a rounded number when I multiply doubles?? Pin
PaulLinton28-Jul-10 14:15
PaulLinton28-Jul-10 14:15 
GeneralRe: How come I get a rounded number when I multiply doubles?? Pin
Kenneth Kasajian28-Jul-10 14:42
Kenneth Kasajian28-Jul-10 14:42 
GeneralRe: How come I get a rounded number when I multiply doubles?? Pin
Mitch Hughes29-Jul-10 11:04
professionalMitch Hughes29-Jul-10 11:04 
[Stepping on my soapbox]
When dealing with floating point numbers, you should never assume that a number will be stored exactly. While some numbers can be stored exactly, most will not be.

From the cases I have encountered, too many people assume that a floating point number is good enough for exact numerical needs. But if the value 24.24999999999999 instead of 24.25 would be considered incorrect in your application, you should not be using floating point values.

Time and time again I have been called in to analyze why dollar values were coming in off by a penny or two (or more), and it has always* boiled down to the choice of using floating point representation to store exact values.

* Since 1992 I have encountered only 2 instances where the problem was an actual bug in the library.
AnswerRe: How come I get a rounded number when I multiply doubles?? Pin
sushantpokharel28-Jul-10 20:46
sushantpokharel28-Jul-10 20:46 
AnswerRe: How come I get a rounded number when I multiply doubles?? Pin
Member 315345731-Jul-10 18:08
Member 315345731-Jul-10 18:08 
AnswerRe: How come I get a rounded number when I multiply doubles?? Pin
Member 315345731-Jul-10 18:12
Member 315345731-Jul-10 18:12 
AnswerRe: How come I get a rounded number when I multiply doubles?? Pin
kxal8-Aug-10 18:25
kxal8-Aug-10 18:25 
Questionusing telerik schedule Pin
mrkeivan27-Jul-10 3:54
mrkeivan27-Jul-10 3:54 
AnswerRe: using telerik schedule Pin
Wes Aday27-Jul-10 4:10
professionalWes Aday27-Jul-10 4:10 
GeneralRe: using telerik schedule Pin
mrkeivan27-Jul-10 19:33
mrkeivan27-Jul-10 19:33 
QuestionQuick Linq to XML question Pin
xkrja27-Jul-10 3:05
xkrja27-Jul-10 3:05 
AnswerRe: Quick Linq to XML question Pin
Chris Trelawny-Ross27-Jul-10 5:26
Chris Trelawny-Ross27-Jul-10 5:26 
AnswerRe: Quick Linq to XML question Pin
souidi abderrahman27-Jul-10 21:47
souidi abderrahman27-Jul-10 21:47 
QuestionFetch the content of a website Pin
Krishna Varadharajan27-Jul-10 1:55
Krishna Varadharajan27-Jul-10 1:55 
AnswerRe: Fetch the content of a website Pin
Peace ON27-Jul-10 2:17
Peace ON27-Jul-10 2:17 
GeneralRe: Fetch the content of a website Pin
Krishna Varadharajan27-Jul-10 2:47
Krishna Varadharajan27-Jul-10 2:47 
AnswerRe: Fetch the content of a website Pin
Peace ON27-Jul-10 2:53
Peace ON27-Jul-10 2:53 
GeneralRe: Fetch the content of a website Pin
Krishna Varadharajan27-Jul-10 3:11
Krishna Varadharajan27-Jul-10 3:11 
GeneralRe: Fetch the content of a website Pin
Pete O'Hanlon27-Jul-10 3:01
mvePete O'Hanlon27-Jul-10 3:01 
GeneralRe: Fetch the content of a website Pin
Bernhard Hiller28-Jul-10 21:51
Bernhard Hiller28-Jul-10 21:51 

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.