XMP, Krita, KFileMetaInfo and Strigi
Tobias G. Pfeiffer
tgpfeiffer at web.de
Fri Jun 22 22:14:13 BST 2007
Hi!
On Friday 22 June 2007, 19:09, Jos van den Oever wrote:
> 2007/6/22, Cyrille Berger <cberger at cberger.net>:
> > > > - it lacks some important types like rationals
> > >
> > > a double is not a rational? QVariant::Double
> >
> > Yes it is, but a rational isn't a double, it's a division between two
> > integers.
> > For instance, there is no double representation of the rational 2 / 3
> > (0.66666666666666666666666666666666 is just an approximation, even if the
> > mathematical theory says that 0.666 followed only by 6 is equal to 2 / 3,
> > but there is no way to represent such a thing in double, 2/3 is
> > represented by 0.666..67 in a double anyway).
>
> It is very simple and not expensive to find a nice rational from a
> double.
What do you mean by "not expensive"? And what by "nice"? For every number that
is stored as a double, there are infinitely many rational numbers that give
that result. With both numerator and denominator being represented by a
finite number of bits, you end up with a finite number of possible
combinations, yeehaw. Now you don't even want to find a rational that has the
same value as this double, but something "nice" that has a *similar* value as
the given double. (Funny: look at 1.001002004008016032064128256, which might
look very constructed, with powers of 2, but is actually the result of
999/998, continuing with digits 513 = 512 + 001024 etc.) -- Maybe this is a
bit academic, but it seems to me as if storing a pair of integers is waaaay
less problematic than trying to recreate such a representation from a double.
Bye
Tobias
--
follow the penguin...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070622/8c163208/attachment.sig>
More information about the kde-core-devel
mailing list