Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Operator question.
#2
Because 4 and 10 are int, the result is also int. At least one of them must be double.

Macro Macro2732
Code:
Copy      Help
out

double b
b=4/10; out b ;;0
b=4/10.0; out b ;;0.4
b=10/4; out b ;;2
b=10.0/4; out b ;;2.5

int c(4) d(10)
b=c/d; out b ;;0
b=1.0*c/d; out b ;;0.4


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)