Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IsDecimalNegatives doesn't test numeris correctly #22

Open
ameyer66 opened this issue Mar 30, 2020 · 0 comments
Open

IsDecimalNegatives doesn't test numeris correctly #22

ameyer66 opened this issue Mar 30, 2020 · 0 comments

Comments

@ameyer66
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant