On Wed, May 23, 2018 at 3:39 PM Steffen Märcker <merk...@web.de> wrote:

> Hi Henry,
>
> > [...] it might be possible to try to do this with FFI only?
>
> If I understand you correctly, I could use FFI to call an external lib to
> perform the actual computation according to the rounding mode, right? In
> this case I'd be worry about the performance impact of many FFI calls.
>
> > For the same reason, I hope you intend roundByMethodXWhile: to be a
> > mandatory API, forgetting to set the mode back when done (or, never
> > getting
> > there due to errors, etc) is an area best left unexplored ;)
>
> I used roundByMethodXWhile: aBlock just to convey the idea that an API
> could work "local" and ensures resetting the rounding mode afterwards. =)
>
>
​This quite easy to implement :

LibC>>fegetround
    ^ self ffiCall: #(int fegetround(void))​

​LibC>>​
fesetround: round
    ^ self ffiCall: #(void fesetround(int round))

​but apparently nothing happens when you do :

LibC uniqueInstance fesetround: 1024.
LibC uniqueInstance fegetround.

always return 0.​

-- 
Serge Stinckwich
UMI UMMISCO 209 (SU/IRD/UY1)
"Programs must be written for people to read, and only incidentally for
machines to execute."http://www.doesnotunderstand.org/

Reply via email to