user656662
user656662

Reputation: 61

Find logarithm in cuda

How do I find logarithm in cuda? I'm looking for a device function.

Thanks

Upvotes: 5

Views: 7074

Answers (2)

Ade Miller
Ade Miller

Reputation: 13733

You can use:

logf(x)
__logf(x)
log2f(x)
__log2f(x)
log10f(x)
__log10f(x)

Taken from the CUDA Programming Guide (Appendix D).

Upvotes: 8

fabmilo
fabmilo

Reputation: 48330

As Ade says log* functions. Keep in mind that __log* might be fast but not accurate.

Upvotes: 0

Related Questions