Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~399 People Reached
Favorite Forums
Favorite Tags
c x 2
Member Avatar for yelugamraghu

How can we type cast a double number to long. I am getting wrong value, when i am trying to type cast it to long. [code=c] int main() { int s=9; double minuttakst=0.019000; int takst_enhed=60; double antal_minutter, beloeb; antal_minutter = (double) s / (double)takst_enhed; beloeb = ((double)((long)(((antal_minutter * minuttakst) * …

Member Avatar for jephthah
0
268
Member Avatar for yelugamraghu

[code=c] int main() { int antal_sekunder=9; double minuttakst=0.019000; int takst_enhed=60; double antal_minutter, beloeb, beloeb1; antal_minutter = (double)antal_sekunder / (double)takst_enhed; beloeb1 = ((antal_minutter * minuttakst) * 10000.0) + 0.5 ; //This is used for rounding up to 4 decimals. printf("\n beloeb1 = %lf", beloeb1); printf("\n (long)beloeb1 = %ld",(long) beloeb1); beloeb1 = …

Member Avatar for jephthah
0
131