Re: reinterpret_cast float to uint

2015-03-29 Thread ketmar via Digitalmars-d-learn
On Sun, 29 Mar 2015 17:33:02 +, Namespace wrote: > On Sunday, 29 March 2015 at 16:29:40 UTC, ketmar wrote: >> On Sun, 29 Mar 2015 16:00:05 +, matovitch wrote: >> >>> On Sunday, 29 March 2015 at 14:50:24 UTC, ketmar wrote: On Sun, 29 Mar 2015 13:45:10 +, matovitch wrote:

Re: reinterpret_cast float to uint

2015-03-29 Thread Namespace via Digitalmars-d-learn
On Sunday, 29 March 2015 at 16:29:40 UTC, ketmar wrote: On Sun, 29 Mar 2015 16:00:05 +, matovitch wrote: On Sunday, 29 March 2015 at 14:50:24 UTC, ketmar wrote: On Sun, 29 Mar 2015 13:45:10 +, matovitch wrote: you can also use unions. Good idea ! In my case I think it was better to

Re: reinterpret_cast float to uint

2015-03-29 Thread ketmar via Digitalmars-d-learn
On Sun, 29 Mar 2015 16:00:05 +, matovitch wrote: > On Sunday, 29 March 2015 at 14:50:24 UTC, ketmar wrote: >> On Sun, 29 Mar 2015 13:45:10 +, matovitch wrote: >> >> you can also use unions. > > Good idea ! In my case I think it was better to cast, but this could be > helpful another time

Re: reinterpret_cast float to uint

2015-03-29 Thread matovitch via Digitalmars-d-learn
On Sunday, 29 March 2015 at 14:50:24 UTC, ketmar wrote: On Sun, 29 Mar 2015 13:45:10 +, matovitch wrote: you can also use unions. Good idea ! In my case I think it was better to cast, but this could be helpful another time thanks ! :)

Re: reinterpret_cast float to uint

2015-03-29 Thread ketmar via Digitalmars-d-learn
On Sun, 29 Mar 2015 13:45:10 +, matovitch wrote: you can also use unions. signature.asc Description: PGP signature

Re: reinterpret_cast float to uint

2015-03-29 Thread matovitch via Digitalmars-d-learn
On Sunday, 29 March 2015 at 13:39:47 UTC, matovitch wrote: Hi, floats are stored on 32 bits using ieee754...and I would like (for some obscure reason) to reinterpret a such float into a 32 bits uint (i.e without altering the memory). A simple : import std.stdio; void main() { float f =