Boost logo

Boost :

Subject: Re: [boost] [boostcon][proto] Suggestion for LIAW session:fixed-pointnumbers
From: Gruenke, Matt (mgruenke_at_[hidden])
Date: 2011-03-16 21:09:44

I'm talking about x87 instructions, and I do mean Linux vs. Windows - not GCC vs. MSVC. The default configuration is platform-dependent and many libraries are written and tested against the respective configuration, only.
Certain x87 instructions can retain higher intermediate precision than that of the datatype you're using. Therefore, if you use the "magic number" addition trick to get the FPU to perform a shift and round, you're in for a surprise. While one can always change the FPU configuration, it's an impractical work-around since you need to be careful about always changing it back before calling any library functions that might be affected.
These days, SSE support is so prevalent that explictly using it is an easy and viable alternative, in most cases.
Matthew A. Gruenke


From: boost-bounces_at_[hidden] on behalf of Mathias Gaunard
Sent: Wed 3/16/2011 9:27 AM
To: boost_at_[hidden]
Subject: Re: [boost] [boostcon][proto] Suggestion for LIAW session:fixed-pointnumbers

On 16/03/2011 02:45, Gruenke, Matt wrote:

> One area in which I spent a fair amount of time was fast conversion to/from IEEE floating-point. In trying to use the rounding-by-adding trick, I got slightly burned by differences in FPU configuration of Linux vs. Windows. With x87 arithmetic, the default FPU configuration keeps different amounts of intermediate precision.

What do you mean?

MSVC doesn't specify whether floating point instructions use x87 or SSE
(it is free to use either).

GCC allows to choose whether you use exclusively x87 (32-bit default),
SSE (64-bit default) or any (experimental).

Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at