Click here to Skip to main content
15,891,529 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: If you don't like bit twiddling, look away now ... Pin
OriginalGriff24-Oct-21 23:10
mveOriginalGriff24-Oct-21 23:10 
GeneralRe: If you don't like bit twiddling, look away now ... Pin
den2k8824-Oct-21 23:30
professionalden2k8824-Oct-21 23:30 
GeneralRe: If you don't like bit twiddling, look away now ... Pin
Peter Shaw25-Oct-21 0:51
professionalPeter Shaw25-Oct-21 0:51 
GeneralRe: If you don't like bit twiddling, look away now ... Pin
den2k8825-Oct-21 1:10
professionalden2k8825-Oct-21 1:10 
GeneralRe: If you don't like bit twiddling, look away now ... Pin
MKJCP25-Oct-21 2:21
MKJCP25-Oct-21 2:21 
GeneralRe: If you don't like bit twiddling, look away now ... Pin
Alister Morton25-Oct-21 4:41
Alister Morton25-Oct-21 4:41 
GeneralRe: If you don't like bit twiddling, look away now ... Pin
sasadler25-Oct-21 6:25
sasadler25-Oct-21 6:25 
GeneralRe: If you don't like bit twiddling, look away now ... Pin
Stefan_Lang27-Oct-21 3:43
Stefan_Lang27-Oct-21 3:43 
Interesting, but I have some doubts it is still relevant with modern compilers and CPUs. Even if it were, a simple lookup table would be faster for the purpose of finding the first estimation.

This algortihm reminds me a bit of Bresenham's line algorithm - Wikipedia[^] : extremely clever, but once it was hard-wired in every graphcs chip there was little point knowing about it. Except maybe to apply such principles to similar problems in other areas.

E. g. I tend to do calculations with 2D and 3D vectors a lot, and if I were to do these calculations straightforward, then yes, I'd need to do a lot of vector normalizations (i. e. calculations of 1/sqrt(x)). But in about 8-9 out of 10 cases I can avoid normalization alltogether by transforming the expressions. E. g. when I want to know whether a vector length is very small (effectively null), then I compare the squared length against the squared threshold value. Or when I calculate the intersection of a plane with a line, I determine the intersection without normalizing any vector. Instead I transform the equations in such a way that I end up with the squared length of the line direction vector, and the plane direction or normal vectors don't need to be normalized at all.

I do agree that the explanations and specifically the animated number representations are formidable, though
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

NewsArmpit light Pin
RickZeeland23-Oct-21 22:08
mveRickZeeland23-Oct-21 22:08 
GeneralRe: Armpit light Pin
Mircea Neacsu24-Oct-21 3:49
Mircea Neacsu24-Oct-21 3:49 
GeneralRe: Armpit light Pin
RickZeeland24-Oct-21 4:02
mveRickZeeland24-Oct-21 4:02 
GeneralRe: Armpit light Pin
Dan Neely25-Oct-21 3:07
Dan Neely25-Oct-21 3:07 
GeneralRe: Armpit light Pin
DRHuff24-Oct-21 5:35
DRHuff24-Oct-21 5:35 
JokeRe: Armpit light Pin
Richard Deeming24-Oct-21 22:13
mveRichard Deeming24-Oct-21 22:13 
GeneralZIP common root fantasy Pin
BernardIE531723-Oct-21 8:31
BernardIE531723-Oct-21 8:31 
GeneralRe: ZIP common root fantasy PinPopular
Greg Utas23-Oct-21 8:40
professionalGreg Utas23-Oct-21 8:40 
GeneralRe: ZIP common root fantasy Pin
Mircea Neacsu23-Oct-21 11:10
Mircea Neacsu23-Oct-21 11:10 
GeneralRe: ZIP common root fantasy Pin
BernardIE531723-Oct-21 12:58
BernardIE531723-Oct-21 12:58 
GeneralRe: ZIP common root fantasy Pin
RickZeeland23-Oct-21 19:46
mveRickZeeland23-Oct-21 19:46 
GeneralRe: ZIP common root fantasy Pin
peterkmx24-Oct-21 1:52
professionalpeterkmx24-Oct-21 1:52 
GeneralRe: ZIP common root fantasy Pin
RickZeeland24-Oct-21 2:06
mveRickZeeland24-Oct-21 2:06 
GeneralRe: ZIP common root fantasy Pin
Fueled By Decaff25-Oct-21 1:28
Fueled By Decaff25-Oct-21 1:28 
GeneralRe: ZIP common root fantasy Pin
englebart25-Oct-21 7:05
professionalenglebart25-Oct-21 7:05 
PraiseI love when that happens! Pin
honey the codewitch23-Oct-21 7:32
mvahoney the codewitch23-Oct-21 7:32 
GeneralRe: I love when that happens! Pin
PIEBALDconsult23-Oct-21 7:59
mvePIEBALDconsult23-Oct-21 7:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.