Parse a float vs assign a float to variable : inconsistant storage

shepardx

Новичок
Регистрация
18.07.2023
Сообщения
16
Благодарностей
2
Баллы
3
I've made several tests
i've to parse the DOM, to retrieve some data that have decimals

* if you Assign the value of 330.2 to a variable name with an action = the result is 330.2
* if you Parse the image width of 330.2 (px) and put to a variable = the result is 331
  • same result if we make use of the get value action

exemple : retrieve the img's width/height, that can have decimals per html specifications

> how to keep the decimals ? strange that Zenno has an inconcistant behavior
 
Последнее редактирование:

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
I do not know what you are doing but and its not actually related to issues like you show some ! no idea from where this exclamation sign is coming. BUT point or coma for decimals and how code handles that depends on your PC regional settings.
 

shepardx

Новичок
Регистрация
18.07.2023
Сообщения
16
Благодарностей
2
Баллы
3
the output has no exclamation, just i'm surprised to not have the same value stored into the variable, depending from how we retrieve the data.
"BUT point or coma for decimals and how code handles that depends on your PC regional settings. "
but here i'm talking about value storage.
I did not change my locals for decimals, in both case it is the same, so why do we have different outputs ?
maybe Zenno is transforming for the image 'width' attribute from float to string ?
 

myndeswx

Client
Регистрация
15.05.2017
Сообщения
436
Благодарностей
104
Баллы
43
the output has no exclamation, just i'm surprised to not have the same value stored into the variable, depending from how we retrieve the data.
"BUT point or coma for decimals and how code handles that depends on your PC regional settings. "
but here i'm talking about value storage.
I did not change my locals for decimals, in both case it is the same, so why do we have different outputs ?
maybe Zenno is transforming for the image 'width' attribute from float to string ?
I think you made a correct assumption, all the variables you see in the project maker are actually strings (notice when you want to use any variable of your project in C# cube you have to parse it first) so it's some kind of weird parsing happening, interesting why it's rounding up to the upper number, my guess is that under the hood it's treating those numbers as int, and decimals are multiplied by some large number and divided back.
A better question is - which website is using measurements in decimals? :D
 

shepardx

Новичок
Регистрация
18.07.2023
Сообщения
16
Благодарностей
2
Баллы
3
A better question is - which website is using measurements in decimals? :D
just you can have those on svg, but also when a JS is managing the zoom level ;-)
100% : 611px > 30% : 203.66

so it's some kind of weird parsing happening, interesting why it's rounding up to the upper number, my guess is that under the hood it's treating those numbers as int, and decimals are multiplied by some large number and divided back.
yep, that's my asumption also.
seems something that can be improved by Zenno if we want to use cubes.
By C#, it's another story. But the parsing tools box are usefull in some cases, to retrieve data before passing it with int.Parse / double.Parse & Converter into our C# custom code.

but the strange rounding is making us loosing accuracy.
by "Variable Processing" it works well, but by Parse Data, Get Value cube not !

@VladZen your inputs in this ?
 

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