Autor Beitrag
SWAT
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Do 15.02.07 14:28 
Sers,
ich hab delphi2005 und hab ein problem. ich muss eine geschwindigkeit auf auf eine entfernung errechnen. Beim 2. schritt dieser rechnung muss ich das ergbnis - sagen wir es kommt 20,45 raus - am besten durch 1 teilen und den rest speichern. dafür nimmt man 'mod', aber das funktioniert nur bei Integerwerten, wie komme ich an die 45 hinter dem komma?

MfG
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Do 15.02.07 14:31 
Schau Dir mal Frac und Trunc an ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
SWAT Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Do 15.02.07 14:49 
was ist trunc?
bei frac kommt ne fehlermeldung :
"E2014"-anweisung erforderlich, aber ausdruck vom typ double gefunden.

muss ich irgendwas machen damit frac erstmal geht oder hab ich es falsch benutzt?
prozentsatzfreund - frac(prozentsatzfreund);

kann man das so machen? anscheinend ja nicht
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Do 15.02.07 14:52 
(1) Glaskugel kaputt
(2) Trunc + F1 hilft
(3) Frac + F1 hilft auch

mfg

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
SWAT Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Do 15.02.07 16:47 
(1) deine Glaskugel interessiert mich nicht
(2) Frac + F1 bringt genau folgendes -> kein Suchergebnis

danke für die tolle erklärung grad trodzdem
weiß jemand warum frac bei mir ne fehlermeldung bringt?
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Do 15.02.07 16:53 
(1) Dein Problem interessiert Kroko jetzt bestimmt auch nicht mehr.
(2) Dann hast du was falsch gemacht. Wenn ich Frac eingebe und F1 drücke, kommt die Delphi-Hilfe...

Woher sollen wir deinen Quellcode kennen?
Etwas netter gehts auch. Du bist hier der mit der Frage, nicht wir.

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
SWAT Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Do 15.02.07 16:58 
(1) macht nichts
ich benutz firefox, wenn du da F1 drückst kommt nicht die delphi-hilfe ;)
nochmal die codezeile-
prozentwert - frac(prozentwert);

wie gesagt hab delphi 2005 und die fehlermeldung, die kommt steht oben, ich frag mich warum sie kommt...
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 15.02.07 17:01 
Du rechnest anscheinend was, machst aber nix mit dem Ergebnis.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Do 15.02.07 17:02 
user profile iconSWAT hat folgendes geschrieben:
(1) macht nichts
So kümmerst du dich um die Leute, die dir helfen wollen? Gut, dann lass ichs.
PS: "Glaskugel kaputt" bedeutet: Ich kann grad nicht hellsehen und darum deinen Code nicht erraten.

PPS: Nimm dir Martoks Aussage bezüglich "Etwas netter gehts auch." zu Herzen, oder du wirst schnell merken, dass Programmierer auch nur Menschen sind, die auf Unfreundlichkeit entsprechend reagieren. Ich kann in Krokos Aussage nichts finden, was dich zu einer dermaßen gehässigen und undankbaren Reaktion bringen könnte. Ich empfehle eine freundliche Entschuldigung deinerseits, als gut gemeinter Ratschlag.

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



BeitragVerfasst: Do 15.02.07 17:11 
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, System.ComponentModel, Borland.Vcl.StdCtrls;

der code stand oben, da brauchte keiner hellsehen zu können...
und das ist auch der code, mehr nicht er besteht aus den uses da oben und aus einer variablen namens hallo vom typ float (20,54) und ich will die 54 als ganzzahl haben. ich bekomme tranc und frac geraten, probiers aus und es klappt nicht, es kommt die fehlermeldung (siehe oben).
hallo - frac(hallo);
funktioniert nicht, warum?
jakob ich speicher das ergebnis ja wieder in hallo ab, das reicht doch aus !?
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 15.02.07 18:10 
wie gesagt F1 sollt dir weiterhelfen. ausderdem gibt's noch den debugger der zumeist gute dienste leistet.
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 15.02.07 18:23 
wenn du durch 1 teilst, hast du aber keinen rest Oo
SWAT Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Do 15.02.07 18:43 
20,54 / 1 = 20 rest 0,54 und genau das will ich erreichen und wenn ich jetzt einfach mal F1 drücke kommt die hilfeseite vom firefox...
sagt mir doch einfach wie ich frac benutzen muss mit D5
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 15.02.07 18:54 
Mann, du musst das in Delphi machen, ist denn das so schwer? :roll:

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 15.02.07 18:54 
Schonmal auf die Idee gekommen, dass du F1 in der Delphi-IDE verwenden musst? :roll:
Übrigens solltest Du Dein Ergebnis auch irgendwohin zuweisen. Woher soll Delphi denn wissen, was es mit dem Ergebnis machen soll?
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 15.02.07 18:58 
Was für ein lustiger Thread :mrgreen:.
ausblenden Delphi-Quelltext
1:
X := Frac(10.54)   // -> gibt 0.54 aus					

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
SWAT Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 24



BeitragVerfasst: Do 15.02.07 19:03 
nein, ich bin noch nicht auf die idee gekommen oO
sag das doch gleich, sorry das ich irgendwen hier so angekackt hab
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Do 15.02.07 20:21 
user profile iconF34r0fTh3D4rk hat folgendes geschrieben:
wenn du durch 1 teilst, hast du aber keinen rest Oo


mein avatar liefert diese lösung eigentlich mit jedem meiner beiträge ;) und für mich gibt es kein mod bei floats, wenn man durch 1 teilt ist das immer restlos.


mfg
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Fr 16.02.07 07:38 
user profile iconF34r0fTh3D4rk hat folgendes geschrieben:
... und für mich gibt es kein mod bei floats, wenn man durch 1 teilt ist das immer restlos.


mfg

Für mich gilt Modulo auch nur für Integer, bei WIKI auch

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Fr 16.02.07 12:30 
user profile iconSWAT hat folgendes geschrieben:
20,54 / 1 = 20 rest 0,54
Also.. Mathematisch gesehen ist 20,54 durch 1 = 20,54. x/1 = x und das IMMER, egal was x ist. Bei natürlichen Zahlen, ganzen Zahlen, reellen Zahlen, komplexen Zahlen, und bestimmt auch bei diesen seltsamen Zahlen, bei denen die Quadratwurzel aus -1 gleich i ist. :)

user profile iconSWAT hat folgendes geschrieben:
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, System.ComponentModel, Borland.Vcl.StdCtrls;

der code stand oben, da brauchte keiner hellsehen zu können...

... wo? :lupe: Die Uses helfen uns aber nicht, die Frage, die wir hatten, war mehr, wie der code aussieht, in dem du Frac benutzt. Den hast du uns (sinngemäß) nachgeliefert mit hallo - frac(hallo), wobei ich vermute, dass du hallo := frac(hallo) meintest ;)

Aber dein Problem ist ja jetzt gelöst, und ich denke, du wirst beim nächsten mal nicht so ungehalten reagieren, wenn jemand eine Antwort wie Kroko formuliert :)

PS: Markiere doch bitte dieses Thema als erledigt. Das geht ganz einfach, in dem du auf das HIER unter dem letzten Beitrag klickst.

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