Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aufgabe 10.8 - Invariante? #99

Open
chessgarf opened this issue Mar 29, 2024 · 2 comments
Open

Aufgabe 10.8 - Invariante? #99

chessgarf opened this issue Mar 29, 2024 · 2 comments

Comments

@chessgarf
Copy link

Aufgabe 10.8 auf S. 306 lautet:
Schreibe eine Version von power2 aus Abschnitt 7.4 auf Seite 206 mit Akkumulator. Hinweis: Du kannst die gleiche Invariante wie bei power verwenden.
Die Invariante bei power war:
; power ist base^(exponent0 - exponent)

power2 iterativ zu gestalten ist ja nicht allzu schwer. Die empfohlene Invariante kann ich mit diesem Algorithmus aber nicht zusammenbringen!?

@mikesperber
Copy link
Member

@chessgarf Um das beurteilen zu können, müßte ich die Lösung sehen. (Meine hat die gleiche Invariante.)

@chessgarf
Copy link
Author

Okay, dann stehe ich wohl einfach auf dem Schlauch. Für mich drängt sich als Invariante nach dem Algorithmus von power2 ; power ist base0^exponent0 / base^exponent auf, aber wenn Du sagst, es geht auch anders, werd ich halt noch länger nachdenken. Danke.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants