[Libclc-dev] [PATCH 3/3] Implementations for exp(float) and exp(double)

Jeroen Ketema j.ketema at imperial.ac.uk
Sun May 11 02:28:56 PDT 2014


Hi Dan,

Thanks for spotting the mistake.

I think I messed up the parenthesis while moving things around. I’ll update the patch.

Irrespective of this mistake. I’m wondering if this is the best way to separate the float from double behaviour or whether there’s a clearer way to do this.

Jeroen

On 11 May 2014, at 11:21, Daniel Liew <daniel.liew at imperial.ac.uk> wrote:

>> +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE exp(__CLC_GENTYPE val) {
>> +  // exp(x) = exp2(x) * log2(e)
> 
> This identity doesn't look right to me. Here's a counter example x=0
> exp(0) ≠ exp2(0) * log2(e)
> 1≠ log2(e)
> 
> I think the correct identity is
> 
> exp(x) == exp2(x * log2(e))
> 
> 
> Thanks,
> Dan.





More information about the Libclc-dev mailing list