NumericBox unsafe double conversion
Jan Holesovsky
kendy at suse.cz
Thu Mar 21 01:57:00 PDT 2013
Hi Tamás,
Zolnai Tamás píše v St 20. 03. 2013 v 22:33 +0100:
> Yes, I give it a try.
Great, thanks a lot! :-)
> I think the mentioned multiplication is in
> MetricField::ConvertDoubleValue(), which not need to change, as I see.
So whenever we are converting to and from double, there is the risk of
losing precision. I guess the best would be to change
ConvertDoubleValue() to sal_Int64 too [and change the name
accordingly ;-)], and use BigInt (see tools/inc/tools/bigint.hxx) for
the computations not to overflow.
Though - looking at BigInt - I am afraid you will have to add
BigInt( long long nVal ) constructor in order to make 32bit
architectures happy when you provide them with sal_Int64.
Similarly, you will have to create an operator long long() const; that
would return the long long - and would do that even in the bIsBig case
when the value is larger than long, but still fits sal_Int64.
I am sorry this is getting complicated - but I believe this is a cleanup
that is still worth doing :-)
All the best,
Kendy
More information about the LibreOffice
mailing list