The solution for this case was to use the decimal format with the 4
decimals. The float was doing the rounding. Thank you.

Jacques Paris

-----Original Message-----
From: Katrin [mailto:[EMAIL PROTECTED]
Sent: 3-Dec-03 08:47
To: [EMAIL PROTECTED]; MapInfo-L
Subject: Re: MI-L precision in values stored in a table

Hi!

Here are some thoughts:
If the string includes delimiter of float and integer parts, it should be
".", not ",". And Val() really rounds values. In order to get proper number
from a string you'd use function DeformatNumber$().
Also instead float column you can use decimal column - there could be set
how many digits after dot to save.

Jacques Paris Wrote:

I must retrieve values from a text files. I use a mid$() to extract the
string and I store in a table the value obtained by VAL(), a very standard
procedure.

While checking the results, I discovered that the stored values are not
exactly the values in the text file. The differences are mainly for numbers
with originally 4 decimals. The stored values are rounded up even if I use a
format$() to make sure that the 4 digits are printed (In some cases the
stored values look rounded but the decimal digits can be there).

Here is an example from within the MapBasic window: "259.9995" read as a
string variable and converted into VAL() prints as 260 but with a
FORMAT$(val( ),"#.####") gives the original 259.9995

However, the same value stored in a table reads 260 and prints with a
format$() as 260.0

As an extension to that observation: all 4 decimal digit numbers are stored
with 3 decimal digits, with rounding on the 3th digit (or preceding one...)

The column is dim'ed as float. MB/MI 6.5

Is there a way to "force" the stored value to be exactly what is read in the
input file? I.e. to control the number of decimals in a float column?

TIA

Jacques Paris
e-mail [EMAIL PROTECTED]
MapBasic-MapInfo support http://www.paris-pc-gis.com





---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 9404


Best Regards,
Katerinka
  _____

Do you Yahoo!?
Free Pop-Up Blocker - Get it now
<http://us.rd.yahoo.com/slv/mailtag/*http://companion.yahoo.com/>

Reply via email to