AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Rechnen

Offene Frage von "delphinia"
Ein Thema von delphinia · begonnen am 4. Jul 2006 · letzter Beitrag vom 4. Jul 2006
 
delphinia

Registriert seit: 16. Feb 2006
444 Beiträge
 
Delphi 11 Alexandria
 
#1

Rechnen

  Alt 4. Jul 2006, 02:44
Habe Probleme mit der Komma rechnung

Das Problem ist zB::

das bei der Ausgabe
label_6.Caption := Format(const_6, [i1]);
Fehlerhaft werte Rauskommen - wegen diesem Komma ein wert zB bei 0,651452 wird mit 0 gerechnete Wichtig ist aber das auch mit den nachkommer gerechnet wird!


Mein Beispiel:
Delphi-Quellcode:
TIMER
var
  S1, ti1, ti2, ti3, i3b, i3c, i3d: string;
  i1, i2, i3a: Integer;

  f, f1, f2: Extended;
begin

  // AKTUELLE ZEIT IMMER ANZEIGEN
  label_3.Caption := Format(const_3, [FormatDateTime('dd.mm.yyyy', now), FormatDateTime('hh:mm:ss', now)]);
  now_timer.Interval := 1000;



 // Vergangene Zeit berechnen
  all_days := Abs(Now - Zeit1);
  ti1 := FormatDateTime('hh', Now - Zeit1);
  ti2 := FormatDateTime('nn', Now - Zeit1);
  ti3 := FormatDateTime('ss', Now - Zeit1);

  if Trunc(all_days) <= 0 then S1 := IntToStr(Trunc(all_days)) + ' Tage'
  else
    if Trunc(all_days) = 1 then S1 := IntToStr(Trunc(all_days)) + ' Tag'
    else
      if Trunc(all_days) > 1 then S1 := IntToStr(Trunc(all_days)) + ' Tage';

  label_4.Caption := Format(const_4, [S1]);
  label_5.Caption := Format(const_5, [ti1, ti2, ti3]);


  // PT
  i1 := Trunc(all_days) * 24 * 60;
  i1 := (StrToInt(ti1) * 60) + i1 + StrToInt(ti2);

  i1 := i1 div 60 div 24;
  i1 := i1 * StrToInt(UZigsTag);
  label_6.Caption := Format(const_6, [i1]);

  // UZ
  i2 := i1 div StrToInt(UZ);
  i2 := i2 * StrToInt(UC);
  label_7.Caption := Format(const_7, [i2]);


  // N UND T
  f := i1 * StrToFloat(UN);
  f1 := i1 * StrToFloat(UT);
  label_8.Caption := Format(const_8, [f, f1]);


  // Time
  i3a := i1 * StrToInt(Time); // Minunten gebraucht

  i3b := FormatDateTime('hh', i3a);
  i3c := FormatDateTime('nn', i3a);
  i3d := FormatDateTime('ss', i3a);

  label_9.Caption := Format(const_9, [i3b, i3c, i3d]);
end;
Doreen
Gruss Doreen
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:46 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz