Click here to Skip to main content
15,896,912 members
Home / Discussions / C#
   

C#

 
GeneralRe: Best way to validate dates? Pin
house1-Nov-04 2:55
house1-Nov-04 2:55 
GeneralRe: Best way to validate dates? Pin
Luis Alonso Ramos1-Nov-04 5:31
Luis Alonso Ramos1-Nov-04 5:31 
AnswerRe: Best way to validate dates? Pin
Nick Parker29-Oct-04 14:20
protectorNick Parker29-Oct-04 14:20 
QuestionHow to initially set the focus to a control Pin
Luis Alonso Ramos29-Oct-04 9:28
Luis Alonso Ramos29-Oct-04 9:28 
AnswerRe: How to initially set the focus to a control Pin
Luis Alonso Ramos29-Oct-04 9:44
Luis Alonso Ramos29-Oct-04 9:44 
GeneralC# Double arithmetic producing unstable answers Pin
ldself29-Oct-04 7:46
ldself29-Oct-04 7:46 
GeneralRe: C# Double arithmetic producing unstable answers Pin
Nick Parker29-Oct-04 8:15
protectorNick Parker29-Oct-04 8:15 
GeneralRe: C# Double arithmetic producing unstable answers Pin
Hugo Migneron29-Oct-04 8:17
Hugo Migneron29-Oct-04 8:17 
Hi there,
The reason why 0.3/0.2 does not give an exact result is the following :
C# (and every other compiler) represents your variables in binary values.
For example:
2 is represented by 10 in binary which stands for (1*2^1 + 0*2^0)
4 100 (1*2^2 + 0*2^1 + 0*2^0)
30 11110 (1*2^4 + 1*2^3 + 1*2^2 + 1*2^1 + 0*2^0)
and so on
for values like 0.3, the binary value is not exact, because it is impossible to represent it exactly with this notation...
0.3 is 0,01001100110011... but the number never ends.
Since a double value is represented with 64 0 and 1, you loose a little precision in your operations. There is no real way to avoid this unfortunatly.

I hope this helps
GeneralRe: C# Double arithmetic producing unstable answers Pin
Nick Parker29-Oct-04 15:08
protectorNick Parker29-Oct-04 15:08 
Generalstructs and 'using' Pin
Nemanja Trifunovic29-Oct-04 6:47
Nemanja Trifunovic29-Oct-04 6:47 
GeneralRe: structs and 'using' Pin
leppie29-Oct-04 9:02
leppie29-Oct-04 9:02 
GeneralRe: structs and 'using' Pin
Nemanja Trifunovic29-Oct-04 9:14
Nemanja Trifunovic29-Oct-04 9:14 
GeneralRe: structs and 'using' Pin
Ketty Avashia29-Oct-04 9:27
Ketty Avashia29-Oct-04 9:27 
GeneralRe: structs and 'using' Pin
Nemanja Trifunovic29-Oct-04 9:42
Nemanja Trifunovic29-Oct-04 9:42 
GeneralI got an answer on a C# newsgroup Pin
Nemanja Trifunovic29-Oct-04 10:00
Nemanja Trifunovic29-Oct-04 10:00 
GeneralRe: structs and 'using' Pin
Ami Bar29-Oct-04 12:16
Ami Bar29-Oct-04 12:16 
GeneralRe: structs and 'using' Pin
Nemanja Trifunovic29-Oct-04 12:27
Nemanja Trifunovic29-Oct-04 12:27 
GeneralRe: structs and 'using' Pin
Ami Bar29-Oct-04 12:51
Ami Bar29-Oct-04 12:51 
GeneralCant not get the ListView TextAlign Property to center Pin
Tony D. Abel29-Oct-04 5:37
Tony D. Abel29-Oct-04 5:37 
GeneralRe: Cant not get the ListView TextAlign Property to center Pin
sreejith ss nair29-Oct-04 5:51
sreejith ss nair29-Oct-04 5:51 
GeneralUser Control taking up too much resources Pin
xiaowenjie29-Oct-04 4:44
xiaowenjie29-Oct-04 4:44 
GeneralRe: User Control taking up too much resources Pin
sreejith ss nair29-Oct-04 4:47
sreejith ss nair29-Oct-04 4:47 
GeneralRe: User Control taking up too much resources Pin
xiaowenjie29-Oct-04 4:53
xiaowenjie29-Oct-04 4:53 
GeneralRe: User Control taking up too much resources Pin
sreejith ss nair29-Oct-04 4:59
sreejith ss nair29-Oct-04 4:59 
GeneralRe: User Control taking up too much resources Pin
xiaowenjie29-Oct-04 5:02
xiaowenjie29-Oct-04 5:02 

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.