Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > Re: rounding pr...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 36 Topic 15511 of 16988
Post > Topic >>

Re: rounding problems

by justin@[EMAIL PROTECTED] (Justin) May 12, 2008 at 05:02 PM

This is a multi-part message in MIME format.
--------------050502050002010700080900
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit



Craig Ringer wrote:
> Justin wrote:
>
>> No floating point is being used every variable is declared as numeric 
>> on the Postgresql side and in the C++  which is the UI side 
>> everything is double.
>
> `double' in C++ refers to double precision floating point. `double' is 
> subject to all the usual fun with rational decimals being irrational 
> binary floats (and vice versa).
>
> One of the reasons I chose Java for my current work is that it has a 
> built-in decimal type (like `numeric') called BigDecimal . This makes 
> working with exact quantities a lot easier as there's no conversion 
> and rounding occurring each time data goes to/from the database.
Not according to MS specific if i'm reading it correctly

*Microsoft Specific >*

The double type contains 64 bits: 1 for sign, 11 for the exponent, and 
52 for the mantissa. Its range is +/--1.7E308 with at least 15 digits of 
precision
>
> Are there any particular decimal/numeric libraries people here like to 
> use with C++ ? Or do you just use double precision floats and a good 
> deal of caution?
>
> I'd expect that using double would be OK so long as the scale of your 
> numeric values never approaches the floating point precision limit of 
> the double type. I'm far from sure about that, though, and it'd be 
> handy to hear from people who're doing it. Personally I like to stick 
> to numeric/decimal types.
>
> -- 
> Craig Ringer

--------------050502050002010700080900
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<br>
Craig Ringer wrote:
<blockquote cite="mid:4828A892.2030006@[EMAIL PROTECTED]
"
 type="cite">Justin wrote:
  <br>
  <br>
  <blockquote type="cite">No floating point is being used every
variable is declared as numeric on the Postgresql side and in the
C++&nbsp;
which is the UI side everything is double.
    <br>
  </blockquote>
  <br>
`double' in C++ refers to double precision floating point. `double' is
subject to all the usual fun with rational decimals being irrational
binary floats (and vice versa).
  <br>
  <br>
One of the reasons I chose Java for my current work is that it has a
built-in decimal type (like `numeric') called BigDecimal . This makes
working with exact quantities a lot easier as there's no conversion and
rounding occurring each time data goes to/from the database.
  <br>
</blockquote>
Not according to MS specific if i'm reading it correctly<br>
<p><b>Microsoft Specific &gt;</b></p>
The double type contains 64
bits: 1 for sign, 11 for the exponent, and 52 for the mantissa. Its
range is +/&#8211;1.7E308 with at least 15 digits of precision<br>
<blockquote cite="mid:4828A892.2030006@[EMAIL PROTECTED]
"
 type="cite"><br>
Are there any particular decimal/numeric libraries people here like to
use with C++ ? Or do you just use double precision floats and a good
deal of caution?
  <br>
  <br>
I'd expect that using double would be OK so long as the scale of your
numeric values never approaches the floating point precision limit of
the double type. I'm far from sure about that, though, and it'd be
handy to hear from people who're doing it. Personally I like to stick
to numeric/decimal types.
  <br>
  <br>
--
  <br>
Craig Ringer
  <br>
</blockquote>
</body>
</html>

--------------050502050002010700080900--
 




 36 Posts in Topic:
rounding problems
justin@[EMAIL PROTECTED]   2008-05-12 13:48:16 
Re: rounding problems
lyeoh@[EMAIL PROTECTED]   2008-05-13 02:07:09 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-12 14:54:47 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-12 15:08:11 
Re: rounding problems
craig@[EMAIL PROTECTED]   2008-05-13 04:29:06 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-12 17:02:30 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-12 17:09:57 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-12 17:23:15 
Re: rounding problems
craig@[EMAIL PROTECTED]   2008-05-13 05:50:16 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-12 18:37:02 
Re: rounding problems
aanderson@[EMAIL PROTECTE  2008-05-12 19:04:13 
Re: rounding problems
sam@[EMAIL PROTECTED] (S  2008-05-13 02:20:18 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-12 22:51:42 
Re: rounding problems
craig@[EMAIL PROTECTED]   2008-05-13 11:42:09 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-13 00:16:06 
Re: rounding problems
xof@[EMAIL PROTECTED] (C  2008-05-12 14:53:21 
Re: rounding problems
craig@[EMAIL PROTECTED]   2008-05-13 05:26:46 
Re: rounding problems
aanderson@[EMAIL PROTECTE  2008-05-12 14:18:57 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-12 14:49:48 
Re: rounding problems
tometzky@[EMAIL PROTECTED  2008-05-13 08:40:41 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-13 11:30:48 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-13 13:29:07 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-13 14:36:18 
Re: rounding problems
sam@[EMAIL PROTECTED] (S  2008-05-14 15:38:17 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-14 11:47:52 
Re: rounding problems
sam@[EMAIL PROTECTED] (S  2008-05-14 17:26:30 
Re: rounding problems
sam@[EMAIL PROTECTED] (S  2008-05-14 20:27:19 
Re: rounding problems
aanderson@[EMAIL PROTECTE  2008-05-14 16:02:32 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-14 16:08:54 
Re: rounding problems
aanderson@[EMAIL PROTECTE  2008-05-14 16:24:58 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-14 16:55:49 
Re: rounding problems
glene77is <glen.e77is@  2008-05-20 03:19:20 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-20 10:28:28 
Re: rounding problems
aanderson@[EMAIL PROTECTE  2008-05-12 15:56:30 
Re: rounding problems
justin@[EMAIL PROTECTED]   2008-05-13 13:01:11 
Re: rounding problems
doug@[EMAIL PROTECTED] (  2008-05-13 12:12:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 10:37:47 CDT 2008.