>they literally took it from an academic paper
You need knowledge in maths to know:
-What you're looking for
-Where to look for
-How to read an academic paper
Modern software engineers will get grumpy if they can't find the solution on stackoverflow, you can't expect them to waste time looking for academic papers and reading them.
He stole it from an algo book thays why it has the what the fuck. He cant math.
1. Convert float to long to enable bit shift 2 division
2. Make initial guess with help of logarithms and a magic number
3. One step Newtons algorithm
>Calc 1, 2 >Linear algebra 1,2 >Operation research >Logic and algebraic structures
That last one might be real math. But probably not. How far into Romans linear algebra before you're out of your depth
Are you one of those retards who think math is only about algebraic structures?
2 weeks ago
Anonymous
math is partly about algebraic structures and i hate that computational calc (read as heat) is ignored
2 weeks ago
Anonymous
Are you one of those retards who think calculus and linear algebra are areas of active research?
2 weeks ago
Anonymous
You're retarded
Calc is actively researched and so is linear algebra.
Some SVD results were from the 60's and it had an enormous impact in various fields (eg subspace identification and data mining/information retrieval) which is more or less the same time NN "came out"
Linear algebra is a tremendous tool for real problem and a huge amount of filed can benefit from researching
is this about the average maths knowledge for CS grads? I have a bachelor's in economics and we got up to measure theory/functional analysis/PDEs. Looking to learn2code, but I keep getting the impression I should do so self taught.
I don't know what the average is.
Functional analysis and pde were addressed in calc 2 and partially in control theory, model identification and adaptive control/identification
In Rust this is just
fn quake_rsqrt(number: f32) -> f32 {
let mut i: i32 = number.to_bits() as i32;
i = 0x5F375A86_i32.wrapping_sub(i / 2);
let y = f32::from_bits(i as u32);
y * (1.5 - (number * 0.5 * y * y))
}
No, she's saying that the formula is the magic autistic part, not the (now-UB) pointer-assisted type punning
She didn't even bring up Carmack
2 weeks ago
bruce3434
>No, she's saying that the formula is the magic autistic part,
It's not, it's an implementation of Newton's approximation. > I just don't understand where that part comes from
Read the paper. You should have been taught this in your year 12.
2 weeks ago
Anonymous
>It's not, it's an implementation of Newton's approximation.
I know Newton's approximation, but any code that depends on the bitwise representation of floating point is magical and autistic in my book, except maybe if it clearly labels and decomposes sign and mantissa and so on.
(I may have misunderstood how broadly you meant "formula".)
>Are you implying carmack invented this formula?
What? No, how did you reach that conclusion? I just don't understand where that part comes from, and is easily the most magical part. Bit hacking and newtons method aren't mysterious, but that magic number... what is is? Where did ti come from?
>I removed the undefined behavior
And yet it was used in production. It's basically impossible to write C without "undefined behavior". I can't think of a single compiler or platform which would fail to produce the desired result
In C this is just
float quake_rsqrt(float x) {
union { float f; int32_t i; } y = { x };
y.i = 0x5F375A86 - y.i / 2;
return y.f * (1.5f - (0.5f * x * y.f * y.f));
}
0x5f3759df out of his ass >Still tickles me
he didn't pull it out of his ass. it was well known within the computer graphics industry for years before carmack ever saw it - but carmack didn't understand the mathematics behind it. he got credit for introducing it to pc gaming but they tried to claim that ID software had invented it, and gaming magazines republished their nonsense as fact.
I've been trying to either implement this or get one that works but for fixed point
So far I've gotten >https://www.fpgarelated.com/showarticle/1347.php
But its like 5 iterations so I'd have to do a cycle count to see if its worth it compared to an iterative method.
Whats your favorite trick gee?
Mine is probably how you can add/sub/mul in parallel 1 16bit and 1 15bit number by leaving bit 16 as the carry for the lower 15bit number.
> "The algorithm was originally attributed to John Carmack, but an investigation showed that the code had deeper roots in both the hardware and software side of computer graphics. Adjustments and alterations passed through both Silicon Graphics and 3dfx Interactive, with the original constant being derived in a collaboration between Cleve Moler and Gregory Walsh, while Gregory was working for Ardent Computing in the late 1980s.[3] Walsh and Moler adapted their version from an unpublished paper by William Kahan and K.C. Ng circulated in May of 1986. "
confirmed and witnessed: cormack is a fucking hack.
>What did he mean by this?
he had no idea how it worked. he stole it. code and math lamers can't explain things they steal.
This begs the question: Why doesn't the C std library have a fast sqrt? Development of Quake started way after 1990 why didn't ANSI include the fast sqrt in 1990 and other faster versions of algorithms in ANSI?
Not all hardware has native floating points, at which point the whole thing becomes more expensive than doing a few iterations of some other method.
Also, you cant use the same constant with 64 bit numbers or at least nobody has bothered to implement it since there's a sqrt function in modern x86 processors.
Yeah, but in 1990 x86 was around as a major force at least for 10 years. Most PCs had native floating points. And you might as well as sqrt is super important, just have a fastsqrtfp function.
There is a Wikipedia page about Carmack fast inverse root square, seriously.
>Carmack
Not due to Carmack.
>Carmack
not his
>when engineers had knowledge in maths
they literally took it from an academic paper
>they literally took it from an academic paper
You need knowledge in maths to know:
-What you're looking for
-Where to look for
-How to read an academic paper
Modern software engineers will get grumpy if they can't find the solution on stackoverflow, you can't expect them to waste time looking for academic papers and reading them.
Too much projection
[log in to view media]
>t.
Fantastic posts
He stole it from an algo book thays why it has the what the fuck. He cant math.
1. Convert float to long to enable bit shift 2 division
2. Make initial guess with help of logarithms and a magic number
3. One step Newtons algorithm
Back when engineers had knowledge in maths and not in Indian tutorials.
Engineers have knowledge in maths today too, you are inside a meme bubble.
"Software engineers" have knowledge in maths?
I do and I'm sure I'm not alone
There were math courses at my uni
Calc 1, 2
Linear algebra 1,2
Operation research
Logic and algebraic structures
>Calc 1, 2
>Linear algebra 1,2
>Operation research
>Logic and algebraic structures
That last one might be real math. But probably not. How far into Romans linear algebra before you're out of your depth
Are you one of those retards who think math is only about algebraic structures?
math is partly about algebraic structures and i hate that computational calc (read as heat) is ignored
Are you one of those retards who think calculus and linear algebra are areas of active research?
You're retarded
Calc is actively researched and so is linear algebra.
Some SVD results were from the 60's and it had an enormous impact in various fields (eg subspace identification and data mining/information retrieval) which is more or less the same time NN "came out"
Linear algebra is a tremendous tool for real problem and a huge amount of filed can benefit from researching
is this about the average maths knowledge for CS grads? I have a bachelor's in economics and we got up to measure theory/functional analysis/PDEs. Looking to learn2code, but I keep getting the impression I should do so self taught.
I don't know what the average is.
Functional analysis and pde were addressed in calc 2 and partially in control theory, model identification and adaptive control/identification
Having memorized some formulas is different from actually understand what it does and why it exists.
I can tell you've never taken any math at a university level.
*tensorflow blog posts etc.
Mathematicians wouldn't touch this
>gamedev copypasted code from somebody smarter than him
Those were the times.
In Rust this is just
fn quake_rsqrt(number: f32) -> f32 {
let mut i: i32 = number.to_bits() as i32;
i = 0x5F375A86_i32.wrapping_sub(i / 2);
let y = f32::from_bits(i as u32);
y * (1.5 - (number * 0.5 * y * y))
}
No magic, no autism.
>No magic
>No autism
>Leaves the most magical, autistic part.
??
I removed the undefined behavior.
>0x5F375A86
The fuck is this for?
http://www.lomont.org/papers/2003/InvSqrt.pdf
Are you implying carmack invented this formula?
No, she's saying that the formula is the magic autistic part, not the (now-UB) pointer-assisted type punning
She didn't even bring up Carmack
>No, she's saying that the formula is the magic autistic part,
It's not, it's an implementation of Newton's approximation.
> I just don't understand where that part comes from
Read the paper. You should have been taught this in your year 12.
>It's not, it's an implementation of Newton's approximation.
I know Newton's approximation, but any code that depends on the bitwise representation of floating point is magical and autistic in my book, except maybe if it clearly labels and decomposes sign and mantissa and so on.
(I may have misunderstood how broadly you meant "formula".)
>Are you implying carmack invented this formula?
What? No, how did you reach that conclusion? I just don't understand where that part comes from, and is easily the most magical part. Bit hacking and newtons method aren't mysterious, but that magic number... what is is? Where did ti come from?
>I removed the undefined behavior
And yet it was used in production. It's basically impossible to write C without "undefined behavior". I can't think of a single compiler or platform which would fail to produce the desired result
>ORANGE CRAB BAD MUH HECKIN THREEHALFS CONSTANT IS HECKIN MAGICAL
and?
No magic, no autism, 100% female hormones.
Why do whitoids turn everything about homosexualry?
cool it with the antisemetic remarks brucella
Like most rust rewrites, this one excludes critical functionality. Reread the Rust ABI if you think this will actually work.
nah
What ABI? You don’t know what you’re talking about.
Where’s the mess?
When did I say there’s a need for it? Are you seeing things?
https://doc.rust-lang.org/rust-by-example/fn.html
what a fucking mess of a language. I kind of played along with all the rust memes on this board, but dear lord is it a piece of shit.
Just look how clueless rustniles are, this is not even need nowdays, there are intrinsics for this you know.
In C this is just
float quake_rsqrt(float x) {
union { float f; int32_t i; } y = { x };
y.i = 0x5F375A86 - y.i / 2;
return y.f * (1.5f - (0.5f * x * y.f * y.f));
}
Dumb n-word cretin
>defines 1.5F as a constant "threehalfs" for clarity
>pulls 0x5f3759df out of his ass
Still tickles me
0x5f3759df out of his ass
>Still tickles me
he didn't pull it out of his ass. it was well known within the computer graphics industry for years before carmack ever saw it - but carmack didn't understand the mathematics behind it. he got credit for introducing it to pc gaming but they tried to claim that ID software had invented it, and gaming magazines republished their nonsense as fact.
Fuck you, that's where.
You're not me.
Fuck off impersonator.
poop
I've been trying to either implement this or get one that works but for fixed point
So far I've gotten
>https://www.fpgarelated.com/showarticle/1347.php
But its like 5 iterations so I'd have to do a cycle count to see if its worth it compared to an iterative method.
Reminder that carmack the lying hack had literally NOTHING to do with this code. People calling him a genius for it are retarded.
>the original algorithm was devised by Greg Walsh at Ardent Computer in consultation with Cleve Moler, the creator of MATLAB
Whats your favorite trick gee?
Mine is probably how you can add/sub/mul in parallel 1 16bit and 1 15bit number by leaving bit 16 as the carry for the lower 15bit number.
Why do we have this thread every other day?
Doesn't it strike anyone else as retarded to half a varible named threehalfs = 1.5F.
If you change the number, then the variable name is confusing.
I am a huge tranny homosexual. Fuck my ass, please negro master.
based bruce
> "The algorithm was originally attributed to John Carmack, but an investigation showed that the code had deeper roots in both the hardware and software side of computer graphics. Adjustments and alterations passed through both Silicon Graphics and 3dfx Interactive, with the original constant being derived in a collaboration between Cleve Moler and Gregory Walsh, while Gregory was working for Ardent Computing in the late 1980s.[3] Walsh and Moler adapted their version from an unpublished paper by William Kahan and K.C. Ng circulated in May of 1986. "
confirmed and witnessed: cormack is a fucking hack.
>What did he mean by this?
he had no idea how it worked. he stole it. code and math lamers can't explain things they steal.
[log in to view media]
A 20min video explaining the what and why.
>20 min
do zoomers are this retarded?
What is your objection?
This begs the question: Why doesn't the C std library have a fast sqrt? Development of Quake started way after 1990 why didn't ANSI include the fast sqrt in 1990 and other faster versions of algorithms in ANSI?
Not all hardware has native floating points, at which point the whole thing becomes more expensive than doing a few iterations of some other method.
Also, you cant use the same constant with 64 bit numbers or at least nobody has bothered to implement it since there's a sqrt function in modern x86 processors.
Yeah, but in 1990 x86 was around as a major force at least for 10 years. Most PCs had native floating points. And you might as well as sqrt is super important, just have a fastsqrtfp function.
>he
Stop assuming the people gender.
I LOOOOOOVE BBC
Based American
Actually, I am a Pakistani homosexual who can't read or write, I just take dick and estrogen pills.
Based seething American
[log in to view media]
>what the fuck?
the most confusing part is the magic constant wtf is that doign
john carmack is still based in quake
nuke india 2020
I understand nothing
should I learn to program
Just give up.
[log in to view media]
Everyone knows about fast inverse sqrt, but hardly anyone knows about Minsky's integer circle algorithm.
x += y >> 4;
y -= x >> 4;