main.func_math fails due to precision error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Drizzle |
Fix Released
|
Medium
|
Ross M. |
Bug Description
differences in precision are causing func_math test to fail. log(3,9) is
expecting exactly 2, but on freebsd gets 2.0000000000000
a simple program doing log(9) / log(3) produces the following on linux, and
freebsd:
animal$ uname -a
Linux animal 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 22:12:12 UTC 2009 x86_64 GNU/Linux
animal$ ./log
2.1972245773362
rowlf$ uname -a
FreeBSD rowlf.local 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 08:58:24 UTC 2009 <email address hidden>
rowlf$ ./log
2.1972245773362
log(9) is identical on both systems, but log(3) differs after 15 or 16 digits
and the division of log(9) / log(3) effectively doubles that error.
i'm at a loss as to how to address this one. it seems like the freebsd log call
can return data less accurately than linux, but i'm not sure it's safe to assume
that you have a full double's worth of precision in those sorts of calculations.
don't think there'll be a patch i can attach to this one without some
discussion...
- test failure -------
main.func_math [ fail ]
--- ../tests/
+++ ../tests/
@@ -44,7 +44,7 @@
Note 1003 select abs(-(10)) AS `abs(-10)
select log(exp(
log(exp(10)) exp(log(
-10 10.000000000000002 NULL NULL NULL 2 NULL NULL
+10 10.000000000000002 NULL NULL NULL 2.0000000000000004 NULL NULL
Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
Related branches
- Drizzle Developers: Pending requested
- Diff: None lines
- No reviews requested
- Diff: None lines
Changed in drizzle: | |
status: | Fix Committed → Fix Released |
Floating point is different for each platform. The test... well it is
likely to not be exact.
On Aug 3, 2009, at 9:31 PM, Ross M. wrote:
> Public bug reported: 004440892. 195642164 / 1.0986122886681 097821082 = 000000000 :/usr/obj/ usr/src/ 195642164 / 1.0986122886681 095600636 = 004440892 ------- ------- ------- ------- ------- ------- ------- ------- -- r/func_ math.result 2009-08-04 07:07:52.669905696 +0300 r/func_ math.reject 2009-08-04 07:15:33.773824490 +0300 `,sign( -(5)) AS )*2),log( -1),log( NULL),log( 1,1),log( 3,9),log( -1,2),log( NULL, sqrt(10) )*2) log(-1) log(NULL) log(1,1) /bugs.launchpad .net/bugs/ 408694 004440892. 195642164 / 1.0986122886681 097821082 = 000000000
>
> differences in precision are causing func_math test to fail.
> log(3,9) is
> expecting exactly 2, but on freebsd gets 2.0000000000000
>
> a simple program doing log(9) / log(3) produces the following on
> linux, and
> freebsd:
>
> animal$ uname -a
> Linux animal 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 22:12:12
> UTC 2009 x86_64 GNU/Linux
> animal$ ./log
> 2.1972245773362
> 2.0000000000000
>
> rowlf$ uname -a
> FreeBSD rowlf.local 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1
> 08:58:24 UTC 2009 <email address hidden>
> sys/GENERIC amd64
> rowlf$ ./log
> 2.1972245773362
> 2.0000000000000
>
> log(9) is identical on both systems, but log(3) differs after 15 or
> 16 digits
> and the division of log(9) / log(3) effectively doubles that error.
>
> i'm at a loss as to how to address this one. it seems like the
> freebsd log call
> can return data less accurately than linux, but i'm not sure it's
> safe to assume
> that you have a full double's worth of precision in those sorts of
> calculations.
> don't think there'll be a patch i can attach to this one without some
> discussion...
>
> - test failure
> -------
>
> main.func_math [ fail ]
>
> --- ../tests/
> +++ ../tests/
> @@ -44,7 +44,7 @@
> Note 1003 select abs(-(10)) AS `abs(-10)
> `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
> select
> log
> (exp
> (10
> )),exp
> (log
> (sqrt(10)
> 2);
> log(exp(10)) exp(log(
> log(3,9) log(-1,2) log(NULL,2)
> -10 10.000000000000002 NULL NULL NULL 2 NULL NULL
> +10 10.000000000000002 NULL NULL NULL 2.0000000000000004 NULL NULL
> Warnings:
> Error 1365 Division by 0
> Error 1365 Division by 0
>
> ** Affects: drizzle
> Importance: Undecided
> Status: New
>
>
> ** Tags: freebsd
>
> --
> main.func_math fails due to precision error
> https:/
> You received this bug notification because you are a member of
> Drizzle-
> developers, which is subscribed to Drizzle.
>
> Status in A Lightweight SQL Database for Cloud and Web: New
>
> Bug description:
> differences in precision are causing func_math test to fail.
> log(3,9) is
> expecting exactly 2, but on freebsd gets 2.0000000000000
>
> a simple program doing log(9) / log(3) produces the following on
> linux, and
> freebsd:
>
> animal$ uname -a
> Linux animal 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 22:12:12
> UTC 2009 x86_64 GNU/Linux
> animal$ ./log
> 2.1972245773362
> 2.0000000000000
>
> rowlf$ uname -a
> FreeBSD rowlf.local 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1
> ...