<div dir="ltr">Hola Óscar,<div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 5, 2013 at 6:54 PM, Oscar Aparicio Holgado <span dir="ltr"><<a href="mailto:pelucheloko@hotmail.com" target="_blank">pelucheloko@hotmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div><div dir="ltr">Hola que tal.<div><br></div><div><br></div></div></div></blockquote><div><br></div><div style>[CORTE]</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div dir="ltr"><div></div><div><br></div><div>el cual me sorprende por que cuando hago un cout a d me devuelve 2, me sorprende que no devuelva 2.5 por aquello de haber usado d como double ¿por qué?</div><div><br></div>
</div></div></blockquote><div><br></div><div style>El 2 guardado en 'd' es efectivamente de tipo 'double'. Sin embargo, los tipos de las operaciones durante la inicialización de 'd' no son de tipo 'double'. Es decir,</div>
<div style><br></div><div style>5/(x-2)<br></div><div style><br></div><div style>involucra valores de tipo 'int'. Esto implica que,<br><br>5 / (4-2);</div><div style>5 / 2;</div><div style>2</div><div style><br>Al final, inicializas el valor de 2 (de tipo 'int') a la variable, 'd'. Implícitamente, se promociona 2 (de tipo 'int') a 2.0 (de tipo 'double').</div>
<div><br></div><div><br></div><div style>Espero haber aclarado la duda.</div><div><br></div><div style>Steven</div><div style><br></div></div></div></div>