#4561: _fast_float_ for sin/cos, etc., in caculus.py is implemented stupidly
----------------------+-----------------------------------------------------
Reporter: was | Owner: burcin
Type: defect | Status: new
Priority: major | Milestone: sage-3.2.1
Component: calculus | Keywords:
----------------------+-----------------------------------------------------
See #4557.
{{{
>
> Why are we using math.sin/math.cos at all? Really, it should use the
> native C sin and cos.
>
> - Robert
You're right Robert, and that definition of _fast_float_ for sin and cos
is totally the wrong approach. E.g., observe that your _fast_float_ sin
is twice as fast as math.sin:
sage: a = sin._fast_float_()
sage: timeit('a(3.4r)')
625 loops, best of 3: 469 ns per loop
sage: a = sin(x)._fast_float_()
sage: timeit('a(3.4r)')
625 loops, best of 3: 254 ns per loop
Note that the code in calculus.py is *not* just returning math.sin,
actually, but constructing a fast_float object, which is actually
way *WORSE* than math.sin, even:
sage: a = sin._fast_float_()
sage: timeit('a(3.4r)')
625 loops, best of 3: 809 ns per loop
sage: type(a)
<type 'sage.ext.fast_eval.FastDoubleFunc'>
William
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4561>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---