Csound Csound-dev Csound-tekno Search About

[Cs-dev] which is faster?

Date2006-10-21 20:26
FromVictor Lazzarini
Subject[Cs-dev] which is faster?
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

Date2006-10-21 22:05
From"Steven Yi"
SubjectRe: [Cs-dev] which is faster?
AttachmentsNone