tech-x11 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

miarc.c: CUBED_ROOT_[24]



Every X server source I have at ready hand includes, in miarc.c,

# define CUBED_ROOT_2   1.2599210498948732038115849718451499938964
# define CUBED_ROOT_4   1.5874010519681993173435330390930175781250

The cube roots of 2 and 4 are actually
1.259921049894873164767210607278228350570251464701507980081975113 and
1.587401051968199474751705639272308260391493327899853009808285762, to
an error of less than one unit in the last places of those numbers
(1.2599...113 cubed is greater than 2 and 1.2599...112 cubed is less
than 2; similarly, 1.5874...762 cubed is greater than 4 and
1.5874...761 cubed is less than 4).  Thus, more than half the decimal
places given in the #defines are complete garbage; the first place in
error is the 1e-16 place and of course the rest are meaningless.

Does anyone know why the discrepancy?  Does anyone know whether it
would break anything to correct them?  A quick glance makes me think
they are used only in floating-point arithmetic and thus anything below
the machine's level of FPU accuracy is useless.  I would suspect the
#defines given of being the decimal conversion of someone's
floating-point computation of the cube roots, but the details of the
values make that seem unlikely.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index