| Steven,
Erik's text in www.mega-nerd.com/FPcast explains
it well.
I went and tested the two options I gave here:
lrint() + test is slower than just casting.
lrint() on its own is faster than casting, but
it rounds; if truncation is needed then we're
better off with casting.
I am just checking the best way to make table
lookup code faster. I suppose using integer
sampling increments and indexing is the fastest,
anyway.
Victor
>
> Hi Victor,
>
> This is somewhat related and is a question for everyone:
> in H/sysdep.h, if USE_LRINT is enabled, does the code in
> there:
>
> 230 # define MYFLT2LONG(x) ((long) lrintf((float)
> (x)))
>
> not yield a different result than:
>
> 263 # define MYFLT2LONG(x) ((long) (x))
>
> ? I guess I'm wondering what that code is all about.
>
> Thanks!
> steven
>
>
> On 10/21/06, Victor Lazzarini
> > wrote: A question for any int to float guru out there
> > (Erik?), which of the two truncation codes below would
> be faster? >
> > (1)
> > double a; long b;
> > b = (long) a;
> >
> > (2)
> > double a; long b;
> > b = lrint(a);
> > b = b <= a ? b : b - 1;
> >
> > (both assuming positive numbers only).
> > I suppose my question is whether b <= a, comparing
> > fixed and floating-point, involves any casting
> > that might slow down things.
> >
> > I would expect that if there is any casting it would
> > be long -> double; I suppose that does not carry
> > any penalty, or does it?
> >
> > Thanks
> >
> > Victor
> >
> >
> ----------------------------------------------------------
> > --------------- Using Tomcat but need to do more? Need
> > to support web services, security? Get stuff done
> quickly with pre-integrated technology to make your job
> > easier Download IBM WebSphere Application Server v.1.0.1
> > based on Apache Geronimo
>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Csound-devel mailing list
> > Csound-devel@lists.sourceforge.net
> >
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> >
>
> ----------------------------------------------------------
> --------------- Using Tomcat but need to do more? Need to
> support web services, security? Get stuff done quickly
> with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on
> Apache Geronimo
>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net |