
-----------------------------------
syntax_error
Wed Sep 26, 2007 12:30 pm

long into a float
-----------------------------------
a genral question
as far as I know a long is 8 bits 
and a float is 4 bits
then why in java you can automaticly cast a long into a float?
thx in advance 
Syntax_Error

-----------------------------------
StealthArcher
Wed Sep 26, 2007 12:34 pm

Re: long into a float
-----------------------------------
I think you have those backwards.....

longs are 4 bytes if i remember correctly

-----------------------------------
HeavenAgain
Wed Sep 26, 2007 2:45 pm

RE:long into a float
-----------------------------------
data type   size (in bits)            range
byte             8	               -2^7 to 2^7 - 1
short	         16	              -2^15 to 2^15 - 1
int	           32	              -2^31 to 2^31 - 1
long	          64	              -2^63 to 2^63 - 1


type        in bytes

float	       32
double	      64
a long is 64 bits
a byte IS 8 bits
and a float is 32 BYTES

more info is linked here

-----------------------------------
wtd
Wed Sep 26, 2007 5:14 pm

Re: RE:long into a float
-----------------------------------
and a float is 32 BYTES

Ummmm...

-----------------------------------
Zampano
Wed Sep 26, 2007 6:55 pm

Re: long into a float
-----------------------------------
How much memory would I need to take a byte out of a sundae double banana ice cream float?

*My own lameness is astounding.*

-----------------------------------
McKenzie
Wed Sep 26, 2007 7:30 pm

Re: long into a float
-----------------------------------
I thought the automatic cast was to double? That aside, the reason for the automatic conversion is that long is a long integer, as soon as you have any fractional component to a number long can't hold it (e.g. 3.5)

-----------------------------------
Nick
Wed Sep 26, 2007 8:19 pm

RE:long into a float
-----------------------------------
zampano ur bytes are so small it takes 4 to equal a nybble (AHAHAHAHA) [btw 4 bytes = a nybble]

-----------------------------------
rizzix
Wed Sep 26, 2007 9:46 pm

RE:long into a float
-----------------------------------
Wow a lot of you are misusing the word byte for bit.

1 byte = 8 bits
1 nibble = 4 bits
 

Int's/floats are 32-bit or 4-byte. Long/doubles are 64-bit or 8-bytes.

-----------------------------------
rdrake
Wed Sep 26, 2007 10:00 pm

Re: RE:long into a float
-----------------------------------
Wow a lot of you are misusing the word byte for bit.

1 byte = 8 bits
1 nibble = 4 bits
 

Int's/floats are 32-bit or 4-byte. Long/doubles are 64-bit or 8-bytes.Nah, some people like to be really precise with their numbers.  2^(32*8) is nothing!

-----------------------------------
syntax_error
Sat Sep 29, 2007 9:51 pm

Re: long into a float
-----------------------------------
ahh my mistake I meant to write byte.. :$
but a long is 64 bytes nonetheless
and a float is 32 bytes
so how can you in the language java
automatically cast a long into a float?

-----------------------------------
zylum
Sun Sep 30, 2007 2:30 am

Re: RE:long into a float
-----------------------------------
Wow a lot of you are misusing the word byte for bit.

1 byte = 8 bits
1 nibble = 4 bits
 

Int's/floats are 32-bit or 4-byte. Long/doubles are 64-bit or 8-bytes.

-----------------------------------
haskell
Sun Sep 30, 2007 8:05 am

RE:long into a float
-----------------------------------
Grrrr...

http://members.aol.com/M206ou/m206/M206_Smalltalk_tutorial_ascii.htm

 Read it, or I'll mock you till your cry toy your momma.
