Click here to Skip to main content
15,916,846 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to remove Panel Border? Pin
cnich233-Apr-06 9:01
cnich233-Apr-06 9:01 
Questionplease help me with my thesis subject Pin
m.rastgar2-Apr-06 10:48
m.rastgar2-Apr-06 10:48 
GeneralRe: please help me with my thesis subject Pin
Mitchell D. Geere2-Apr-06 13:35
Mitchell D. Geere2-Apr-06 13:35 
QuestionGA genetic algorithms Pin
saryrah2-Apr-06 10:14
saryrah2-Apr-06 10:14 
GeneralRe: GA genetic algorithms Pin
Guffa2-Apr-06 12:24
Guffa2-Apr-06 12:24 
QuestionRe: GA genetic algorithms Pin
rani_saleh3-Apr-06 3:03
rani_saleh3-Apr-06 3:03 
QuestionOleDbException:"no value given for one or more required parameters" Pin
MohammadAmiry2-Apr-06 10:07
MohammadAmiry2-Apr-06 10:07 
GeneralRe: OleDbException:"no value given for one or more required parameters" Pin
Guffa2-Apr-06 12:26
Guffa2-Apr-06 12:26 
Questionhow to start a messenger project ?? Pin
abdelhameed812-Apr-06 9:59
abdelhameed812-Apr-06 9:59 
AnswerRe: how to start a messenger project ?? Pin
CWIZO2-Apr-06 20:45
CWIZO2-Apr-06 20:45 
Questionmore precision in division by C# is possible? Pin
luca_la2-Apr-06 9:37
luca_la2-Apr-06 9:37 
AnswerRe: more precision in division by C# is possible? Pin
Guffa2-Apr-06 12:22
Guffa2-Apr-06 12:22 
GeneralRe: more precision in division by C# is possible? Pin
luca_la2-Apr-06 14:40
luca_la2-Apr-06 14:40 
AnswerRe: more precision in division by C# is possible? Pin
Guffa2-Apr-06 19:56
Guffa2-Apr-06 19:56 
GeneralRe: more precision in division by C# is possible? Pin
luca_la2-Apr-06 23:21
luca_la2-Apr-06 23:21 
AnswerRe: more precision in division by C# is possible? Pin
Guffa4-Apr-06 2:37
Guffa4-Apr-06 2:37 
luca_la wrote:
If i have to do a cast before using Round(), it's not a solution!


No, you don't have to do that. The Round method takes a double value. It's after you have done the rounding that you have to do the casting. The method returns a double value, you have to cast that into an integer to store it into an integer variable.

luca_la wrote:
And if i'll can use it, i need to know how much the cost of code increase.


The rounding is done using a single FPU instrution, so it's not expensive at all. It's comparable to casting a double to an integer, which also uses a single FPU instruction.

Consider this line of code:

y = Math.Round(x);

And look the disassembly of the generated code (with my comments):

00000051 fld qword ptr [ebp-44h] ; load from x<br />
00000054 frndint ; round<br />
00000056 fstp qword ptr [ebp-58h] ; store in temp<br />
00000059 fld qword ptr [ebp-58h] ; load from temp<br />
0000005c fstp qword ptr [ebp-4Ch] ; store in y


As you see, the rounding itself is just one instruction, and the rest is just getting the data in and out of the FPU stack and storing the result. If you use the method in an expression, the value doesn't even have to leave the FPU stack between operations.


---
b { font-weight: normal; }

GeneralRe: more precision in division by C# is possible? Pin
luca_la7-Apr-06 3:22
luca_la7-Apr-06 3:22 
QuestionGetting an object's bytes Pin
martin_hughes2-Apr-06 4:30
martin_hughes2-Apr-06 4:30 
AnswerRe: Getting an object's bytes Pin
User 66582-Apr-06 4:42
User 66582-Apr-06 4:42 
AnswerRe: Getting an object's bytes Pin
Luis Alonso Ramos2-Apr-06 8:52
Luis Alonso Ramos2-Apr-06 8:52 
QuestionBrowsing to a file in forms Pin
naglbitur2-Apr-06 3:53
naglbitur2-Apr-06 3:53 
AnswerRe: Browsing to a file in forms Pin
User 66582-Apr-06 4:14
User 66582-Apr-06 4:14 
GeneralRe: Browsing to a file in forms Pin
naglbitur2-Apr-06 5:58
naglbitur2-Apr-06 5:58 
QuestionMSVS Designer Error Pin
Kordzik2-Apr-06 1:07
Kordzik2-Apr-06 1:07 
QuestionMS ObjectSpaces Pin
Varun Jain 7862-Apr-06 0:21
Varun Jain 7862-Apr-06 0:21 

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.