<div>Hi Kendy,</div><div><br></div>2013/3/20 Jan Holesovsky <span dir="ltr"><<a href="mailto:kendy@suse.cz" target="_blank">kendy@suse.cz</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Tamás,<br>
<br>
Zolnai Tamás pí¹e v Po 18. 03. 2013 v 17:56 +0100:<br>
<div class="im"><br>
<br>
> And the problem was found in this function, in line 199:<br>
> double nValue = rtl::OUString(aStr).toDouble();<br>
><br>
><br>
> In general the NumericBox store its data in an sal_Int64 variable, but<br>
> here this OUString->double conversion cause changes in big numbers.<br>
> The "aStr" variable comes from GetText() function, which gives the<br>
> NumericBox's content, so it is a string representation of an sal_Int64<br>
> value. I don't know this behaviour is the expected from the<br>
> OUString::toDouble() function, or it is a bug.<br>
<br>
</div>Terribly sorry for my late answer.  I read the code there, and I'd just<br>
kill the double from the code that is there (ie. from all the methods<br>
that call ImplNumericGetValue() etc.), and instead of<br>
OUString::toDouble() used OUString::toInt64().<br>
<br>
The logic of ImplNumericGetValue() is that it splits the number to part<br>
in front of the decimal point/comma, and after that, creates one<br>
sal_Int64 number from that, and converts that to double.  Nevertheless,<br>
later it is converted back to sal_Int64.  If the conversion to double<br>
was there to avoid some overflows, the value will overflow anyway as<br>
soon as you try to convert it back; but of course, you should be careful<br>
when doing your changes, mostly in the area of conversions that include<br>
multiplication.<br></blockquote><div><br></div><div style="font-size:13px;color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)">Yes, I give it a try. I think the mentioned multiplication is in MetricField::ConvertDoubleValue(), which not need to change, as I see.</div>
<div style="font-size:13px;color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)">I think three function would be changed:</div><div style="font-size:13px;color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)">
ImplNumericGetValue(), ImplMetricGetValue(), ImplCurrencyGetValue()</div><div style="font-size:13px;color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)">The out parameter of these funcitons would be sal_Int64 instead of double.</div>
<div><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">In ImplMetricGetValue() usage of </span><font color="#222222" face="arial, sans-serif">MetricField::ConvertDoubleValue() would be changed only with little things.</font></div>
<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif">Call it with (double)rValue as its first parameter and cast its return value to sal_Int64.</span></div><div>So I make it in this way, and will see wheather it solves the problem.</div>
<div><br></div><div>Best regards,</div><div>Tamás </div></div><br>