Displaying a float8 as a full-length number

From: Grant Rutherford <grutherford(at)iders(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Displaying a float8 as a full-length number
Date: 2003-10-08 17:48:09
Message-ID: 3F844DD9.40104@iders.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I need to get a float8 to display as a number

db=# SELECT CAST('0.00001' AS float8);
float8
--------
1e-05
(1 row)

I need this to return 0.00001 instead. I know about the to_char
function, but this seems to truncate the number after fourteen digits of
precision:

db=# SELECT CAST('0.000000000000001' AS float8);
float8
--------
1e-15
(1 row)

db=# SELECT to_char(CAST('0.000000000000001' AS float8),
CAST('0.9999999999999999999999999' AS text));
to_char
-------------------
0.00000000000000
(1 row)

Does anyone have any suggestions?

Thanks,
Grant

--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444
================================
Iders Incorporated: Confidential
================================
Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information. Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited. If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Josh Berkus 2003-10-08 17:49:55 Re: PostgreSQL vs. MySQL
Previous Message Julie May 2003-10-08 17:41:46 question on setof record returning plpgsql function