From CometWiki

Jump to: navigation, search


Str() Function - changed operation.

  • As mentioned on Forum, I use the Str() function to convert a numeric to string for a percentage that is then used in the key of a file to rank slaes. This change negates that.
  • Robert has a problem with it also, details on Forum. Just typing this to see how it appears. How do you know who says what on a Wiki ?


    The real problem with the str() function is the use of numeric expressions as the argument to the function. The C16 accumulator was implicitly defined as length 16.8. The c32 accumulator may be much larger. It is currently defined as 64.32.

    It is consistent to strip leading spaces from the string, otherwise, you would not know the actual result.

    That said, we are open to any change like this if everyone wants it. I just think it is short sighted to always want C32 to behave exactly like c16.

    We could also only strip the string if the argument were an expression. We could also, treat expressions as arguments to the str function as if the accumulator were 16.8.

    Changing from one version of a language to another requires a re-compile. It is really the only opportunity we have to change behavior. I think we should also look at the obsolete fields in fstat() for instance.

    The other big change is the unexpected error 1 if a numeric expression overflows the variable it is assigned to.

    Length 3.2 & local I

    I = 1234

    will produce an excp=1.


  • Fair enough, I can work around my problem fairly easily.

    I agree that we should take this chance to get rid of old & irrelevant stuff.

  • This numeric overflow thing.

    If my setglobal has been populated in C16 and then I read it in C32 and there is a case of this numeric overflow. Will I get an exception 1 on the getglobal ?

    That is just plain silly, obviously once it is set in C16 it is already truncated.- Scratching around for an unexpalined excp=1.

    If it happens as a result of a mathematical calculation, where do you test for the excp=1 ?

    length 1.0 & local I

    for i=0 to 20

    i=i+1  ? excp=test for overflow ?

    next i

    Still chasing an elusive excp=1. It appears to be when I read my date record.

    Could an excp=46 be misconstrued as an excp=1 ? say there was the string 1234 where the numeric variable in Jim's example above was supposed to be.

    Would that give a 46 or a 1 ??

    Barb:We decided to make the Comet32 str() functionality the same as the Comet16 functionality. Version .401 will be out soon and have this change.


    Let's see: four tildes identify the poster

    SteveA 07:13, 24 February 2011 (PST)

  • Personal tools