+ 1
1.25/0.5=2.5 Почему 1.25%0.5=0.25???
4 Réponses
+ 1
1.25%0.5=1.25-trunc(1.25/0.5)*0.5;
1.25%0.5=1.25-trunc(2.5)*0.5;
1.25%0.5=1.25-2*0.5;
1.25%0.5=0.25
+ 1
Daniel Adam It's been 2 weeks but yeah
trunc is used in finding remainder.isn't it?
0
1.25 % 0.5 = 0.25 <-> 1.25 = x * 0.5 + 0.25 (where x is Natural >= 0)
The other case is a normal floating point operation division.
0
Very_Hard(asm & js & c++ & java & py & (@Hard))
I can not follow your equation .. trunc simply cuts off decimal places.