confusing "recursive type" error message #9

Closed
opened 2021-08-25 16:36:24 +08:00 by sb10q · 3 comments

Modify mandelbrot.py as follows:

def run() -> int32:
    minX = -2.0
    maxX = 1.0
    width = 78
    height = 36
    aspectRatio = 2.0

    yScale = (maxX-minX)*(height/width)*aspectRatio

    y = 0
    while y < height:
        x = 0
        while x < width:
            c_r = minX+float(x)*(maxX-minX)/width
            c_i = float(y)*yScale/height-yScale/2.0
            z_r = c_r
            z_i = c_i
            i = 0
            while i < 16:
                if z_r*z_r + z_i*z_i > 4.0:
                    break
                new_z_r = (z_r*z_r)-(z_i*z_i) + c_r
                z_i = 2.0*z_r*z_i + c_i
                z_r = new_z_r
                i = i + 1
            output(i)
            x = x + 1
        output(-1)
        y = y + 1
    return 0

Error:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Recursive type is prohibited. at line 20 column 30"', nac3standalone/src/main.rs:121:10
Modify mandelbrot.py as follows: ```python def run() -> int32: minX = -2.0 maxX = 1.0 width = 78 height = 36 aspectRatio = 2.0 yScale = (maxX-minX)*(height/width)*aspectRatio y = 0 while y < height: x = 0 while x < width: c_r = minX+float(x)*(maxX-minX)/width c_i = float(y)*yScale/height-yScale/2.0 z_r = c_r z_i = c_i i = 0 while i < 16: if z_r*z_r + z_i*z_i > 4.0: break new_z_r = (z_r*z_r)-(z_i*z_i) + c_r z_i = 2.0*z_r*z_i + c_i z_r = new_z_r i = i + 1 output(i) x = x + 1 output(-1) y = y + 1 return 0 ``` Error: ``` thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Recursive type is prohibited. at line 20 column 30"', nac3standalone/src/main.rs:121:10 ```
Poster
Owner

Line 20 contains if z_r*z_r + z_i*z_i > 4.0:

Line 20 contains ``if z_r*z_r + z_i*z_i > 4.0:``

I guess the reason is just due to float being assigned a type variable, and then the type is messed up later. Should not be hard to fix, would fix this later.

I guess the reason is just due to `float` being assigned a type variable, and then the type is messed up later. Should not be hard to fix, would fix this later.

Fixed in a24e204

Fixed in a24e204
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#9
There is no content yet.