Skip to content

IsDecimalNegatives doesn't test numeris correctly #22

@ameyer66

Description

@ameyer66

The IsDecimalNegatives function in IsDecimal.dbl doesn't cast the value to an alpha before trying to move it back to a decimal field to test for badDigit.

in IsDecimalNoNegatives the passed in aNumber is correctly cast to an alpha to test for bad digits.

    onerror badDigit
    number = ^a(aNumber)
    freturn true
badDigit,
    freturn false

However in the IsDecimalNegatives the value is simply passed from one decimal field to another with no casting to an Alpha.

    onerror badDigit
    ;;Is the last character between "p" and "y"
    if (lastCharacter>='p' && lastCharacter<='y') then
    begin
        ;;If it's the first character then it's a single-digit negative
        if (lastCharacterPos==1)
        begin
            exit
        end
        ;;Make sure the rest of the value looks OK
        number = aNumber(1:lastCharacterPos-1)    ;;  SHOULD BE A CAST TO ALPHA HERE
        if (number < 0)
            goto badDigit
    end
    else
    begin
        ;;No "p" through "y", check the whole value
        number = aNumber    ;; SHOULD BE A CAST TO ALPHA HERE
    end
    freturn true
badDigit,
    freturn false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions