![]() |
Exponent-Rechnung auch ohne Power???
Hallo
Meine Frage lautet: Kann man z.B. 2^5 auch ohne Power rechnen? bei mir funktioniert Power nämlich nicht. da sagt er mir, dass Power ein "undeclared identifier" ist. |
Re: Exponent-Rechnung auch ohne Power???
Dann binde mal die Unit Math ein.
|
Re: Exponent-Rechnung auch ohne Power???
und wie mache ich das?
|
Re: Exponent-Rechnung auch ohne Power???
Oben steht:
Delphi-Quellcode:
direkt nach
uses
Delphi-Quellcode:
.
Unit XXXX
Da musst du einfach nur Math hinzufügen: (Falls du nix eingebunden hast)
Delphi-Quellcode:
(Falls du schon was eingebunden hast=)
uses Math;
Delphi-Quellcode:
[edit]Semikolone eingebaut[/edit]
uses Bla, Bla, Math;
|
Re: Exponent-Rechnung auch ohne Power???
2^5 kann man auch mit IntPower rechnen, was schneller gehen dürfte.
|
Re: Exponent-Rechnung auch ohne Power???
Zitat:
|
Re: Exponent-Rechnung auch ohne Power???
Oder mit bischen Schulmathematik...
Delphi-Quellcode:
Da muss dann nur noch der Spezialfall x=0 behandelt werden.
x^n = exp(n*ln(x)) ;
|
Re: Exponent-Rechnung auch ohne Power???
wie bekomme ich jetzt den Power-Type "Extended" jetzt in "Integer"???
Delphi-Quellcode:
Image2.Top := Image2.Top + Power(2,4);
|
Re: Exponent-Rechnung auch ohne Power???
Zitat:
Delphi-Quellcode:
Image2.Top := Image2.Top + round(Power(2,4));
|
Re: Exponent-Rechnung auch ohne Power???
*auch flüster*
2^n entspricht 1 SHL n :wink: Gruß Hawkeye |
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:02 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz