Re: Arithmetic rounding

From: JRG <"JRG">
Date: Wed, 19 Jun 2002 13:01:13 -0400

----boundary-LibPST-iamunique-1350698571_-_-
Content-type: text/plain

On 19 Jun 02, at 17:19, robert.d.campbell{([at]})nowhere.xy

>
> I think that the two routines below read and set
> the i386 floating point control register.
>
>
> PROCEDURE [code] Read (VAR n : SHORTINT)
> 0D9H, 038H; (* FSTCW -> n *)
>
>
> PROCEDURE [code] Write (VAR flgs : SET)
> 0D9H, 028H; (* flgs -> FLDCW *)
>
>
> However it seems to be reset to a default value
> at (so far) unpredicable times. I suspect that use
> of a Formatter causes this.
>
>
> Robert Campbell
>


I once wrote similar stuff, long long ago, in a different language.
If I
recall
correctly, you have to be VERY careful because lots of programs
are very
unfriendly about how they use the FPU. So, your apparently
correct
routine
may fail simply because some other process running in the
Windows
environment decides to tinker with the control registers of the
FPU, and
then
neglects to put them back the way they were when it exits.

---JRG


John R. Gleason

Syracuse University
430 Huntington Hall Voice: 315-443-3107
Syracuse, NY 13244-2340 USA FAX: 315-443-4085

PGP public key at keyservers
--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xy

Current posting policy:

a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.

b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.

----boundary-LibPST-iamunique-1350698571_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0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