Simple integer division question


apologies such basic question - haven't been able find answer anywhere.

i'm wondering how arduino handles fractions of integers.

i'm using arduino run 12 bit tlv5618 dac (0-4095) - when set output value to, example, 4095/2 - getting 2047.5 or arduino round up/down 'whole' integer?

if fraction - how many decimal places go to?

hope makes sense - thanks.

j

if numerator integer, , denominator integer, result integer, too. in integer division, fractional part truncated. there no rounding.


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Simple integer division question


arduino

Comments