A problem on difficulty equation When I read this book Master Bitcoin, I have a problem in understanding the "Difficulty" in Chapter 8.  

There is a equation of difficulty:

New Difficulty = Old Difficulty * (Actual Time of Last 2016 Blocks / 20160 minutes)

I feel confused.
According to the formula, if Actual Time was longer than 20160 minutes, the New Difficulty would be bigger than Old Difficulty, and then Actual Time would be longer and longer.

It looks very strange. For me the equation should be:  

New Difficulty = Old Difficulty * (20160 minutes / Actual Time of Last 2016 Blocks)

However, I found this fomula is consistent with that in bitcoin code.  

unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params&amp; params)
{
    if (params.fPowNoRetargeting)
        return pindexLast-&gt;nBits;

    // Limit adjustment step
    int64_t nActualTimespan = pindexLast-&gt;GetBlockTime() - nFirstBlockTime;
    if (nActualTimespan &lt; params.nPowTargetTimespan/4)
        nActualTimespan = params.nPowTargetTimespan/4;
    if (nActualTimespan &gt; params.nPowTargetTimespan*4)
        nActualTimespan = params.nPowTargetTimespan*4;

    // Retarget
    const arith_uint256 bnPowLimit = UintToArith256(params.powLimit);
    arith_uint256 bnNew;
    bnNew.SetCompact(pindexLast-&gt;nBits);
    bnNew *= nActualTimespan;
    bnNew /= params.nPowTargetTimespan;

    if (bnNew &gt; bnPowLimit)
        bnNew = bnPowLimit;

    return bnNew.GetCompact();
}


Then I found this answer.
This is what I understand, but why it is different from the equation of the book and the code.

update

I think this was just an ambiguous expression.
The better expression should be:  

New Difficulty Target = Old Difficulty Target * (Actual Time of Last 2016 Blocks / 20160 minutes)
The code you're citing does not actually deal with difficulty. It deals with targets. The target is the maximum 256-bit value than the block hash is allowed to have.

The difficulty is defined as 2^208 * 65535 / target.

As for the book, that looks wrong indeed.