Let $X$ be a random variable with cumulative distribution function $F (x) = Pr(X \leq x)$. If $F(x)$ is continuous, the random variable
is said to be continuous. Let $f(x) = F^{'} (x)$ when the derivative is defined. If $ \int_{-\infty }^{+\infty }f(x) = 1$, f (x) is called the probability density function (PDF) for $X$. The set where $f(x) > 0$ is called the support set of $X$.
The differential entropy $h(X)$ of a continuous random variable $X$ with density $f(x)$ is defined as
\begin{equation}
h(X)=-\int_{S} f(x) log(f(x)) dx
\end{equation}
where S is the support set of the random variable. As in the discrete case, the differential entropy depends only on the
probability density of the random variable.When considering the triangular PDF
\begin{equation}
f(z)=
\begin{cases}
\frac{2 z}{b_{2} m_{2}}\\
\frac{2 (b_{2}-z)}{b_{2} (b_{2}-m_{2})}
\end{cases}
\end{equation}
with $b_{2}$ and $m_{2}$ real numbers. It is pretty easy to show that the differential entropy is
\begin{equation}
h_{2}=\frac{1}{2}+\log (\frac{b_2}{2})
\end{equation}
where $b_{2}=b_{1}-a_{1}$.
This results can be found here https://en.wikipedia.org/wiki/Triangular_distribution . We consider now the following triangular distribution
\begin{equation}
f(z)=
\begin{cases}
\frac{2}{b_1-a_1} \frac{z-a_1}{m-a_1} & a_1\leq x_1\leq m_1 \\
\frac{2}{b_1-a_1} \frac{b_1-z}{b_1-m_1} & m_1\leq x_1\leq b_1 \\
0 & elsewhere
\end{cases}
\end{equation}
with $a_{1}$, $m_{1}$, and $b_{1}$ real numbers.
Obtained shifting the previous one as shown in figure.

Because the differential entropy is invariant under translation I'm waiting to get exactly the same value of $h(z)$ when integrating the triangular probability density function between $a_{1}$ and $b_{1}$. However when computing the differential entropy I found an additional imaginary term. This is what I did
Case 1: $a_{1} \leq x \leq m_{1}$
By replacing $f(z)$ in the differential entropy equation by the triangular distribution for $a \leq x \leq m$ we get \begin{equation} h_{a1-m1}=-\frac{2 a_{1}^2 \left(\log (m_{1}-a_{1})-\log \left((a_{1}-b_{1}) (a_{1}-m_{1})\right)\right)-2 m_{1} (m_{1}-2 a_{1}) \log \left(b_{1}-a_{1}\right)+(\log (4)-1) (a_{1}-m_{1})^2}{2 (a_{1}-b_{1}) (a_{1}-m_{1})} \end{equation}
Case 2 : $m_{1} \leq x \leq b_{1}$
By replacing $f(z)$ in the differential entropy equation by the triangular distribution for $m \leq x \leq b_{1}$ we get \begin{equation} h_{m1-b1}=-\frac{2 b_{1}^2 \left(\log (m_{1}-b_{1})-\log \left((a_{1}-b_{1}) (b_{1}-m_{1})\right)\right)-2 m_{1} (m_{1}-2 b_{1})( \log \left(b_{1}-a_{1}\right) -\log (2))+b_{1}^2 \log (4)-(b_{1}-m_{1})^2}{2 (b_{1}-a_{1}) (b_{1}-m_{1})} \end{equation}
The entropy is obtained by adding $h_{a1-m1}$ to $h_{m1-b1}$. When doing so I get \begin{equation} \frac{1}{2}+\log \left(\frac{b_{1}-a_{1}}{2}\right)+\frac{2 i \pi b_{1}^2}{(a_{1}-b_{1}) (b_{1}-m_{1})} \end{equation} I probably did a mistake because the results given by the link is correct. However I don't understand why. Can someone help?