[Nestedvm] Possible to pass floats in call in NestedVM?
skinhat skinhat
skinhat at hotmail.com
Tue Mar 19 20:22:34 EDT 2013
I looked at the SQLLite code and looks like they convert floats to
strings and back. For example in NestedDB.java of SQLLite source its
got:
synchronized int bind_double(long stmt, int pos, double v) throws SQLException {
return bind_text(stmt, pos, Double.toString(v)); // TODO
}
synchronized double value_double(Function f, int arg) throws SQLException {
return Double.parseDouble(value_text(f, arg)); // TODO
}
I might have to do the same.
> Date: Tue, 19 Mar 2013 23:11:22 +0100
> From: fratz at inf.uni-konstanz.de
> To: skinhat at hotmail.com
> Subject: Re: [Nestedvm] Possible to pass floats in call in NestedVM?
>
> Hi,
>
> Thinking about it, it may be possible to do
> float foo = *((float *) &integer);
> in C to get that float back, but I never tried anything like that.
>
> However, there is a sqlite java interface (sqlite jdbc) that uses nestedvm,
> and that thing definitely has to pass floating point values to C, so it may
> be worth having a look at the relevant code.
>
> regards
> Matthias
>
Date: Mon, 18 Mar 2013 14:19:36 -0700
Subject: Re: [Nestedvm] Possible to pass floats in call in NestedVM?
From: ehrmann at gmail.com
To: skinhat at hotmail.com
CC: nestedvm at lists.hcoop.net
On Mon, Mar 18, 2013 at 1:04 PM, skinhat skinhat <skinhat at hotmail.com> wrote:
I have tried converting the float into raw int bits:
ia[i]=Float.floatToRawIntBits(f);
in runtime.java but just comes out to a huge integer.
That's probably correct. Floats are stored very differently than ints, and the int version of a float will always look nothing like the float. The only exception I can think of is positive zero looking like an int zero. Negative zero looks completely different.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.hcoop.net/pipermail/nestedvm/attachments/20130320/eecaa194/attachment.htm
More information about the Nestedvm
mailing list