Autor Beitrag
asbito
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 33



BeitragVerfasst: Do 06.09.07 16:54 
Hi Leute ich brauch ma hilfe beim dtentyp real. Es ist Wichtig das meine real variable immer zwei nachkommerstellen hat, auch wenn wenn die nachkommerstellen 00 sind oder 10. Kann man das irgendwie bewerkstelligen würed mich über eine Antwort freuen.


mfg asbito.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Do 06.09.07 17:00 
Format

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Do 06.09.07 17:14 
user profile iconBlackheart666 hat folgendes geschrieben:
Format

Ich würde es mit
ausblenden Delphi-Quelltext
1:
FormatFloat();					
versuchen. ;)

Alternativ, wenn du mit deiner Zahl weiterechnen willst, empfiehlt sich die Funktion
ausblenden Delphi-Quelltext
1:
RoundTo(223.2222,-2)					
!
Dazu musst du die Unit Math mit einbinden. ;)
asbito Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 33



BeitragVerfasst: Do 06.09.07 17:34 
Danke ja nehm das mit roundto hat nähmlich was mit preisen zu tun.
vll kann ich ja noch eine frage stellen. Kann ich aus der Realzahl auf die nachkommastelle auslesen mit na schönen funktion?
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Do 06.09.07 17:47 
Bitte nur eine Frage pro Topic. aber was meinst du mit "eine realzahl auf nachkommastellen auslesen"? wieviele nachkommastellen sie hat? Das geht ja von 0 bis unendlich ... :|

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
asbito Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 33



BeitragVerfasst: Do 06.09.07 17:54 
ne ich will die nachkommastellen auslesen lassen. BSP: ich hab den betrag 1.29 dann soll 29 ausgelesen werden
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Do 06.09.07 18:00 
Ich würde jetzt eine Rüge kriegen, wenn ich dir sage, wie das geht, weil: Neue Frage -> Neues Topic. :( Und das ist eine durchaus sinnvolle regel. Aber wenn ich kurz mal die Funktionen Suche in: Delphi-Forum, Delphi-Library POS und Suche in: Delphi-Forum, Delphi-Library COPY erwähne, müsstest du im String den DecimalSeperator finden und die Stellen danach kopieren können. Wenn dir diese Info nicht reicht, erstelle bitte ein neues Topic zu dieser Frage.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Do 06.09.07 18:06 
Bei zwei Nachkommastellen bietet sich
ausblenden Delphi-Quelltext
1:
Frac();					
an: Frac gibt dir die Nachkommastellen aus, allerdings in der Form 0,xx.
Aber so schwer ist es ja nun auch nicht, daraus einen Integer zu machen. ;)

@user profile iconJayEff: Sollte Pos/Copy die Strafe für das Stellen zweier Fragen in einem Thread sein? :mrgreen:
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Do 06.09.07 18:18 
Hi,

ausblenden Delphi-Quelltext
1:
2:
myReal = 123.34;
Result = myReal - floor(myReal); // => 0.34


Aya~

PS: floor = abrunden

_________________
Aya
I aim for my endless dreams and I know they will come true!
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Do 06.09.07 19:15 
user profile iconMarc. hat folgendes geschrieben:
@user profile iconJayEff: Sollte Pos/Copy die Strafe für das Stellen zweier Fragen in einem Thread sein? :mrgreen:

Nein, die Quick&Dirty (Betonung auf Dirty) Lösung :mrgreen:
Ausserdem ist mir Frac nicht eingefallen :nixweiss:

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.