I don't understand.

In 32 bits in C, there are 32 bits float called "float" or "single precision float" but its usage is very uncommon. People always use "double" as every 32 bits processors supports 64 bits float nowadays. When I look at the Cairo reference manual, only double are used, so I don't understand why you need to cast BoxedFloat64 to single precision float for FFI. The ThreadedIA32FFIPlugin has both #ffiPushDoubleFloat:in: and��ffiPushSingleFloat:in: so all the support seems to be available.��

Can you explain why by default you reduce the precision of float to 32 bits ? Is it because the library used expects a single precision float to be passed ?



2016-02-18 11:57 GMT+01:00 Esteban Lorenzano <estebanlm@gmail.com>:
but in C (32bits) floats are 4 bytes, so when you do:��

ByteArray new��
floatAt: 1 put: somePharoFloat;

it will cast it to 4 bytes (if it fits which is most of the cases).

but as I said��� it is an error I need to fix :)

Esteban


On 12 Feb 2016, at 20:50, Cl��ment Bera <bera.clement@gmail.com> wrote:

I don't understand. All BoxedFloat have 8 bytes, that's why they are called BoxedFloat64. There are no 4-bytes floats in Pharo. Even in 32 bits.

2016-02-12 18:06 GMT+01:00 Esteban Lorenzano <estebanlm@gmail.com>:

On 12 Feb 2016, at 17:50, Aliaksei Syrel <alex.syrel@gmail.com> wrote:

On Fri, Feb 12, 2016 at 5:45 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
Float>>#pointer��
^ (ByteArray new: FFIExternalType pointerSize)
floatAt: 1 put: self;
yourself

Yes it does the trick :) Thanks!

yes and no (I made a mistake): that works because incidentally pointers and floats have same size (4 bytes)��� but can happen that it is not (doubles have 8 bytes)��� but is ok for now :)
I will fix it correctly next week.��

Esteban