Subject | RE: [firebird-support] Double precision field problem |
---|---|
Author | ibrahim bulut |
Post date | 2006-10-30T17:07:26Z |
This problem does not happen all the records
Generally records are ok, but some records have problem
When i change the field's value manuel (with ibconsole)
Problem still occurs
Field1's value is exactly 79.69 and
Field2's value is exactly 78.12
because i have changed them manually
but result is not exact value
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Svein Erling Tysvaer
Sent: Monday, October 30, 2006 2:51 PM
To: Firebird-support
Subject: Re: [firebird-support] Double precision field problem
You get what you ask for, Ibrahim. Floating point numbers (e.g. double
precision) are good for measuring things, it doesn't matter whether the
length of a line is 1.57 metres or 1.5699999999999 metres. Field1
doesn't have the exact value 79.69, it has a value of approximately
79.69 (e.g. 79.69000000000000001238) and similar for Field2.
If such differences do matter, you should probably use fixed point
numbers - e.g. decimal or numeric.
HTH,
Set
ibrahim bulut wrote:
This message was checked by NOD32 antivirus system.
http://www.eset.com
[Non-text portions of this message have been removed]
Generally records are ok, but some records have problem
When i change the field's value manuel (with ibconsole)
Problem still occurs
Field1's value is exactly 79.69 and
Field2's value is exactly 78.12
because i have changed them manually
but result is not exact value
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Svein Erling Tysvaer
Sent: Monday, October 30, 2006 2:51 PM
To: Firebird-support
Subject: Re: [firebird-support] Double precision field problem
You get what you ask for, Ibrahim. Floating point numbers (e.g. double
precision) are good for measuring things, it doesn't matter whether the
length of a line is 1.57 metres or 1.5699999999999 metres. Field1
doesn't have the exact value 79.69, it has a value of approximately
79.69 (e.g. 79.69000000000000001238) and similar for Field2.
If such differences do matter, you should probably use fixed point
numbers - e.g. decimal or numeric.
HTH,
Set
ibrahim bulut wrote:
>__________ NOD32 1.1843 (20061030) Information __________
> i am in trouble double precision field with subtract operation
>
> field1 is double precision
> field2 is double precision
>
> field1's value is 79.69
> field2's value is 78.12
>
> when i subtract field2 from field1 with this sql statement
>
> select field1 - field2 from table1
>
> the result is 1,56999999999999
>
> the result must be 1,57
>
> what is the problem
>
> ibrahim bulut
> software and database expert
> iletisim online ltd.sti.
> turkish republic
This message was checked by NOD32 antivirus system.
http://www.eset.com
[Non-text portions of this message have been removed]