Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

math.h

Name: Anonymous 2010-11-18 17:28

is math.h functions not recommended when wanting speed? I remember seeing one of you guys commenting on someone using pow awhile ago, so what's the secret here?

Name: Anonymous 2010-11-19 2:44

>>1
Read gcc(1). It says something about "unsafe" optimizaiton and float numbers. Or here  http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

TL;DR consider this:

#include <math.h>

double z(double x)
{
    return sin(x);
}


gcc -O3 -S a.cpp

__Z1zd:
    pushl    %ebp
    movl    %esp, %ebp
    popl    %ebp
    jmp    _sin


gcc -ffast-math -O3 -S a.cpp

__Z1zd:
    pushl    %ebp
    movl    %esp, %ebp
    fldl    8(%ebp)
    popl    %ebp
    fsin
    ret


inb4:YOU HERPED HIM

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List