473,774 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying a float8 as a full-length number

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.0000000 00000001' AS float8);
float8
--------
1e-15
(1 row)

db=# SELECT to_char(CAST('0 .00000000000000 1' AS float8),
CAST('0.9999999 999999999999999 999' AS text));
to_char
-------------------
0.0000000000000 0
(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.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 12 '05 #1
3 2521
Grant,

Cast it to numeric instead of float8.
SELECT CAST('0.00001' AS numeric);

Julie

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org

Nov 12 '05 #2
On Wed, Oct 08, 2003 at 12:48:09 -0500,
Grant Rutherford <gr*********@id ers.ca> wrote:

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:


How about casting it to numeric? It seemed to work reasonably for me,
but I only tried one case.

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #3
Julie May wrote:
Grant,

Cast it to numeric instead of float8.
SELECT CAST('0.00001' AS numeric);

Julie

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org

Thanks, that worked perfectly.

--
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.


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1775
by: shaun | last post by:
When asp.net pages are made in vs.net, loading on the local host displays the labels all in the top left corner of the screen. Also, all textboxes and image buttons are not even displayed at all. If pages are made on a remote server, they load perfetly fine, it is just the local host displaying them incorrectly. Is this a common problem?? I have iis 5.0 installed with windows 2000. i use the full version of vs.net to make asp.net pages.
3
5751
by: Mark C | last post by:
When aspx pages are made in vs.net, loading on the local host displays the labels all in the top left corner of the screen. Also, all textboxes and image buttons are not even displayed at all. If pages are made on a remote server, they load perfetly fine, it is just the local host displaying them incorrectly. Is this a common problem?? I have iis 5.0 installed with windows 2000. i use the full version of vs.net to make asp.net pages.
3
1968
by: Pat Sheen | last post by:
Is there some setting in Access so when I get help it will display full screen and not part screen with my Access window. I've Googled and checked help but can't find anything. Thanks Pat
8
3303
by: Jon Weston | last post by:
I'm setting up an Access2003 database with pictures. I put a bound ole picture ctrl on a form that's source is the table that contains the pictures and follow ALL the directions for embedding a picture. The ctrl in the form only displays the filename of the picture. The underlying table, when opened in table view, shows the word "package" in the field. When I double-click on either it opens the picture, but I can't get it to display. ...
3
1232
by: Milkstr | last post by:
I have a database of football players names, their names appear more than once if the table, i.e a players name might be there 10 times, the initial name is just a short version for ease, i then have a second field with their full name, but this only appears once, I want to do a sum of all their goals scored but display their full name that appears once and not their short name that appears 10 times or more. SELECT Players.PlayerName,...
4
1547
by: Blue10 | last post by:
Hi, I would like to be able to display thumbnail versions of the full images on my website. Currently I have to make the thumbnails manually so I wonder if there is any way of displaying reduced size and resolution version of the original images in a webpage automatically? I believe autotrader do this on http://www.autotrader.co.uk (I could be wrong) but I cannot see how. I am a novice at Javascript so if someone is clever and kind enough to...
1
5352
by: gouse | last post by:
Hi Friends, when I have convert the float4 data type to float8 data type it was lossing the value. The following are the commands i Have used. Plaese go through it. (1) TE TABLE tab1(id int PRIMARY KEY,val float4); (2) INSERT INTO tab1 VALUES(1,1.1); INSERT INTO tab1 VALUES(2,1.2); INSERT INTO tab1 VALUES(3,1.3);
1
5985
by: hbkiwi | last post by:
Hi, Just playing with Access fairly new to it (like days old). Also it's my first post here so if I'm in the wrong place, sorry.. What I'm wanting to know is basically I have lets call it Table Data and I've got Last Name, First Name in the columns. I than have Table Full Name, with column Full Name. I have a relationship between the primary key of Table Data and the column Full Name. I have a form that displays the Full Name column. Its in...
11
9821
by: Usenet User | last post by:
..NET 1.1/2.0 I have a need to display high-resolution scrollable images in a .NET application (Windows Forms). One well known solution is to create a Panel with AutoScroll set to "true" and then add a PictureBox or another Panel to it, that is used to display the image. The above approach works, however, to my surprise, .NET GDI+-based graphics are not really hi-res friendly.
7
6672
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a tabcontainer which has 1 panel already, however I want to try create the TabPanels dynamically. I followed the advice here: http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment - Joe Stagner)
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4012
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.