user2541386
user2541386

Reputation: 1

pow() gives unexpected result when using typecasting

when I write code as

int  m=4;
print(pow(10,m/2))

it gives me result 100.

But when I do

int  m=4;
print((int)pow(10,m/2))

It gives result 99.

Can anyone suggest why this is happening?

Upvotes: 0

Views: 126

Answers (1)

Yu Hao
Yu Hao

Reputation: 122383

EDIT:

It's a bug of dev C++ compiler.

ADVICE: don't use dev C++ any more, it's really too old.

Upvotes: 5

Related Questions