calculation error
Moderator: Forum Moderators
Forum rules
Before reporting issues in this section, you must read the following topic:
Before reporting issues in this section, you must read the following topic:
- Blitzmerker
- Posts: 50
- Joined: March 20th, 2007, 5:44 pm
- Location: Germany
calculation error
Hi all,
I have the problem:
when wesnoth 1.4/1.5+svn (running on ubuntu 7.10) is calculating 100 * 0.3the result is 29 (not 30).
The c++ programalso gives the result 29. If "float" is used instead of "int" the result is 30.
Why is 100 * 0.3 = 29?
I have the problem:
when wesnoth 1.4/1.5+svn (running on ubuntu 7.10) is calculating 100 * 0.3
Code: Select all
[set_variable]
name=calc
value=100
[/set_variable]
[set_variable]
name=calc
multilpy=0.3
[/set_variable]
[message]
speaker=narrator
message="$calc"
[/message]
The c++ program
Code: Select all
#include <iostream>
using namespace std;
int main()
{
int calc = 100;
calc = calc * 0.3;
cout << calc;
return 0;
}
Why is 100 * 0.3 = 29?
:(){ :|:& };: