Announcement

Collapse
No announcement yet.

Here's a wierd one!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Here's a wierd one!

    I dont know why this is happening but when I create a source file call "LogError.bas" and compile it I get a strange error message from the compiler. The following code gives the error "Could not find 2139 bytes". What baffles me is using a filename other than "LogError.bas" compiles just fine!


    Code:
    'LogError.bas ***MAKE SURE YOU USE THIS NAME TO SEE WHAT I MEAN***
    #compile exe
    
    function pbmain as long
        msgbox"Done."
    end function

    Lance, Tom, maybe you can shed some light on this. While your looking anyway, are there any known issues with VAL and LOG10. I have been running into some problems with incorrect values being returned from VAL and strange PBDLL errors. Also, it seems as though LOG10 doesn't mind being passed ZERO. In the documentation is says that a run-time error 5 "Illegal function call" will result when values of zero or less are passed. Try this to see what I mean...

    Code:
    #compile exe
     
    function pbmain as long
      dim eValue as ext
      dim lError as long
     
      eValue = log10(0)
      lError = err
     
      msgbox str$(lError) & str$(eValue)
    end function
    Any ideas guys?


    ------------------
    Cheers!

    #2
    I'm not at my DEV PC right now to fully investigate, so these answers are off the top of my head. I'll try to provide more complete answers when I get back to the office.

    1. LOGERROR.BAS - obviously the IDE has some conflict with name (but for what reason is unclear!?)... I'll ask R&D about it.

    2. VAL() - there are definitely no known issues, but there are some strings that can give you results that you may not expect - for example (off the top of my head), A& = VAL("2e4f6g8") is equivalent to A& = 2^4. IIRC, "d" produces similar results. Could this be what you are seeing? (I'll dig up my notes on VAL and post them when I get back to the office).

    3. LOG10(0) - I'll check into this when I get back to the office.


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


      #3
      no LOGs only...

      I tried (PB/CC) the following:

      1- LOG, LOG2 and LOG10 with both 0 and negative numbers return 0, ERR = 0
      2- SQR of a negative number returns the given number (i.e. SQR(-2) = -2), ERR = 0
      3- (-2)^.5 - the same as SQR(-2) - returns 1, ERR = 0

      ------------------
      Rgds, Aldo

      Comment


        #4
        Right, here is the gen on VAL and LOG:

        VAL accepts "e" and "d" as exponentiation symbols. VAL accepts prefixes of "&H", "&B" and "&O" for hex, binary and octal respectively. unsigned results can be obtained if the numeric string argument is prefixed with a zero.

        LOG, EXP, LOG2, EXP2, LOG10 and EXP10 do not trigger any runtime errors; as discussed in the doc's (see Errors and Error Trapping), overflow errors are the programmers responsibility. The description in the LOG/LOG2/LOG10 topic in the help file is obviously incorrect. Thanks for pointing that one out!

        Regarding "LOGERROR.BAS"... the IDE reads the compiler LOG file and uses a simple INSTR evalution to find the error details. The word "error" in the filename is probably interfering with the INSTR evaluation.

        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment


          #5
          Ok Lance, I always forget PB doesn't set errors like overlow and divide by 0.
          overflow errors are the programmers responsibility
          It is not only a matter of divions-by-0 or some other simple-to-check situations. I can't know if an expression like x^y will give a result above or below the overflow threshold before I execute it. Hence, if the x^y is inside a larger expression, I must execute it separately, check against overflows, and then continue the calculus.

          Well, I never wrote a code to calculate an expression step-by-step and check the intermediate values against overflows, but this is the only workaround I can imagine to completely check my calculus. On scientific or simulation programs this should be done! And this would be too much LONGER to write and too much SLOWER to execute!!!

          Hence, I submit the following to the wish-list: to have a compiler switch which enables the numeric processors exception flags check.

          Aldo

          ------------------
          Rgds, Aldo

          Comment


            #6
            YES! put another tick on the list for me

            ------------------
            Cheers!

            Comment

            Working...
            X
            😀
            🥰
            🤢
            😎
            😡
            👍
            👎