Обсуждение: Wider than float8
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]
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. +
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
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. +