Page 1 of 1
Float Expression Bug
Posted: 23 Sep 2017, 13:19
by Naggar
Hi team
I encountered a bug with the float expression node. please see attached screenshot.
If I use numbers (1920/1080) instead of the variables (A/B) in the expression : I get integer instead of float in the result output.
Best Regards.
Re: Float Expression Bug
Posted: 25 Sep 2017, 08:38
by lerou
Hi,
that's not a bug. If you're writing
you're using integer - the result will then be cast to float - after it's already truncated. If you're using the parameter fields - they are defined as float, so they are implicitly cast to float. You could do:
to use floats or
to use doubles (the result will be cast to float).
cheers,
rou
Re: Float Expression Bug
Posted: 26 Sep 2017, 06:32
by Naggar
Ok, I was unaware of that.
Thanks
Re: Float Expression Bug
Posted: 26 Sep 2017, 08:21
by chriss0212
But what is not realy consequent is, that 10/A is possible
Greetings
Christian
Re: Float Expression Bug
Posted: 26 Sep 2017, 09:30
by Götz_B
chriss0212 wrote:But what is not realy consequent is, that 10/A is possible
That is because input property A is explicitly defined as float.
Re: Float Expression Bug
Posted: 27 Sep 2017, 07:04
by lerou
It is super consistent - IF you know that the input field is basically interpreted as C# code. And in C# the casting behaves as it does in most languages
Re: Float Expression Bug
Posted: 27 Sep 2017, 15:12
by Eric_RD
sorry christian i am with rou in this point
Re: Float Expression Bug
Posted: 28 Sep 2017, 09:46
by chriss0212
Hi...
i haven't said, that it is not consistent! It's just not easy to understand for a beginner that A/B is ok even if A and B is an int, but A/10 is not allowed
I am really happy that Ventuz is doing all the conversions by using nodes... but i think a lot beginners (and sometimes me too) would be happy, if an int used in a expression would be converted too
For the moment i can't see any disadvantage because in both cases the expression node is dealing with 2 integer's. But maybe there is?
Greetings
Christian
Re: Float Expression Bug
Posted: 28 Sep 2017, 12:44
by lerou
I get your point, I do. Two reasons to keep it this way:
1. it's like in coding languages, so every coder knows. I'm a coder, so I'm biased
I know that beginners find it more difficult. BUT: You should always use the inputs - that's just cleaner than typing in 1920/1080
2. To achieve your behaviour, Ventuz would have to write their own parser/compiler. Currently they most likely don't and just use C# - which is the better solution (far safer in terms of errors and standard behaviour).
But again, I get where you're coming from.
cheers,
rou
Re: Float Expression Bug
Posted: 28 Sep 2017, 13:46
by Karol
Rou is right!
And he listed the arguments why we won't change this behaviour.
Cheers
Karol