Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
  • Tim Holloway
  • Carey Brown
  • salvin francis

Response to algorithms

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.


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.
Can't .... do .... plaid .... So I did this tiny ad instead:
professionally read, modify and write PDF files from Java
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!