Re: [Numpy-discussion] float16/32: wrong number of digits?

2017-03-13 Thread Anne Archibald
On Mon, Mar 13, 2017 at 12:57 PM Eric Wieser wrote: > > `float(repr(a)) == a` is guaranteed for Python `float` > > And `np.float16(repr(a)) == a` is guaranteed for `np.float16`(and the same > is true up to `float128`, which can be platform-dependent). Your code >

Re: [Numpy-discussion] float16/32: wrong number of digits?

2017-03-13 Thread Eric Wieser
> `float(repr(a)) == a` is guaranteed for Python `float` And `np.float16(repr(a)) == a` is guaranteed for `np.float16`(and the same is true up to `float128`, which can be platform-dependent). Your code doesn't work because you're deserializing to a higher precision format than you serialized to.

Re: [Numpy-discussion] float16/32: wrong number of digits?

2017-03-09 Thread Anne Archibald
On Thu, Mar 9, 2017, 11:27 Nico Schlömer wrote: > Hi everyone, > > I wondered how to express a numpy float exactly in terms of format, and > found `%r` quite useful: `float(repr(a)) == a` is guaranteed for Python > `float`s. When trying the same thing with

[Numpy-discussion] float16/32: wrong number of digits?

2017-03-09 Thread Nico Schlömer
Hi everyone, I wondered how to express a numpy float exactly in terms of format, and found `%r` quite useful: `float(repr(a)) == a` is guaranteed for Python `float`s. When trying the same thing with lower-precision Python floats, I found this identity not quite fulfilled: ``` import numpy b =