Autor Beitrag
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: Mi 04.06.03 20:49 
wo ist denn der Fehler (zeile)??

Fis

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.
Anja Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42

WIN xp

BeitragVerfasst: Mi 04.06.03 20:51 
Titel: gleitkomma
er zeigt bei der eingabe von zahlen gleitkomma fehler an
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: Mi 04.06.03 20:57 
Gib mal die Zahlen mit , statt . ein.

(Falls du vorher nen . benutzt hast)
Fis

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.
Anja Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42

WIN xp

BeitragVerfasst: Mi 04.06.03 21:09 
es funktioniert danke anja
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: Mi 04.06.03 21:18 
falls du das noch machen willst (das man statt , auch . eingeben kann), dann:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
function StrToFloatPt(const s: string): extended;
begin
  Result := StrToFloat(StringReplace(s,'.',',', [rfReplaceAll]));
end;


und das halt immer statt StrToFloat benutzen.

(Getestet)

Fis

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Mi 04.06.03 23:01 
Oder DecimalSeparator auf das entsprechende Zeichen setzen (siehe OnlineHilfe, StrToFloat).

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
Anja Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42

WIN xp

BeitragVerfasst: Do 05.06.03 05:35 
Titel: kommastellen
wie kann ich es machen das er mir jetzt nur auf 2 kommastellenrundet?

Anja
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 05.06.03 05:39 
Kuck mal in der Hilfe unter FloatToStrF oder unter Format.
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: Do 05.06.03 07:17 
tommie-lie hat folgendes geschrieben:
Oder DecimalSeparator auf das entsprechende Zeichen setzen (siehe OnlineHilfe, StrToFloat).


Oh, hab ich nicht gesehen (*nichthilfegelesen*). So kann man halt beides eingeben (, und .).

Fis

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.
Anja Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42

WIN xp

BeitragVerfasst: Do 05.06.03 10:12 
Titel: komma
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.BNettoClick(Sender: TObject);
        var
        s       :string;

        begin

                s:=txtBrutto.text;
                If  Rad16.Checked then txtNetto.text:=FloatToStr(Netto_Berechnen(16,StrToFloat(s)));


                If  Rad7.Checked then txtNetto.text:=FloatToStr(Netto_Berechnen(7,StrToFloat(s)));


end;

2 stellen nach dem komma anzeigen. Mit dem Befehl FloatToStrF klappt es nicht!

Anja
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 05.06.03 10:17 
Titel: Re: komma
Anja hat folgendes geschrieben:

2 stellen nach dem komma anzeigen. Mit dem Befehl FloatToStrF klappt es nicht!

Stimmt. Klappt einfach nicht. :roll:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Button1Click(Sender: TObject);
var
  f : Extended;
begin
  f := 2.2596987859;
  ShowMessage(FloatToStrF(f, ffNumber, 18, 2));
end;
Anja Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42

WIN xp

BeitragVerfasst: Do 05.06.03 10:20 
Titel: Komma
hm na ja so richtig funktioniert das nicht!
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 05.06.03 10:22 
*putz wiener wisch hauch rubbel*

Falls jemand fragt, was ich hier mache: Ich putze gerade meine Glaskugel, die geht irgendwie nicht mehr so richtig. :x
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: Do 05.06.03 10:26 
Du kannst auch mit Format arbeiten, z.B. so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);
var
  f : Extended;
  stellen: integer;
begin
  f := 2.2596987859;
  stellen := 3;
  ShowMessage(Format('%.*f',[stellen,f])); // auf stellen stellen runden
  // oder
  // ShowMessage(Format('%.2f',[f])); // auf 2 stellen runden
end;

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.


Zuletzt bearbeitet von Tweafis am Do 05.06.03 11:08, insgesamt 1-mal bearbeitet
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: Do 05.06.03 10:29 
Luckie hat folgendes geschrieben:
*putz wiener wisch hauch rubbel*

Falls jemand fragt, was ich hier mache: Ich putze gerade meine
Glaskugel, die geht irgendwie nicht mehr so richtig. :x


:mrgreen::mrgreen:

@Anja: Das Beispiel von Luckie geht ausgezeichnet...

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.