[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Intergers vs. floats?



> Jeg var egentligt af den opfattelse, at når man declarede en 'int', blev
> værdien gemt i "2's complement" binær..?
> Det synes ikke rigtigt at passe. Så skulle en int med hex værdien 0xFF
> være -1? Det er det jo ikke...(255, ik' :)
> 
> Problemet er at jeg roder lidt med noget lowlevel stuff (nej, kan ikke
> benytte assembler, da det skal være platform independant). 
> Jeg henter en 9bit 2's complemented variabel fra et register, og så
> snart værdien er positiv, virker det fint. Men når den går negativ...som
> f.eks. -1 (0xFF) skriver C selvfølgeligt 255. Hmm....Nogen der har
> erfaringer inden for dette?

Nu er en int jo ikke 8 bit så 0xFF vil være lig med 255... 0xFFFF er så
måske lig -1?

/Jesper

"Microsoft does have a Year 2000 problem. We're it"
(c) unknown       - Go Linux! http://www.linux.org/

 Jesper Monsted - RIPE: JM42 - sslug@sslug



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:07 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *