Konstante ist nicht konstant?
Warum ist Wert 1 auf einmal so krum?
Delphi-Quellcode:
Ergebnis:
const
MONEY: array[1..26] of Single = (0.01, 0.20, 0.50, 1, 5, 10, 20, 50, 100, 200, 300, 400, 500, 1000, 2500, 5000, 7500, 10000, 12500, 15000, 20000, 25000, 50000, 100000, 150000, 250000); Zitat:
|
Re: Konstante ist nicht konstant?
Weil eine Gleitkommazahl nur ein näherungswert ist. Such einfach mal danach wie solche Datentypen aufgebaut sind.
|
Re: Konstante ist nicht konstant?
Zitat:
Suche mal nach Mantisse in der DP und Du wirst einige Beiträge finden. (Unter anderem auch ein Codeschnipsel von mir, das Dir zeigt wie Die Zahl im Speicher abgelegt ist.) Hier ist ein PDF das das Thema ausführlich behandelt: http://www-nw.uni-regensburg.de/~.br...t/realform.pdf Ich hoffe diese Infos helfen Dir weiter |
Re: Konstante ist nicht konstant?
Schade das das so ist ;) Aber wenn ich den Datentyp ändere (Single > Extended) dann funktionierts wieder ^^
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:41 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