[elektro] Osztas-szorzas

hg12345 hg12345 at freemail.hu
Thu Jul 9 17:46:10 CEST 2009


ldiv_t y;

y=ldiv(a,b);

y.quot  -> egész rész
y.rem -> tört rész

standard ansi C....


ldiv_t ldiv(long num, long denom)
ldiv computes the quotient and remainder of num/denom. The results are stored in the long
members quot and rem of a structure of type ldiv_t.



Gergely Vakulya <antiemes at gmail.com> írta: 


> Udvozletem!
> 
> Adott egy muvelet:
> y=(1<<32)*a/b
> (a/b<=1, y egesz resze erdekel, 32 biten)
> 
> Ezt hogy lehet a legegyszerubben, csak 32bites valtozok hasznalataval elvegezni?
> 
> (DDS osztasi aranyat kell kiszamolni.)
> 
> Ha azt irom, hogy ((long long)(1)<<32)*a/b, akkor valoszinu jo lesz,
> de kell ide 64 bit?
> 
> By(t)e
> TBS::Antiemes
> 
> -----------------------------------------
>           elektro[-flame|-etc]
> 


More information about the Elektro mailing list