Click here to Skip to main content

C#

    RSS: RSS Feed
Home > Forums > C#

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page  Show 
  Refresh
GeneralRe: codeproject template empty PinmemberRichard MacCutchan22:13 20 Nov '09  
GeneralRe: codeproject template empty PinmemberRassler486:37 21 Nov '09  
Questionrequest: fixing a codeproject programm Pinmemberno_idea7:40 20 Nov '09  
AnswerRe: request: fixing a codeproject programm PinmvpDaveyM699:18 20 Nov '09  
GeneralRe: request: fixing a codeproject programm Pinmemberno_idea11:16 20 Nov '09  
GeneralRe: request: fixing a codeproject programm PinmvpDaveyM6917:29 20 Nov '09  
GeneralRe: request: fixing a codeproject programm Pinmemberdojohansen11:50 23 Nov '09  
Seeing as it's a graph you should cast it to double. Decimal would work too, but is more expensive and offers no benefit in this application.
 
Try this: Open a new tab. Type "javascript:alert(0.1+0.2)" in the address bar. Now gape at the result, which is close to but not quite 0.3 - and read on to stop gaping.
 
Decimal is a type that can represent decimal numbers accurately. Computer hardware is of course made for working with binary numbers.
 
It is not possible, in general, to represent numbers in different bases accurately using the same number of digits, and sometimes not using *any* number of digits (though it is always possible to represent rational numbers as ratios in any base, and never possible to represent any irrational number as a ratio, in any base). For example, one third is an infinite sequence in base ten (0.33333333...) but it is simply 0.1 in base 3.
 
Decimal is useful in financial applications where it matters that base-ten numbers are exactly represented, but they are comparatively slow since your computer hardware doesn't have instructions to do arithmetics with them. The type must instead provide a software algorithm that manipulates the bits representing a decimal number. By all means, you'll probably never notice any difference, but in general, use double whenever you don't need an exact decimal-number representation. This is a case of drawing a graph, hence of mapping the value in question to a pixel, and it resolutely doesn't matter if it always snaps to the pixel it would have done if you used a decimal, so clearly the correct choice is double. Smile | :)
QuestionAlter table in dataset Pingroupdaniel kuperberg7:36 20 Nov '09  
AnswerRe: Alter table in dataset Pinmemberdojohansen11:53 23 Nov '09  
Questionbetter way to make function returns PinmembernetJP12L7:13 20 Nov '09  
AnswerRe: better way to make function returns Pinmemberstancrm7:15 20 Nov '09  
GeneralRe: better way to make function returns PinmembernetJP12L7:28 20 Nov '09  
GeneralRe: better way to make function returns [modified] PinmemberSaksida Bojan7:34 20 Nov '09  
GeneralRe: better way to make function returns PinmembernetJP12L7:50 20 Nov '09  
GeneralRe: better way to make function returns PinmemberSaksida Bojan7:59 20 Nov '09  
AnswerRe: better way to make function returns Pinmember0x3c07:38 20 Nov '09  
AnswerRe: better way to make function returns Pinmembermusefan8:39 20 Nov '09  
GeneralRe: better way to make function returns PinmembernetJP12L9:34 20 Nov '09  
AnswerRe: better way to make function returns Pinmemberdojohansen11:59 23 Nov '09  
QuestionStream closes while reading a socket Pinmemberjoana.simoes6:11 20 Nov '09  
AnswerRe: Stream closes while reading a socket PinmemberPaulo Zemek6:57 20 Nov '09  
GeneralRe: Stream closes while reading a socket Pinmemberjoana.simoes7:19 20 Nov '09  
GeneralRe: Stream closes while reading a socket PinmemberPaulo Zemek8:44 22 Nov '09  
AnswerRe: Stream closes while reading a socket PinmvpLuc Pattyn7:27 20 Nov '09  
GeneralRe: Stream closes while reading a socket Pinmemberjoana.simoes1:13 23 Nov '09  

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

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


Advertise | Privacy | Mobile
Web01 | 2.5.120210.1 | Last Updated 13 Feb 2012
Copyright © CodeProject, 1999-2012
All Rights Reserved. Terms of Use
Layout: fixed | fluid