POV-Ray : Newsgroups : povray.general : QUESTION: Programming: Converting Floats to 255-Integers : Re: QUESTION: Programming: Converting Floats to 255-Integers Server Time
19 Apr 2024 14:33:46 EDT (-0400)
  Re: QUESTION: Programming: Converting Floats to 255-Integers  
From: clipka
Date: 27 Apr 2018 18:25:45
Message: <5ae3a369$1@news.povray.org>
Am 27.04.2018 um 21:41 schrieb dick balaska:

> I wouldn't worry about it. The human eye can't really tell the
> difference between RGB(121,85,198) and RGB(122,85,198).

That depends. If you place two uniform regions of those colours side by
side, the difference is quite obvious.

> (I never understood why the x87 uses 80 bit numbers internally, to
> minimize rounding error in calculations, but only allowed inputs and
> outputs of 64 bits. Why can't I have all those bits?)

As a matter of fact the x87 /does/ allow you to access all 80 bits. It's
up to the /compiler/ whether it supports storage of such values in main
memory. For example, in GCC the type seems to be available as
`__float80`, and back in the days in Turbo Pascal 6.0 the type was
available as `extended`.

One major reason why the type has fallen out of favour ages ago is that
ever since the first x86 CPU with a 32 bit wide data bus (80386-DX) or
the first x86 mainboard with a memory cache, it has been a pain to
manage its alignment: For optimal memory utilization consecutive float
elements should obviously be aligned to multiples of 80 bits, but for
optimal performance the alignment should be either an integer multiple
or an integer fraction of the data bus / cache line width, which only
works out for a width of 16 bits or less (presuming a power-of-2 width).

In modern software, virtually all fundamental data types to be stored in
memory have a power-of-2 width, for that very reason.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.