Zenno having problems with a simple math solution

  • Автор темы Автор темы VhzD8gbfAY
  • Дата начала Дата начала

VhzD8gbfAY

Новичок
Регистрация
21.03.2015
Сообщения
4
Реакции
0
Баллы
1
I attached the project. 0.10 + 0.05 is appearently 0.1500000000002 for whatever reason and I have no idea why it does that or how I could truncate it down to 0.15
 

Вложения

It's not a problem of zenoposter or c#. It's a right action for all programming languages.
SFS0GdX1QheDmFMhqmlfAw.png

use that code:
Код:
Развернуть Свернуть Копировать
decimal res = 0.1m + 0.05m;
 
Hi Amyboose, thanks for your reply.

Unfortunately I am not sure on what exactly that code does or where it should go.

I am still learning the basics of Java so bear with me.

I tried: decimal res = {-Variable.Variable0-}m + 0.05m ---> no result
I tried: decimal res = 0.1m + 0.05m; ---> no result

I am trying to make Zenno take the value of whatever is in the field (for example 0.10) and make it a variable so i can add 0.05 to it then add it to a different variable that will be entered in the field and then loop the whole process.
The only problem im having is this strange result. Question at this point: Is it even required to use Java for this or is there an easier solution?
 
I don't know js and java but you should use decimal if it supported by javascript or round to near value.
So for c# you can use float:

Код:
Развернуть Свернуть Копировать
float x = (float)0.1;
float y = (float)0.05;
float result = x + y;
 

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)