Question: I'm working on a function with three nested for loops that is way too slow for its intended use. The bottleneck is clearly the looping part - almost 100 % of the execution time is spent in the innermost loop.  

The function takes a 2d matrix called `rM` as input and returns a 3d matrix called `ec`:

```
rows = size(rM, 1);
cols = size(rM, 2);

%preallocate.
ec = zeros(rows+1, cols, numRiskLevels);
ec(1, :, :) = 100;

for risk = minRisk:stepRisk:maxRisk;
    for c = 1:cols,
        for r = 2:rows+1,
            ec(r, c, risk) = ec(r-1, c, risk) * (1 + risk * rM(r-1, c));
        end
    end
end

```

Any help on speeding up the for loops would be appreciated...

Answer: 
`float: left` or `float: right` forces `display` to have a computed value of `block`.

<http://www.w3.org/TR/CSS2/visuren.html#dis-pos-flo>

That is why removing `display: block` makes no difference. You can safely remove it if you want to.

The only possible reason to leave it there is to show your *intent* to anyone reading your CSS: that you *want* the element to be shown as a block-level element.

It was probably included in the first place because the author of that CSS was unaware that `float` forces `display: block`.
Display: block tells the browser that you want a certain element displayed in a "block": it is the only element on that "line" of the browser (so you can't fit multiple elements next to each other). You can also have "inline", which is the opposite. Source: <https://developer.mozilla.org/en-US/docs/Web/CSS/display>