Issue Details (XML | Word | Printable)

Key: CORE-4409
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Alexander Peshkov
Reporter: Carlos H. Cantu
Votes: 2
Watchers: 5
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Enhancement in precision of calculations with NUMERIC/DECIMAL

Created: 28/Apr/14 06:52 PM   Updated: 12/Aug/18 09:53 AM
Component/s: Engine
Affects Version/s: 2.1.5, 2.5.2, 2.1.5 Update 1, 2.5.2 Update 1, 3.0 Alpha 1, 3.0 Alpha 2
Fix Version/s: 4.0 Beta 1

File Attachments: 1. File decfloat.gbak (11 kB)
2. File decFuncTest.sql (0.6 kB)

Environment: Dialetic 3 databases

QA Status: Done successfully
Test Details:
::: NB :::
After fix CORE-5700 ("DECFLOAT underflow should yield zero instead of an error"), 02-feb-2018, expected result was
changed: all expressions with "almost zero" result should NOT raise any error.

Sub-Tasks  All   Open   

 Description  « Hide
The way Firebird deals with the precision of the results of calculations involving multiple arguments can easily cause overflows, specially in maths/divs, when the precision of the result is the sum of the precision of the arguments, what can easily extrapolate the actual limits of the currently numeric/decimal datatypes. Also, some care is needed in the intermediate calculations, to avoid loss of precision and overflows.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alexander Peshkov added a comment - 27/Feb/17 02:27 PM
Samples of decimal float data

Pavel Zotov added a comment - 08/Mar/17 01:18 PM
How to restore database 'decfloat.gbak' ?

C:\MIX\firebird\fb40\gbak -z -c -v C:\MIX\firebird\QA\fbt-repo\tmp\c4409-decfloat.gbak /:C:\MIX\firebird\QA\fbt-repo\tmp\c4409-decfloat.fdb 1>c4409-decfloat.log 2>&1

Log:

gbak:gbak version WI-T4.0.0.550 Firebird 4.0 Unstable
gbak:opened file C:\MIX\firebird\QA\fbt-repo\tmp\c4409-decfloat.gbak
gbak:transportable backup -- data in XDR format
gbak: backup file is compressed
gbak:backup version is 11
gbak: Version(s) for database "/:C:\MIX\firebird\QA\fbt-repo\tmp\c4409-decfloat.fdb"
Firebird/Windows/Intel/i386 (access method), version "WI-T4.0.0.550 Firebird 4.0 Unstable"
Firebird/Windows/Intel/i386 (remote server), version "WI-T4.0.0.550 Firebird 4.0 Unstable/tcp (csprog)/P15"
Firebird/Windows/Intel/i386 (remote interface), version "WI-T4.0.0.550 Firebird 4.0 Unstable/tcp (csprog)/P15"
on disk structure version 13.0
gbak:created database /:C:\MIX\firebird\QA\fbt-repo\tmp\c4409-decfloat.fdb, page_size 8192 bytes
gbak:started transaction
gbak:restoring domain RDB$1
gbak:restoring domain RDB$2
gbak:restoring domain RDB$3
gbak:restoring table DTST
gbak: restoring column X
gbak:restoring table QTST
gbak: restoring column X
gbak: restoring column C
gbak:committing metadata
gbak: ERROR:unsuccessful metadata update
gbak: ERROR: DTST
gbak:Exiting before completion due to errors

Alexander Peshkov added a comment - 16/Mar/17 11:09 AM
To restore that database one should use decfloat branch.

Alexander Peshkov added a comment - 22/Mar/17 11:27 AM
1. Updated sample. Gbak format now matches current state of decfloat branch, this format is expected to become permanent one.
2. Script with samples of various decfloat specific functions is added.

Alexander Peshkov added a comment - 16/Oct/17 02:12 PM