"Here are a couple of interesting things about real (fractional) types. Let's start with this example:"
float f = 3 / 5;
"This computation will result in f being equal to… zero!"
"Yeah, Rishi told me something like that."
"Oh, did he? Good. Repetition is super helpful."
"There is no error here. The division involves two integers, so the remainder is simply ignored. To stop this from happening, at least one of the two numbers in the division must be fractional."
"If one of the numbers is fractional, then the second number will first be converted to a fractional type, and then the division will be performed."
"You can solve this problem like this:"
Notation for fractional numbers: 




"What if the division involves variables?"
"Then we do this:"
Convert an integer variable to a fractional value: 





"That looks awkward. Isn't there another division operation – something more convenient?"
"Nope. This is all there is."
"OK. No problem."
GO TO FULL VERSION