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-18 17:32

Use it. If you notice any unacceptable slowdown, find out what's taking so long. Chances are, it won't be from math.h.

Name: Anonymous 2010-11-18 17:58

Heh, inefficient implementation. You should see the Prelude.

Name: Anonymous 2010-11-18 18:09

>>2
pow() is pure bloat.

Name: Anonymous 2010-11-18 23:23

bloat my anus

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

Name: Anonymous 2010-11-19 2:45

>>4
So is your mom

Name: Anonymous 2010-11-19 4:50

>>6
.cpp

Name: Anonymous 2010-11-19 5:45

>>8
Because FUCK YOU IN ThE ASS

Name: Anonymous 2010-11-20 3:51

>>6
It says something about "unsafe"
Lol C.

Name: Anonymous 2010-11-20 11:14

use this:
double powd(double x,double y)
{
    int i;
    for(i=0;i<y;i++)
        x*=x;
    return x;
}

Name: Anonymous 2010-11-20 14:17

>>11
powd(2, 4.23);
Now what?

Name: Anonymous 2010-11-20 14:28

>>12
Well done, you have pointed out the obvious

Name: Anonymous 2010-11-20 17:27

>>13

Notice how he didn't even sage.

How rude.

Name: Anonymous 2010-11-20 21:11

RUDE MY ANUS

Name: Anonymous 2010-11-20 21:40

LUBE MY ANUS

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