increased machine precision for FreeBSD apps?

Dmitriy Startsev metal_man at mail.ru
Wed Jul 14 03:06:10 PDT 2004


Hello, Jay!
You wrote to <freebsd-arch at freebsd.org> on Sun, 11 Jul 2004 12:40:04 -0500:

 JSL>  This is probably more of an organizational issue than an
 JSL> architectural one. In the event of running applications with heavy
 JSL> floating point arithmetic (e.g. scientific computation apps for one,
 JSL> encryption algorithms, compression, .. etc ), would it be a good idea
 JSL> to decrease rounding errors by increasing the data type size?
 JSL> e.g. When a programmer declares a floating point variable, the
 JSL> compiler/assembler allocates twice(or a multiple of) the space needed,
 JSL> hence increasing the precision(and better approximation?). I realize
 JSL> this is really just a trade off with execution speed and/or
 JSL> efficiency, perhaps unsuitable for real time calculations, but better
 JSL> for those who don't mind waiting a little for better results, with
 JSL> less the hardware. As a small peek into the future if this thing
 JSL> doesn't sound like herecy, we _could_ implement this so that it is
 JSL> transparent to the programmer(doing it at the compiler/assembler
 JSL> level), none of the ports would need to be rewritten, and could
 JSL> potentially benefit from the increased machine precision(where
 JSL> desired). Just an idea for FreeBSD to knock on the scientific
 JSL> community's door. (If 2.5 mil web hosts trusts FreeBSD for
 JSL> reliability, why can't the more mathematically inclined community?)
 JSL>  I realize that the real scientists(read: well funded, by the big
 JSL> wigs) would have at their disposal computers that won't be needing
 JSL> this(although they could benefit from this), this would be great for
 JSL> home-brewed calculations, maybe students(computer scientists,
 JSL> mathematicians, chemists, biologists, meteorologists, .. ), or just
 JSL> any DIY-ist. This isn't really a new idea, perhaps comparable to
 JSL> x86-64; sure x86-32's may not have the 64-bit physical address space,
 JSL> but they can still have the 64-bit(or more) precision, right? I
 JSL> apologize if this suggestion has already been brought up before. (I'm
 JSL> not only the kind who speaks, I'd aid in the development of this).

IMHO this is a bad idea. Being a programmer myself I have to say I won't
ever use a compiler that generates code different from what I expect. Even
M$ compiler doesn't take THAT much upon itself:)
When someone writes a program, he considers computational precision it
requires and implements it using standard C types. If double is not enough,
one could use long double. If even that is not enough then one have to
consider using different algorithm rather than to try to increase precision.

For most of the ports, increased precision will not give any benefits, but
will only decrease performance and possibly introduce some serious bugs in
software that relies on particular data type sizes.

BTW, about x86-64: default operand size is still 32 bits on this
architecture (and 64 bit types can be used on 32 bit machines as well).

There are international standards related to machine data type
representation, compilers, etc. Let's stick to them as much as possible.

With best regards, Dmitriy Startsev.



More information about the freebsd-arch mailing list