Ranter
Join devRant
Do all the things like
				++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
				Sign Up
			Pipeless API
 
				From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
				Learn More
			Comments
		- 
				
				 TrayKnots568265dHmm... Do you want all 512 different zeros refer to the same slot? Assuming a 32 bit float with sign bit and 8 bit mantissa. TrayKnots568265dHmm... Do you want all 512 different zeros refer to the same slot? Assuming a 32 bit float with sign bit and 8 bit mantissa.
- 
				
				 TrayKnots568265d@kiki TrayKnots568265d@kiki
 
 Easier in C.
 
 double x = 4.32134;
 
 return array[(long) x];
 
 I mean, it is not contiguous, but it does allow you to use double values to address different values. 2^(how many fucking bits a double on your machine has). Assuming here, bits in double = bits in long.
- 
				
				 Lensflare21237265dDoesn’t js do this already? Because in js there are no integers but only floats. Lensflare21237265dDoesn’t js do this already? Because in js there are no integers but only floats.
 
 Funny how when you want to make a joke about something ridiculous and in js it‘s already reality.
- 
				
				 kiki37486265d@Lensflare sorry, but JS has a mechanism by telling the two apart: Number.isInteger() kiki37486265d@Lensflare sorry, but JS has a mechanism by telling the two apart: Number.isInteger()
 
 I know you think that static types are “better”, but that's as good as you're gonna get in a language like JS.
 
 Also, parseInt and parseFloat are different.
- 
				
				 Ranchonyx10335265dMe: "Hey, I'd like the page 0.7557274284 in that book, please." Ranchonyx10335265dMe: "Hey, I'd like the page 0.7557274284 in that book, please."
 
 Array: *hands me a loaded gun*
 "Kill yourself"
- 
				
				 TrayKnots568265d@donkulator TrayKnots568265d@donkulator
 
 I wouldn't see why. I don't need to dereference it when it is already on the stack. I just need to cast it.
 
 On the other hand, I am no C developer and I didn't try it. All I am saying, cast the double to a long. Interpret this region in memory as a long.
 
 You might be right, we can use your code for our double accepting array code.
- 
				
				 Lensflare21237265d@kiki but you can still pass a float as an index. How exactly does the ability to tell them apart make this not retarded? Lensflare21237265d@kiki but you can still pass a float as an index. How exactly does the ability to tell them apart make this not retarded?
- 
				
				 CoreFusionX3573265d@TrayKnots CoreFusionX3573265d@TrayKnots
 
 A C cast done that way just truncates the float.
 
 As @donkulator said, you need to cast and dereference a pointer in order to reinterpret the bits.
- 
				
				 Lensflare21237265d@donkulator no, this is more comparable to number theory. It‘s like asking what the 2.65th prime number is. Lensflare21237265d@donkulator no, this is more comparable to number theory. It‘s like asking what the 2.65th prime number is.
 
 Some things just don‘t make sense with non-integers, no matter how hard you try :)




Arrays should be indexable by a float!!!!!
joke/meme