Re: rounding digits after decimal sign

2007-02-02 Thread Christian Hammers
On 2007-01-31 [EMAIL PROTECTED] wrote: Can anyone point me to a section of manual or link how to reduce digits Lookup the manual for round() but be sure that you understand it if you use round in financial applications as it might be unexpected for you: mysql SELECT 25E-1 = 2.5,

Re: rounding digits after decimal sign

2007-02-01 Thread ViSolve DB Team
Hi, If you want to round your value to the specified no. of digits, use round(). Else if you want to extract the values without rounding use truncate(). mysql select round(blustat,2) from parts; [the value will get rounded to the nearest decimal] or mysql select truncate (blustat,2) from

rounding digits after decimal sign

2007-01-31 Thread Dimitar Vasilev
Hello, Can anyone point me to a section of manual or link how to reduce digits after a decimal sign? I have a table mysql desc part; +-+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra |

Re: rounding digits after decimal sign

2007-01-31 Thread dpgirago
Dimitar Vassilev asks: Hello, Can anyone point me to a section of manual or link how to reduce digits after a decimal sign? I have a table mysql desc part; +-+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra |

tmestamp resolution problem (rounding off to a day)

2005-07-29 Thread Nick Sinclair
Hi All, I seem to be having a problem with the resolution using the timestamp function. I am accessing the database snort on an ACID/SNORT/MySQL installation utilizing a collection of shell scripts that are run as cron jobs and function as a bot adding and removing firewall rules (iptables).

timestamp resolution problem (rounding off to a day)

2005-07-29 Thread Nick Sinclair
Hi All, I seem to be having a problem with the resolution using the timestamp function. I am accessing the database snort on an ACID/SNORT/MySQL installation utilizing a collection of shell scripts that are run as cron jobs and function as a bot adding and removing firewall rules (iptables).

Re: tmestamp resolution problem (rounding off to a day)

2005-07-29 Thread Jigal van Hemert
Nick Sinclair wrote: [.] WHERE date_format(timestamp, '%Y-%m-%d %T') =DATE_SUB(CURDATE(),INTERVAL $BLACKLIST_DECAY HOUR) * ...It only resolves to the DAY and not an hourly resolution. I have included a script below that I use for debugging, the MySQL functionality is taken directly from one

Re: tmestamp resolution problem (rounding off to a day)

2005-07-29 Thread Nick
Jigal van Hemert wrote: Nick Sinclair wrote: [.] WHERE date_format(timestamp, '%Y-%m-%d %T') =DATE_SUB(CURDATE(),INTERVAL $BLACKLIST_DECAY HOUR) * ...It only resolves to the DAY and not an hourly resolution. I have included a script below that I use for debugging, the MySQL functionality

Insert decimals with rounding

2005-07-20 Thread sean c peters
Hi all. I am trying to figure out if there is a way to configure MySQL so that when inserts occur on decimal fields where the value being inserted has more precision than the field specification, then the value inserted is rounded instead of truncated. For example, if i have a column: Acres

Re: Insert decimals with rounding

2005-07-20 Thread Scott Haneda
on 7/20/05 2:23 PM, sean c peters at [EMAIL PROTECTED] wrote: Hi all. I am trying to figure out if there is a way to configure MySQL so that when inserts occur on decimal fields where the value being inserted has more precision than the field specification, then the value inserted is rounded

Re: Insert decimals with rounding

2005-07-20 Thread Michael Stassen
sean c peters wrote: Hi all. I am trying to figure out if there is a way to configure MySQL so that when inserts occur on decimal fields where the value being inserted has more precision than the field specification, then the value inserted is rounded instead of truncated. Rounding is what

RE: Odd rounding errors with 4.1

2005-02-23 Thread Gordon
This reminded me of one more difference between Windows and Linux/Unix. MySQL use the round function out of the host libraries. If you are on a Windows box the rule for rounding is if the column immediately to the right of the column you are rounding to is a 5 then round up i.e. make 2.485

Odd rounding errors with 4.1

