8000 Exercise 2.10: off by one · Issue #14 · sgignoux/sicp-solutions.net · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Exercise 2.10: off by one #14

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

Open
Meretan opened this issue Aug 20, 2022 · 0 comments
Open

Exercise 2.10: off by one #14

Meretan opened this issue Aug 20, 2022 · 0 comments

Comments

@Meretan
Copy link
Meretan commented Aug 20, 2022

Interval boundaries should be checked as well:

#;1> (div-interval (make-interval 1 2) (make-interval 22 0))

Error: (/) division by zero
1.0
0

        Call history:

        <eval>    [div-interval] (lower-bound y)
        <eval>    [lower-bound] (min (car i) (cdr i))
        <eval>    [lower-bound] (car i)
        <eval>    [lower-bound] (cdr i)
        <eval>    [div-interval] (mul-interval x (make-interval (/ 1.0 (upper-bound y)) (/ 1.0 (lower-bound y))))
        <eval>    [div-interval] (make-interval (/ 1.0 (upper-bound y)) (/ 1.0 (lower-bound y)))
        <eval>    [div-interval] (/ 1.0 (upper-bound y))
        <eval>    [div-interval] (upper-bound y)
        <eval>    [upper-bound] (max (car i) (cdr i))
        <eval>    [upper-bound] (car i)
        <eval>    [upper-bound] (cdr i)
        <eval>    [div-interval] (/ 1.0 (lower-bound y))
        <eval>    [div-interval] (lower-bound y)
        <eval>    [lower-bound] (min (car i) (cdr i))
        <eval>    [lower-bound] (car i)
        <eval>    [lower-bound] (cdr i) <--
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

1 participant
0