Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Problem with numbers

MorianoMoriano Member Posts: 11
Hi all

I have a number field in a form (wich we use to store prices).

When we make calculations on it, when the result is 15 i.e., sometimes stores it on the database as 15, and sometimes
stores the resul as 14.99999999999999999

The database filed is NUMBER DATATYPE too, without precision or scaled.
Anybody knows why it happens?. Is a database configuration problem?

Thanks in advance for all your responses

Comments

  • sumedhsumedh Member Posts: 103
    : Hi all
    :
    : I have a number field in a form (wich we use to store prices).
    :
    : When we make calculations on it, when the result is 15 i.e., sometimes stores it on the database as 15, and sometimes
    : stores the resul as 14.99999999999999999
    :
    : The database filed is NUMBER DATATYPE too, without precision or scaled.
    : Anybody knows why it happens?. Is a database configuration problem?
    :
    : Thanks in advance for all your responses
    :

    maybe the problem occurs because the precision is not set for the NUMBER datatype in the first place.....

    [code]
    NUMBER(3,1)
    [/code]

    this will allow just one number after the decimal point....
    Eg. 15.0 or 14.9 (you could then round 14.9 to 15.0 i guess)

    -sumedh
    [hr]
    [purple]
    [b]Dont think you can, [yellow]KNOW[/yellow] you can....
    [/b]
    [purple]

  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _ | http://forcoder.org | free ebooks and video tutorials about // Perl Objective-C Visual Basic MATLAB R Swift PL/SQL C Delphi JavaScript C# PHP Go Java Ruby Visual Basic .NET Assembly Scratch C++ Python Julia Ada D Hack Awk Apex Erlang Bash Scala F# Lua Logo Fortran FoxPro ML Kotlin Lisp Crystal Rust Clojure LabVIEW Alice COBOL Scheme Prolog VBScript ABAP SAS Dart Transact-SQL // _____________

Sign In or Register to comment.