[squeak-dev] Float plugin
Ang Beepeng
beepeng86 at yahoo.com
Tue Sep 9 16:13:57 UTC 2008
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.
Ang Beepeng
--
View this message in context: http://www.nabble.com/Float-plugin-tp19395816p19395816.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.
More information about the Squeak-dev
mailing list
|