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
-
TrayKnots53112dHmm... Do you want all 512 different zeros refer to the same slot? Assuming a 32 bit float with sign bit and 8 bit mantissa.
-
TrayKnots53112d@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. -
Lensflare1859712dDoesn’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. -
kiki3612812d@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. -
Ranchonyx1070712dMe: "Hey, I'd like the page 0.7557274284 in that book, please."
Array: *hands me a loaded gun*
"Kill yourself" -
TrayKnots53112d@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. -
Lensflare1859712d@kiki but you can still pass a float as an index. How exactly does the ability to tell them apart make this not retarded?
-
donkulator334412dThinking about it, we can apply the factorial function to complex numbers, take the log of a negative number, and differentiate a function two and a half times.
Looking up the (1.2+3.4i)th element of an array is perfectly sane by comparison.
Just make sure it still starts from zero or we'll have your genitalia for a door knocker. -
CoreFusionX365012d@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. -
Lensflare1859712d@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