Strange result with timeit execution time measurment

2014-11-15 Thread ast
Hi I needed a function f(x) which looks like sinus(2pi.x) but faster. I wrote this one: -- from math import floor def sinusLite(x): x = x - floor(x) return -16*(x-0.25)**2 + 1 if x 0.5 else 16*(x-0.75)**2 - 1 -- then i used module timeit

Re: Strange result with timeit execution time measurment

2014-11-15 Thread Peter Otten
ast wrote: Hi I needed a function f(x) which looks like sinus(2pi.x) but faster. I wrote this one: -- from math import floor def sinusLite(x): x = x - floor(x) return -16*(x-0.25)**2 + 1 if x 0.5 else 16*(x-0.75)**2 - 1 --

Re: Strange result with timeit execution time measurment

2014-11-15 Thread Peter Pearson
On Sat, 15 Nov 2014 18:07:30 +0100, ast wrote: I needed a function f(x) which looks like sinus(2pi.x) but faster. I wrote this one: -- from math import floor def sinusLite(x): x = x - floor(x) return -16*(x-0.25)**2 + 1 if x 0.5 else 16*(x-0.75)**2 - 1

Re: Strange result with timeit execution time measurment

2014-11-15 Thread Ian Kelly
On Sat, Nov 15, 2014 at 10:07 AM, ast nom...@invalid.com wrote: Hi I needed a function f(x) which looks like sinus(2pi.x) but faster. I wrote this one: -- from math import floor def sinusLite(x): x = x - floor(x) return -16*(x-0.25)**2 + 1 if x 0.5 else