I have written a relatively big program that has lot’s of calculations.

Then I realized I’m using double precision, instead of simple float.

So I’m looking for the painless way to automatically convert all doubles to floats.

Simple “replace all” won’t work, it reports cca 142 errors

Cannot implicitly convert type 'double' to 'float'. An explicit conversion exists (are you missing a cast?)

And currently I’m not in mood to rewrite 142 lines in (float)( ……………)

So, has somebody any idea ?

9 Years
Discussion Span
Last Post by scru

Double precision is more precise than float, and performance really shouldn't be an issue on today's computers. Just thought I'd mention that.

As to your question; usually when i get a problem like this, I would write a python script to go through my file and make changes. It normally takes more time than it would to manually make the changes, but who wants to do that? Also I get burned if I dont make back-ups of my back-ups of my back-ups of my source. Just a fun idea I thought I'd throw out if you have a lot of time on your hands like me.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.