Image

Imagevalera wrote in Imagecpp

float in loop

how come this only prints up to .9, excluding 1?

[Error: Irreparable invalid markup ('<pre [...] 20px;>') in entry. Owner must fix manually. Raw contents below.]

how come this only prints up to .9, excluding 1?

<pre style=margin:0; padding-left: 20px;>#include &lt;iostream&gt;
using std::cout;
using std::endl;

int main() {
for(float i=.1; i&lt;=1; i+=.1) {
cout &lt;&lt; i &lt;&lt; endl;
}

return 0;
}</pre>