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 ?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.