2005-02-21 Thread Martin
that when doing SUM() on this decimal column, I get a strange rounding error (see below), and was hoping that someone out there can help me with this. My recent test involved the following three values from the column: 2.4950 2.5950 2.7700 (Chosen, for this example, as they are precise at few decimal

Re: Odd rounding errors with 4.1

2005-02-21 Thread Martin
Huh, you know. Now that I'm not at work and therefore don't have my numbers to check against, you're right. Man, I must need more coffee. Never mind me. :) May be back tomorrow, though, when I have the numbers in front of me. I know they didn't add up earlier... Martin Hassan Schroeder

Re: Odd rounding errors with 4.1

2005-02-21 Thread Dan Nelson
a series of SQL statements, and I noticed that when doing SUM() on this decimal column, I get a strange rounding error (see below), and was hoping that someone out there can help me with this. My recent test involved the following three values from the column: 2.4950 2.5950 2.7700 (Chosen

Re: Odd rounding errors with 4.1 [Duh, me!]

2005-02-21 Thread Martin
noticed that when doing SUM() on this decimal column, I get a strange rounding error (see below), and was hoping that someone out there can help me with this. My recent test involved the following three values from the column: 2.4950 2.5950 2.7700 (Chosen, for this example, as they are precise at few

Re: rounding problem

2004-10-26 Thread Amer Neely
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I came upon an alogrithm years ago somewhere that showed how to programmatically round numbers. Here it is: // num is the number we want to round. it may be int or fp. // what is what we want to round num to (ie nearest 10, 1/100, etc) // The rounding

rounding problem

2004-10-25 Thread Tom Butterworth
Hi I seem to be having problems returning the expected results when using the mysql ROUND() function. Rounding 3.565 to 2 decimal places i would expect to return 3.57 however using SELECT ROUND(3.565, 2); it returns 3.56. While using SELECT ROUND(3.575, 2); works as expected returning 3.58. I

RE: rounding problem

2004-10-25 Thread Edgar Meij
[mailto:[EMAIL PROTECTED] Verzonden: maandag 25 oktober 2004 19:35 Aan: [EMAIL PROTECTED] Onderwerp: rounding problem Hi I seem to be having problems returning the expected results when using the mysql ROUND() function. Rounding 3.565 to 2 decimal places i would expect to return 3.57 however

Re: rounding problem

2004-10-25 Thread V. M. Brasseur
integers depends on the C library implementation. Different implementations round to the nearest even number, always up, always down, or always toward zero. If you need one kind of rounding, you should use a well-defined function such as TRUNCATE() or FLOOR() instead. http://dev.mysql.com/doc/mysql/en

Re: Odd Rounding?

2004-01-24 Thread Alec . Cawley
way to do this. I read in the manual that this behavior depends on the C library implementation, but how do you change it? To me, this is not normal behavior. Can anyone help? Thanks in advance... As stated in the manual, the behaviour of rounding a final digit 5 varies with the C library

Odd Rounding?

2004-01-23 Thread Andrew Kuebler
Can anyone explain why: SELECT ROUND(.012345, 5) - .01234 Why doesn't mysql round the 5 up to .01235? How do I get it to round up? I've tried manipulating ceil, floor, round and truncate and I can't seam to find an easy way to do this. I read in the manual that this behavior depends on the C

RE: Odd Rounding?

2004-01-23 Thread David Brodbeck
, and round down if it's even. (This averages out the bias you otherwise get with 5/4 rounding.) To see if this is what you're seeing, try rounding 0.012335 to 5 places...I bet it'll round up to 0.01234. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe

RE: Odd Rounding?

2004-01-23 Thread Andrew Kuebler
if the digit before the 5 is odd, and round down if it's even. (This averages out the bias you otherwise get with 5/4 rounding.) To see if this is what you're seeing, try rounding 0.012335 to 5 places...I bet it'll round up to 0.01234. -- MySQL General Mailing List For list archives: http

Re: Odd Rounding?

2004-01-23 Thread Mikhail Entaltsev
integers depends on the C library implementation. Some round to the nearest even number, always up, always down, or always toward zero. If you need one kind of rounding, you should use a well-defined function like TRUNCATE() or FLOOR() instead. Regards Georg Mikhail

Re: Odd Rounding?

2004-01-23 Thread Keith C. Ivey
On 23 Jan 2004 at 12:13, Andrew Kuebler wrote: Can anyone explain why: SELECT ROUND(.012345, 5) - .01234 Why doesn't mysql round the 5 up to .01235? How do I get it to round up? I've tried manipulating ceil, floor, round and truncate and I can't seam to find an easy way to do this.

RE: Odd Rounding?

2004-01-23 Thread Matt Lynch
Hi Andrew Consider using NUMERIC or DECIMAL to maintain precision. From the manual: The NUMERIC and DECIMAL types are implemented as the same type by MySQL, as permitted by the SQL-92 standard. They are used for values for which it is important to preserve exact precision, for example with

Rounding to nearest one sixteenth of an inch.

2004-01-12 Thread Richard Davies
Does anyone have any ideas on how to round a number in the form float(3,4) to the nearest sixteenth of an inch. eg ending in .0625, .125 .1875 .25 .3125 etc I haven't found anything in the manual about this, maybe normal people don't want to do this. -- Regards Richard -- MySQL General

Re: Rounding to nearest one sixteenth of an inch.

2004-01-12 Thread Dan Nelson
In the last episode (Jan 12), Richard Davies said: Does anyone have any ideas on how to round a number in the form float(3,4) to the nearest sixteenth of an inch. eg ending in .0625, .125 .1875 .25 .3125 ROUND(myfield*16)/16 should work. -- Dan Nelson [EMAIL

Re: Rounding to nearest one sixteenth of an inch. (Solved)

2004-01-12 Thread Richard Davies
On Monday 12 Jan 2004 22:23, you wrote: (B Richard Davies wrote: (B Does anyone have any ideas on how to round a number in the form (B float(3,4) to the nearest sixteenth of an inch. (B (B Multiply by 16, round, divide by 16. (B (BObvious really, (Bupdate table1 set field1 =

rounding off

2003-11-22 Thread Mike Blezien
Hello, I need the ability to round off dollar amounts to the nearest 100th of a dollar amount, IE $14.9564 to $14.96 or $132.1123 to $113.11 can this be accomplished with MySQL SQL function ?? TIA -- MikemickaloBlezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing

Re: rounding off

2003-11-22 Thread Paul DuBois
At 16:34 -0600 11/22/03, Mike Blezien wrote: Hello, I need the ability to round off dollar amounts to the nearest 100th of a dollar amount, IE $14.9564 to $14.96 or $132.1123 to $113.11 can this be accomplished with MySQL SQL function ?? Sounds like a job for TRUNCATE().

Re: rounding off

2003-11-22 Thread Mike Blezien
Thanks Paul. but I think the function I was looking for was ROUND(X,D), the TRUNCATE(X,D) just 'trims' it :) IE using the value 123.336 and I needed it to round off to 123.34 in this case. mysql select truncate(123.336,2); +-+ | truncate(123.336,2) |

Re: rounding off

2003-11-22 Thread Daniel Kiss
Hi! Use the round() function. round(14.9564, 2) = 14.96 round(32.1123, 2) = 113.11 Bye  Hello,  I need the ability to round off dollar amounts to the nearest 100th  of a dollar amount, IE $14.9564 to $14.96 or $132.1123 to $113.11  can this be accomplished with MySQL SQL function ?? --

RE: rounding behavior

2002-11-04 Thread Black, Kelly W [PCS]
Use the ROUND statement ROUND(sum(CLICKS),sum(IMPS)/sum(CLICKS)*100.0,0),2); -Original Message- From: David Garamond [mailto:davegaramond;icqmail.com] Sent: Sunday, November 03, 2002 2:31 AM To: [EMAIL PROTECTED] Subject: rounding behaviour hi, mysql select 1/29; +--+ | 1/29

Rounding floats

2002-10-23 Thread Michael T. Babcock
Kenneth Hylton wrote something about SQL or QUERYs: I NEVER use float or double to store values like you appear to be doing. I always used DECIMAL so that they are stored as strings and you do not have problems associated with what you see here. I then have complete control over what is stored

Re: Rounding floats

2002-10-23 Thread Jan Steinman
From: Michael T. Babcock [EMAIL PROTECTED] Kenneth Hylton wrote something about SQL or QUERYs: I NEVER use float or double to store values like you appear to be doing... FWIW, all of our financial database software stores values in either pennies or tenths of a cent, not dollars, to avoid

Re: Rounding floats

2002-10-23 Thread gerald_clark
Oh, for BCD floating point. My first computer with a language (SWTP 6800) had BCD math. It had something like 6 byte mantissa and a 1 byte exponent. That would give 11 digits with e +-99 Maybe we should have BCD data types. Jan Steinman wrote: From: Michael T. Babcock [EMAIL PROTECTED] Kenneth

RE: Rounding floats

2002-10-23 Thread Jon Frisby
to worry about rounding errors. (unless you're recording truly enormous sums of money...) -JF -Original Message- From: gerald_clark [mailto:gerald_clark;suppliersystems.com] Sent: Wednesday, October 23, 2002 10:10 AM To: Jan Steinman Cc: [EMAIL PROTECTED] Subject: Re: Rounding floats

re: Automatic rounding in INTERVAL calculations

2002-10-22 Thread Victoria Reznichenko
the INTERVAL processing aatdc so that a fractional formula is calculated BEFORE rounding the values aatdc in the formula. I tested your example on 4.0.4 and it works well: mysql select now(), now()- interval (0.1*60) minute

Automatic rounding in INTERVAL calculations

2002-10-21 Thread andrew
were more convenient. How-To-Repeat: select now(), now() - interval (0.1*60) minute; Fix: Perhaps change the order of operations within the INTERVAL processing so that a fractional formula is calculated BEFORE rounding the values in the formula. Submitter-Id: n

RE: rounding?!

2002-07-24 Thread Nicholas Stuart
] Subject: rounding?! Ok here's the problem. Trying to write a select statement to be able to round a set of numbers to the nearest quarter of an inch. Here is what I have so far: *--- -- * SELECT CONCAT(ROUND

rounding?!

2002-07-23 Thread Nicholas Stuart
Ok here's the problem. Trying to write a select statement to be able to round a set of numbers to the nearest quarter of an inch. Here is what I have so far: *-* SELECT CONCAT(ROUND(inside_length + (wall_thickness * 2),

RE: rounding?!

2002-07-23 Thread Gordon
Try round(value*4,0)/4 Worked on the samples I tried -Original Message- From: Nicholas Stuart [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 1:47 PM To: [EMAIL PROTECTED] Subject: rounding?! Ok here's the problem. Trying to write a select statement to be able to round

Re: Rounding times

2002-05-09 Thread Steve Edberg
Well, assuming the time is in seconds (as in a UNix timestamp), you could use rounding function: select 600 * round(time_in_seconds/600) (600 being # of seconds in 10 minutes). Read the docs for the round() function - http://www.mysql.com/doc/M/a/Mathematical_functions.html

Re: mysql rounding problem

2001-12-11 Thread Amer Neely
[ob. filter faker: mysql] For what it's worth, here's an algorithm I use to write my own rounding function. To round to the nearest N number of places. 1) divide the number by N 2) add .5 (for negative numbers subtract .5) 3) truncate the result (take integer part) 4) multiply result by N

Broken 'even number' rounding function

2001-09-18 Thread User Aaron
Description: Odd numbers round properly at the half (3.5) but even numbers don't (4.5). How-To-Repeat: mysql select round(15.5); +-+ | round(15.5) | +-+ | 16 | +-+ 1 row in set (0.01 sec) mysql select round(16.5); +-+ | round(16.5) |

RE: Broken 'even number' rounding function

2001-09-18 Thread Basil Hussain
Hi, Odd numbers round properly at the half (3.5) but even numbers don't (4.5). This sounds like you're misunderstanding an intentional feature. A lot of applications or system libraries do this to avoid giving 'incorrect' figures when summing large amounts of rounded numbers. Here's an

decimal(8,2) rounding bug or still to be expected behaviour?

2001-03-09 Thread Christian Hammers
Hello CREATE TABLE deci (deci decimal(8,2)); INSERT INTO deci VALUES (-2427.88); INSERT INTO deci VALUES (2427.89); INSERT INTO deci VALUES (-0.01); select sum(deci) as s from deci having s0; +---+ | s | +---+ | -0.00 | +---+ Well for the values given above - monetary values -

Antwort: decimal(8,2) rounding bug or still to be expected behaviour?

2001-03-09 Thread alexander . skwar
On 09.03.2001 10:29:28 Christian Hammers wrote: Is this a bug or is the decimal type just evil or how should *I* behave when having such a table? If I'm not mistaken, then decimal is handled internally like a float. And as such, problems like yours are really expected, because there simply

Re: decimal(8,2) rounding bug or still to be expected behaviour?

2001-03-09 Thread Gerald L. Clark
I think you meant select sum(deci) as s where deci0; Christian Hammers wrote: Hello CREATE TABLE deci (deci decimal(8,2)); INSERT INTO deci VALUES (-2427.88); INSERT INTO deci VALUES (2427.89); INSERT INTO deci VALUES (-0.01); select sum(deci) as s from deci having s0; +---+ | s

Re: decimal(8,2) rounding bug or still to be expected behaviour?

2001-03-09 Thread Christian Hammers
On Fri, Mar 09, 2001 at 08:13:24AM -0600, Gerald L. Clark wrote: I think you meant select sum(deci) as s where deci0; select sum(deci) as s from deci having s0; No, I really meant my SELECT. MySQL counted the 3 values together but instead of coming to the conclusion that the sum is zero it