On 26 February 2014 00:35, Daniele Nicolodi <dani...@grinta.net> wrote: > > "simpler" in my original email has to be read as involving less > operations and thus more efficient, not simpler to understand, indeed it > is already a simple implementation of the definition. What I would like > to know is if there are some smart shortcuts to make the computation > more efficient.
Sorry I misunderstood your question. How about this: def tofloat2(data): data = frombytes(data) return float(data & 0x0fffffffffffff) * 2 ** ((data >> 52) - 35) That's roughly how you'd do it in C except for the 2**exponent part. I'm not sure what Cython would do with that. If exponent is positive then you can replace that with 1<<exponent or if negative divide by 1>>-exponent. Oscar _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion