<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 6/14/2011 9:56 AM, Bart Pietercil wrote:
<blockquote
cite="mid:F5C504E7-2F0C-4050-A001-320E0801143D@cognosis.be"
type="cite">
<pre wrap="">Hi,
that would be precision and scale
approximate_numeric_type
: FLOAT [ ( precision [, scale ] ) ]
| DOUBLE [ ( precision [, scale ] ) ]
However no more explanation is to be found . An explanation (maybe with an example) would come in handy.
tia,
Bart Pietercil
CTO Cognosis NV
On 14 Jun 2011, at 07:59, Ruslan Zasukhin wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On 6/12/11 2:03 PM, "Bart Pietercil" <a class="moz-txt-link-rfc2396E" href="mailto:bart.pietercil@cognosis.be"><bart.pietercil@cognosis.be></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">No, we've been bitten also (in vReports, doubles show up the same way,
annoying).
Bart Pietercil
CTO Cognosis NV
On 11 Jun 2011, at 11:25, Francois Van Lerberghe wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hello,
Using V4RB 4.3 mac_ub, if you store 12.345 in a VDouble,
VDouble.GetString return " 12.345000" (15 char long).
In the previous versions (v1, v2, v3.5), VDouble.GetString gave me "12.345".
This change broke a lot of my existing code.
Am I the only one who is affected by this change ?
Is it a bug or is it intentional ?
Can I modify this ?
</pre>
</blockquote>
</blockquote>
<pre wrap="">
DOUBLE and FLOAT fields
More than year or two have additional properties
scale and ...
I believe they control how value is converted into string.
</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<br>
Exactly. Precision and scale are for formatting double/float values
getting them as a string values.<br>
Default values are following:<br>
<br>
For float - precision 6, scale 5<br>
For double - precision 15, scale 6<br>
<br>
You can manually set different settings: <br>
<br>
create table t1 ( f1 double (10,2) )<br>
<br>
insert into t1 values ( 1.0 )<br>
insert into t1 values ( 1.1 )<br>
insert into t1 values ( 1.123 )<br>
insert into t1 values ( 12345678901.123 )<br>
<br>
select f1 from t1<br>
--<br>
" 1.00"<br>
" 1.10"<br>
" 1.12"<br>
"12345678901.12"<br>
<br>
<br>
In other words - precision is a minimal length for value (including
decimal point)<br>
scale is a count of symbols after decimal point.<br>
<br>
It is for "light" formatting of approximate values in a string
representation.<br>
<br>
Pay attention to the fact that both precision and scale don't affect
the value - they are only about<br>
formatting it.<br>
<br>
For example - you may apply "format" sql-function to get different
results:<br>
<br>
<span class="Apple-style-span" style="border-collapse: separate;
color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style:
normal; font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; orphans: 2; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; font-size: medium;"><span
class="Apple-style-span" style="color: rgb(51, 51, 51);
font-family: Geneva,Arail,Helvetica,sans-serif; font-size: 12px;
line-height: 18px; text-align: justify;">
<pre class="code sql" style="padding: 0.5em; margin: 0px 0px 1em; font-size: 12px; border: 1px dashed rgb(204, 204, 204); color: rgb(51, 51, 51); overflow: auto; background-color: rgb(247, 249, 250); width: auto ! important;"><span class="kw1" style="padding: 0px; margin: 0px; color: rgb(177, 177, 0);">SELECT</span> <span class="search_hit" style="padding: 0px; margin: 0px; color: rgb(51, 51, 51); background-color: rgb(255, 255, 153);">FORMAT</span><span class="br0" style="padding: 0px; margin: 0px; color: rgb(102, 204, 102);">(</span><span class="nu0" style="padding: 0px; margin: 0px; color: rgb(204, 102, 204);">123456.123456</span><span class="sy0" style="padding: 0px; margin: 0px; color: rgb(102, 204, 102);">,</span> <span class="st0" style="padding: 0px; margin: 0px; color: rgb(255, 0, 0);">'###.##'</span><span class="br0" style="padding: 0px; margin: 0px; color: rgb(102, 204, 102);">)</span>;</pre>
</span></span>1<br>
1.1<br>
1.123<br>
12345678901.123<br>
<br>
Again - it is only about string output.<br>
<pre class="moz-signature" cols="72">--
Best regards,
Ivan Smahin
Senior Software Engineer
Paradigma Software, Inc
Valentina - The Ultra-Fast Database
<a class="moz-txt-link-freetext" href="http://www.valentina-db.com">http://www.valentina-db.com</a></pre>
</body>
</html>