Float to C double

Bruno Luca lethalman88 at gmail.com
Thu Jun 15 10:44:51 UTC 2006


On Thu, 15 Jun 2006 11:28:53 +0200, Bert Freudenberg <bert at impara.de>  
wrote:

>
> Am 14.06.2006 um 22:14 schrieb Bruno Luca:
>
>> On Wed, 14 Jun 2006 22:09:17 +0200, Bert Freudenberg <bert at impara.de>  
>> wrote:
>>
>>> Am 14.06.2006 um 21:34 schrieb Bruno Luca:
>>>
>>>> On Wed, 14 Jun 2006 20:55:07 +0200, Bert Freudenberg <bert at impara.de>  
>>>> wrote:
>>>>
>>>>> Yes. Squeak Floats are double precision IEEE numbers
>>>>
>>>> So if i need to pass a C float i need to call the primitive with a  
>>>> FloatArray?
>>>
>>> No. In the case of FFI, it converts from Squeak Floats to doubles or  
>>> floats as necessary depending on the ffi function declaration. If you  
>>> write a plugin, you just read a double from the stack and call the  
>>> function with a float, the conversion is inserted by the C compiler.
>>>
>>> - Bert -
>>
>> I'm using this syntax:
>> primitiveBla: aFloat boh: aDouble
>> 	self primitive: 'primitiveBla' parameters: #(Float Float)
>>
>> Is that ok?
>
> I think it is, but you should look at the generated code to chck that  
> indeed the right conversion is performed:
>
> 	aDouble := interpreterProxy floatValueOf: aFloatOop
>
>> What about converting a double to a FloatObj?
>
> 	aFloatOop := interpreterProxy floatObjectOf: aDouble
>
> Bert -
>
>

Really thanks.

Bye :)

-- 
www.lethalman.net - Thoughts about internet technologies



More information about the Squeak-dev mailing list