[squeak-dev] Re: Missing mathematical functions in Float

Andreas Raab andreas.raab at gmx.de
Sat Jan 30 07:42:00 UTC 2010


Levente Uzonyi wrote:
> recently we had to use tanh (hyperbolic tangent) and found that it's not 
> in the image. So we rolled our own, but I remembered that we have 
> FloatMathPlugin which has tanh. I tried it and it worked (the primitive):
> 
> Float >> #tanh
> 
>     | exp2self |
>     <primitive: 'primitiveTanH' module: 'FloatMathPlugin'>
>     ^((exp2self := (self + self) exp) - 1.0) / (exp2self + 1.0)
> 
> Shouldn't we add all the functions of FloatMathPlugin to Float and the 
> primitives to existing methods?

Could do. I'll point out though that these primitives are designed to 
produce bit-identical results (based on fdlibm) and not for speed. But 
certainly, where it actually improves speed we should probably take 
advantage of it.

Cheers,
   - Andreas




More information about the Squeak-dev mailing list