| | mixing variable types in IC Ben Davis
| | | Hi John- You can convert quantities from one data type to another (it's called "casting", I believe). The following computes the quantity x/y, then converts it to a float: ---...--- int x, y; float c; float divide ( int x, int y) { c = (float) (...) (25 years ago, 14-Nov-99, to lugnet.robotics.handyboard)
| | | | | | | | Re: mixing variable types in IC Richard Drushel
| | | | | [Ben Davis] spake unto the ether: (...) Hmm, I think you want c = ((float)(x))/((float)(y)); Otherwise, the division will be done first as integers, giving an integer quotient, which you're then turning into a float. *Rich* (25 years ago, 14-Nov-99, to lugnet.robotics.handyboard)
| | | | | | |