missing 7th digit in float
missing 7th digit in float
am 16.10.2003 14:15:34 von peterbernhardt
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@m.gmane.org
Re: missing 7th digit in float
am 16.10.2003 16:12:51 von Sinisa Milivojevic
peterbernhardt@hsl.de writes:
> Hi all,
>=20
> 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?
>=20
> Regards
>=20
> Peter Bernhardt
>=20
>=20
> Hessisches Statistisches Landesamt
> Rheinstraße 35/37
> 65185 Wiesbaden
>=20
> Telefon: 0611 3802-165
> Telefax: 0611 3802-190
> Internet: http://www.hsl.de
>=20
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.
--=20
Sincerely,
--=20
For technical support contracts, go to https://order.mysql.com/?ref=3Dm=
smi
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
>
/ /|_/ / // /\ \/ /_/ / /__ 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@m.gmane.org
Re: missing 7th digit in float
am 16.10.2003 23:13:58 von Sergei Golubchik
Hi!
On Oct 16, peterbernhardt@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:
::=
FLOAT [ ]
| REAL
| DOUBLE PRECISION
::=
...
Syntax Rules
11) If a is omitted, then an implementation-defined
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
/ /|_/ / // /\ \/ /_/ / /__ 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@m.gmane.org
Re: missing 7th digit in float
am 21.10.2003 13:31:40 von Sergei Golubchik
Hi!
On Oct 20, peterbernhardt@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
/ /|_/ / // /\ \/ /_/ / /__ 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@m.gmane.org