[squeak-dev] Float plugin
Bert Freudenberg
bert at freudenbergs.de
Tue Sep 9 16:16:34 UTC 2008
Am 09.09.2008 um 18:13 schrieb Ang Beepeng:
>
> I have wrote a named primitive that returns float, as follows,
>
> 1 primsIdentityOfFloat":aFloat"
> 2 "primitive returning a floating point"
> 3
> 4 |aFloat|
> 5 self export: true.
> 6 self inline: false.
> 7
> 8 self returnTypeC: 'float'.
> 9 aFloat := interpreterProxy stackFloatValue: 0.
> 10 self var: aFloat type:' float '.
> 11 interpreterProxy pop:2.
> 12 interpreterProxy push: (interpreterProxy floatObjectOf: aFloat).
>
> The primitive returns correct answer, but only until fourth or fifth
> decimal
> points. For example, if the answer is "4.88888", primitive returns
> "4.888880014419556". I added several steps, line 8 , 10 & 12, trying
> to
> return or declare the correct data type or object both in C and also
> in
> Smalltalk. But I still do not get the correct answer.
> What can be corrected for higher precision answer? Thanks.
Squeak Floats are C doubles.
- Bert -
More information about the Squeak-dev
mailing list
|