On Sun Nov 6 00:17:19 UTC 2022 Johannes Kuhn wrote:
...
In particular, I would love to see the following methods added*:
- double Double.fromUnsignedLong(long i)
- long Double.toUnsignedLong(double d)
- float Float.fromUnsignedLong(long i)
- long Float.toUnsignedLong(float f)
...
The method
i
>
> --
>
> *From: *"David Lloyd"
> *To: *"Johannes Kuhn"
> *Cc: *"core-libs-dev"
> *Sent: *Friday, November 11, 2022 3:38:31 PM
> *Subject: *Re: Unsigned long to double and back
>
> Well, I typed this out from
"Johannes Kuhn"
> Cc: "core-libs-dev"
> Sent: Friday, November 11, 2022 3:38:31 PM
> Subject: Re: Unsigned long to double and back
> Well, I typed this out from memory so there's an error, of course. `(tmp & 1)`
> should be `(input & 1)`.
> On Fri, No
Well, I typed this out from memory so there's an error, of course. `(tmp &
1)` should be `(input & 1)`.
On Fri, Nov 11, 2022 at 8:31 AM David Lloyd wrote:
> I encountered this issue as well; for now I'm using the following
> transformation:
>
> long tmp = input >>> 1;
> double output = ((double)
I encountered this issue as well; for now I'm using the following
transformation:
long tmp = input >>> 1;
double output = ((double) tmp) * 2.0 + (tmp & 1);
I... *think* it's correct but I'm not 100% sure and have a long-standing
TODO to try and figure it out...
On Sat, Nov 5, 2022 at 7:17 PM Joh
When I tried to implement an WASM transpiler, I noticed some missing
conversion methods from unsigned types to floating point, for example
from unsigned long to a double.
For the meaning of unsigned long, see Long.toUnsignedString(long i).
Converting between unsigned long and floating point is