missing 7th digit in float

Hi all,

my environment: WindowsNT4 with SP6, mysql4.0.15-max-nt
A select from a float field created with
create table ... (..., float)
or with
create table ... (..., float(24))
returns only 6 significant digits - the standard requires 7!
Only
create table ... (..., float(24,7))
works as expected.
Is this a bug, do I have to define every float field with "float(24,7)"=
or
is there a configuration option for this?

Regards

Peter Bernhardt


Hessisches Statistisches Landesamt
Rheinstraße 35/37
65185 Wiesbaden

Telefon: 0611 3802-165
Telefax: 0611 3802-190
Internet: http://www.hsl.de

=



--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=3Dgcdmb-bugs [at] m.gmane.org
peterbernhardt [ Do, 16 Oktober 2003 14:15 ] [ ID #76302 ]

Re: missing 7th digit in float

peterbernhardt [at] hsl.de writes:
> Hi all,
>
> my environment: WindowsNT4 with SP6, mysql4.0.15-max-nt
> A select from a float field created with
> create table ... (..., float)
> or with
> create table ... (..., float(24))
> returns only 6 significant digits - the standard requires 7!
> Only
> create table ... (..., float(24,7))
> works as expected.
> Is this a bug, do I have to define every float field with "float(24,7=
)" or
> is there a configuration option for this?
>
> Regards
>
> Peter Bernhardt
>
>
> Hessisches Statistisches Landesamt
> Rheinstraße 35/37
> 65185 Wiesbaden
>
> Telefon: 0611 3802-165
> Telefax: 0611 3802-190
> Internet: http://www.hsl.de
>

HI!

The above is expected behaviour. If you do not specify decimals a
default will be used.

Also, for higher number of significant digits then 7 you should use dou=
ble.

--

Sincerely,

--
For technical support contracts, go to https://order.mysql.com/?ref=3Dm=
smi
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic <sinisa [at] mysql.com=
>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB
/_/ /_/\_, /___/\___\_\___/ Fulltime Developer and Support Coordinat=
or
<___/ www.mysql.com Larnaca, Cyprus


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=3Dgcdmb-bugs [at] m.gmane.org
Sinisa Milivojevic [ Do, 16 Oktober 2003 16:12 ] [ ID #76305 ]

Re: missing 7th digit in float

Hi!

On Oct 16, peterbernhardt [at] hsl.de wrote:
> Hi all,
>
> my environment: WindowsNT4 with SP6, mysql4.0.15-max-nt
> A select from a float field created with
> create table ... (..., float)
> or with
> create table ... (..., float(24))
> returns only 6 significant digits - the standard requires 7!

What do you mean "the standard requires 7" ?
As far as I see the standard specifies:

<approximate numeric type> ::=
FLOAT [ <left paren> <precision> <right paren> ]
| REAL
| DOUBLE PRECISION

<precision> ::= <unsigned integer>

...

Syntax Rules

11) If a <precision> is omitted, then an implementation-defined
<precision> is implicit.

Thus, it's "implementation-defined".

> Only
> create table ... (..., float(24,7))
> works as expected.
> Is this a bug, do I have to define every float field with "float(24,7)" or
> is there a configuration option for this?

Please, explain why do you think that it's a bug.
We can consider changing the default, if old behaviour is incorrect.

Regards,
Sergei

--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg [at] mysql.com>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer
/_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany
<___/ www.mysql.com

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs [at] m.gmane.org
Sergei Golubchik [ Do, 16 Oktober 2003 23:13 ] [ ID #76307 ]

Re: missing 7th digit in float

Hi!

On Oct 20, peterbernhardt [at] hsl.de wrote:
>
> Hi Sergei,
>
> I won't say that the default of 6 is incorrect, but it's not what I
> expected because all I heard of the precision of floating point numbers
> till now is 7-8:
> from http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee-sgl.html
> The 32-bit (single precision) IEEE floating-point representation ...This
> means we get a bit more than 7 decimal digit precision.
> C and Java use this standard definition.
> All other database systems I could check (M$ SQLserver and Borland
> Interbase) provide 7 significant digits for the float datatype as default
> (Interbase has no option for it's configuration).
> I don't know the reason for your decision, but I think a default of 7 would
> be better for interoperatibility or a change from another database to
> mysql.

MySQL uses architecture-dependent format for float/double. Thus it also
uses architecture-dependent settings for float's precision. In
particular, 6 comes from float.h (in /usr/include/, or
/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/include/, or whatever), that
defines

#define FLT_DIG 6

Regards,
Sergei

--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg [at] mysql.com>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer
/_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany
<___/ www.mysql.com

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs [at] m.gmane.org
Sergei Golubchik [ Di, 21 Oktober 2003 13:31 ] [ ID #76311 ]
Datenbanken » gmane.comp.db.mysql.bugs » missing 7th digit in float

Vorheriges Thema: AUTO_INCREMENT inconsitent with MyISAM on mySQL 4.0.13-log
Nächstes Thema: [Fwd: Re: empty HOME variable crashes client]