Autor Beitrag
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Sa 15.01.05 13:10 
Hi,

ich steh im Moment vor dem Problem, eine eigene Int(...)-Funktion zu programmieren (soll was änhliches werden, deshalb selbst programmiert). Die Mathematische Definition (ca.):

Matheprof. hat folgendes geschrieben:
_________x Element Z: x
Int(x) {
______x nicht Element Z: Vorkommaanteil(x)


Tja,... Vorkommaanteil entspricht Trunc(x), aber Trunc will ich nicht verwenden.

Jemand eine Idee, wie ich Vorkommaanteil(x) errechnen kann?

AXMD
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: Sa 15.01.05 19:05 
X - Frac(X)

Aber ich glaub, ein paar mehr Informationen zu deinem Vorhaben wären für die Lösung ganz hilfreich.

_________________
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.
AXMD Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Sa 15.01.05 19:10 
Ich will keine vordefinierten Funktionen verwenden, auch nicht Frac. Im Groben geht es darum, dass die Int-Funktion in Delphi nicht die echte Int-Funktion, sondern die Gauss-Klammerfunktion ist, die bei negativen Zahlen von der Int-Funktion (wenn auch "minimal") abweicht.

AXMD
sourcehunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: Sa 15.01.05 19:35 
Probier mal die Zahl Modulo 1 zu prüfen, in C geht das, wenn ich mich recht erinnere.

_________________
Linux und OpenSource rulez!
AXMD Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Sa 15.01.05 19:36 
Das kann schon vom Prinzip her nicht funktionieren, da mod nur mit zwei Integer-Variablen funktioniert...

AXMD
sourcehunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: Sa 15.01.05 19:43 
Ja nee, is klar.
Ich bin mir da auch nich ganz sicher, aber ich dachte, dass C da nich so steng ist. Hast du dich schonmal darüber informiert, wie Realzahlen abgespeichert werden?

_________________
Linux und OpenSource rulez!
AXMD Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Sa 15.01.05 21:10 
sourcehunter hat folgendes geschrieben:
Ja nee, is klar.
Ich bin mir da auch nich ganz sicher, aber ich dachte, dass C da nich so steng ist. Hast du dich schonmal darüber informiert, wie Realzahlen abgespeichert werden?


Das is ne Idee. Thx. C is generell nicht so streng; da geht viel, was eigentlich nicht geht ;)

AXMD
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: Sa 15.01.05 21:10 
Wenn meine Erinnerung mich nicht trügt, wird Real im packed-Format im Speicher abgelegt.
Habe leider keine Unterlagen mehr dazu. Aber vielleicht hilft das ja für die Recherche.
UC-Chewie
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 531

WinXP
D5 Ent
BeitragVerfasst: So 16.01.05 16:29 
Wenn du keine vorgefertigte Funktion benutzen willst, wirst du wohl auf einen entsprechenen Maschinenbefehl zurückgreifen müssen.

_________________
Egal wie dumm man selbst ist, es gibt immer andere, die noch dümmer sind