Bookmark Topic Watch Topic
  • New Topic

Response to algorithms  RSS feed

 
Manny Garcia
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Report post to moderator
Just for clarification, I'm only asking out of academic curiosity. After I discovered the XOR swap algorithm I demonstrated my cleverness to my co-workers around the water cooler when the question of floats came up. The idea of converting the floats to integers doing the XOR swap and the converting back came up, but didn't seem like a good solution (figuring out what to multiply and divide the original floats by plus the fact that it introduced two additional variables just seemed 'wrong').

Andre's solution seems the closest thing to what I was looking for. I don't think that there's anything that can be done about the float arithmetic errors. Though I would like to see people kick around more ideas if there's anything else anyone would like to add.

Regards,

Manny
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Report post to moderator
I guess this is a response to this thread. In general it would be better if you put responses like this in the original thread where people will be more likely to know what you're talking about.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!