Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

double vs. float

  • 17-04-2004 04:34PM
    #1
    Closed Accounts Posts: 17


    In C++, ignoring memory differences, will a program using floats run significantly faster than one using doubles?????

    bostitch


Comments

  • Closed Accounts Posts: 256 ✭✭$lash


    no .. even for large programs its only very slight .. the only real difference is the amount of memory used..


  • Closed Accounts Posts: 437 ✭✭casper-


    Originally posted by $lash
    no .. even for large programs its only very slight .. the only real difference is the amount of memory used..

    Well...the real difference is the precision change, and for the most part you should just always stick to double imho.


  • Closed Accounts Posts: 17 Bostitch


    Cheers,
    thats the answer i was hoping for!
    Bostitch.


  • Registered Users, Registered Users 2 Posts: 4,003 ✭✭✭rsynnott


    And in fact, under certain circumstances, Double speed may even beat float!


  • Registered Users, Registered Users 2 Posts: 491 ✭✭Silent Bob


    Originally posted by $lash
    no .. even for large programs its only very slight .. the only real difference is the amount of memory used..
    This is plainly not true.

    It depends what you are doing with the program. I wrote a program a while back that had to do fast-fourier transforms to a 2d array of floating point numbers. The program increased in speed by about 60% when I switched from doubles to floats.

    Yes FFT's are quite intensive, but it just goes to show.


  • Advertisement
Advertisement