Wider than float8

Started by Vincenzo Romanoalmost 19 years ago4 messagesgeneral
Jump to latest
#1Vincenzo Romano
vincenzo.romano@gmail.com

Hi all.
On most modern CPUs there are numeric representations wider than 8-bytes
(aka float8 in PGSQL).

For example, Intel/AMD CPUs have native 12-bytes floating point numbers (aka
long double in C/C++).

I understand that it could not be non-standard from a clean SQL point of view.
Nonetheless, is there any way to use those "long doubles" in SQL?

Many thanks.

--
Vincenzo Romano
--
Maybe Computer will never become as intelligent as Humans.
For sure they won't ever become so stupid. [VR-1988]

#2Bruce Momjian
bruce@momjian.us
In reply to: Vincenzo Romano (#1)
Re: Wider than float8

Vincenzo Romano wrote:

Hi all.
On most modern CPUs there are numeric representations wider than 8-bytes
(aka float8 in PGSQL).

For example, Intel/AMD CPUs have native 12-bytes floating point numbers (aka
long double in C/C++).

I understand that it could not be non-standard from a clean SQL point of view.
Nonetheless, is there any way to use those "long doubles" in SQL?

No. Frankly I didn't know 12-byte floats were supported in CPUs until
you posted this. You could write your own data type to use it, of
course.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#3Felix Morley Finch
felix@crowfix.com
In reply to: Bruce Momjian (#2)
Re: Wider than float8

On Fri, Jun 08, 2007 at 03:00:35PM -0400, Bruce Momjian wrote:

No. Frankly I didn't know 12-byte floats were supported in CPUs until
you posted this. You could write your own data type to use it, of
course.

I didn't either, and have no use for them, but curiousity compels me
to wonder how hard this would be. I don't have the sources right at
hand. Is all float8 code in one source file, and would it be a pretty
simple matter to add float 12 with a search and replace and not much
more?

--
... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
Felix Finch: scarecrow repairman & rocket surgeon / felix@crowfix.com
GPG = E987 4493 C860 246C 3B1E 6477 7838 76E9 182E 8151 ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o

#4Bruce Momjian
bruce@momjian.us
In reply to: Felix Morley Finch (#3)
Re: Wider than float8

felix@crowfix.com wrote:

On Fri, Jun 08, 2007 at 03:00:35PM -0400, Bruce Momjian wrote:

No. Frankly I didn't know 12-byte floats were supported in CPUs until
you posted this. You could write your own data type to use it, of
course.

I didn't either, and have no use for them, but curiousity compels me
to wonder how hard this would be. I don't have the sources right at
hand. Is all float8 code in one source file, and would it be a pretty
simple matter to add float 12 with a search and replace and not much
more?

You would look in src/backend/utils/adt/float.c for the existing float8
data types, and in /contrib for examples of creating data types that are
not in the backend by default.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +