Конференция "KOL" » Is this a bug?
 
  • Thaddy © (16.12.10 16:00) [0]
    Extended2StrDigits:

    I expected NAN and INF to be handled, but this is not the case.
    What  do you think? a bug?

    Easy to fix, but I am not sure about this one.

    For now I handle it like this:
    [CODE]

    function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision, Digits: Integer): string; overload;
    begin
     if IsNan(Value) then begin result := 'NAN'; exit;end else
     if IsInfinity(Value) then begin Result := 'INF';exit;end;
     Result := Extended2StrDigits(Value,Digits);
     // ignore the rest of the parameters
    end;

    [/CODE]
  • Vladimir Kladov © (16.12.10 20:44) [1]
    No, this is not a bug. You want to get 'NAN' if it is NAN, may be other want to see '.00', may be other just empty string or special symbol (e.g. '~'). There is a case also in which conditions are so that giving NAN or INF is not possible, so it is not necessary to concern these cases at all. If anybody want to concern it, function like you wrote above is not too hard to code even for dummies, yes?
  • Thaddy © (21.12.10 19:38) [2]
    Well,

    Look at the function I am trying to mimic / imitate a bit:

    Delphi FloatToStF returns 'NAN' and 'INF'....

    But it is easy enough like this, you are right ;-)

    Happy new year and Christmas to everybody.

    @VK: This week I live in Siberia: -19 in Amsterdam!

    Thaddy
  • Vladimir Kladov © (21.12.10 19:58) [3]
    Happy Christmas to you too (though early a bit yet)!
    -35 in Novosibirsk now.
  • MTsv DN (21.12.10 20:34) [4]
    > -35 in Novosibirsk now.
    Оффтоп: Пиндык. Сочувствую. Если у нас в Питере так температура упадет, это будут вилы...
  • Thaddy © (23.12.10 09:40) [5]
    Kelvin? //impossible!!
    Fahrenheid?// maybe
    Celcius?// brrrrrr
Есть новые Нет новых   [120346   +13][b:0][p:0.001]