rejetto forum

more parF()

Mars · 2 · 1202

0 Members and 1 Guest are viewing this topic.

Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2036
    • View Profile
Minor but possible update

    if name = 'round' then
      result:=floatToStr(roundTo(parF(0), -parI(1, 0)));

    if name = 'set speed limit for address' then
      with objByIp(p) do
        except end;

    if name = 'set speed limit for connection' then
      if satisfied( then
        except end;

    if name = 'in range' then
      try trueIf(inRange(parF(1), parF(1), parF(2)))
      except result:='' end;

Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
yes, i applied this suggestion, but maybe you are missing something.
the original version of parF(n) does not throw any exception, while stroToFloat() does.

those "try"s you see in the code are there exactly because of that.
but parF() is handy, and i'd like to use it also in cases where exception must be thrown.
i came to this:
all parF(n) will throw exception
while parF(n,n) will not (to be used where it is not needed).