473,769 Members | 4,010 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Silent truncation of numeric values.


Hi,

How come numeric(10,2) accepting value 10.011 and truncating the .001
part ? Shudnt' it be complaining , i am not sure.
Regds
Mallah.
tradein_clients =# CREATE TABLE t_a ( a numeric (10,2) );
CREATE TABLE
tradein_clients =#
tradein_clients =#
tradein_clients =# \d t_a
Table "public.t_a "
Column | Type | Modifiers
--------+---------------+-----------
a | numeric(10,2) |

tradein_clients =# INSERT INTO t_a values(10.01);
INSERT 50817524 1
tradein_clients =# INSERT INTO t_a values(10.011);
INSERT 50817525 1
tradein_clients =#
tradein_clients =#
tradein_clients =# SELECT * from t_a;
a
-------
10.01
10.01
(2 rows)

tradein_clients =#
Nov 12 '05 #1
1 1667

On Sat, 22 Nov 2003, Rajesh Kumar Mallah wrote:
How come numeric(10,2) accepting value 10.011 and truncating the .001
part ? Shudnt' it be complaining , i am not sure.


AFAICS, the spec says that implementation-defined rounding or truncation
occurs if least significant digits would be lost. It appears to only be
an error if most significant digits would be lost.

For example:
If an assignment would result in a loss of the most significant digits,
an exception condition is raised. If least significant digits are lost,
implementation-defined rounding or truncating occurs with no exception
condition being raised.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #2

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

Similar topics

0
1298
by: PiErre | last post by:
Hi, I used to install python 2.2 with the option /s (silent) on win2k server. Now I migrated to python 2.3 (Python-2.3.4.exe) and it seems to me that in all the registry values the drive is missing EG: under HKEY_CLASSES_ROOT\Python.NoConFile\DefaultIcon The (Default) values I found is \Python23\Py.ico
0
1111
by: JezB | last post by:
I want to compare two DateTime values but only down to seconds, so how do I truncate DateTime values to second granularity ? Similarly, I may want to truncate to the minute granularity. I also may want to round to the nearest minute. How do I do these things ? I'm sure it must be really simple but I cant find anything in the DateTime class. I know I can convert to a numeric date and time format and do a string compare but I imagine this...
3
6535
by: success_ny | last post by:
Does anyone have a code snippet to compare those values so I can sort the array of alpha-numeric values that include both characters and integers in it? I.e., if we have values like 4236 and 123234, I want 4236 to be second because 4 is bigger than 1 rather than using the numeric comparison. The strings can include character values and strings. Basically, I have the bubble sort function, the question is how to compare those types of...
26
7785
by: Alfonso Morra | last post by:
Hi, I'm getting a compiler error of "pointer truncation from 'void *' to 'int'" because I'm not explicitly casting from void* to (datatype*). Pointers are stored as ints (is that right?), so as AFAIK, there is nothing to worry about is there? I'm using VC 7.1 Why are such assignments being treated as errors?
6
9228
by: M.A. Oude Kotte | last post by:
Hi All, I hope this is the correct mailing list for this question. But neither postgresql.org nor google could help me out on this subject. I did find one disturbing topic on the mailing list archives (http://archives.postgresql.org/pgsql-admin/2000-05/msg00032.php), but since it was quite old I'm posting my question anyway. I'm writing a generic database layer that should support a fixed number of generic numeric types on a number of...
7
1663
by: Sheldon | last post by:
Hi, I have the following loop that I think can be written to run faster in Numeric. I am currently using Numeric. range_va = main.xsize= 600 main.ysize= 600 #msgva is an (600x600) Numeric array with mutiple occurrences of the values in range_va #sat_id is an (600x600) Numeric array with values ranging from -2 to 2
1
1860
by: Serman D. | last post by:
Background: The Payment Card Industry (PCI) Data Security Standard (PCI DSS) is a standard for financial institutions. It requires sensitive information, such as credit card numbers, to be "unreadable anywhere it is stored" using hashing, truncation or encryption. I am looking for a simple truncation function that replaces the last four digits in the given numeric with four characters (e.g. '*'). As as Perl programmer (where a simple...
112
5475
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions that may print some messages. foo(...) { if (!silent)
13
32709
by: chromis | last post by:
Hi, I have a query which updates the projects table of my database, however when I try to run my query with blank values i get the following error: Data truncation: Data truncated for column 'date' at row 1 I have done some researching and I believe the problem is to do with the data that is being sent by my cfqueryparam function. Here is my create function:
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10047
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
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...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3962
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
3563
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.