pdidev / pdi

The PDI Data Interface
https://pdi.dev
BSD 3-Clause "New" or "Revised" License
6 stars 0 forks source link

use set_value plugin with floating-point values #430

Closed jbigot closed 2 months ago

jbigot commented 2 years ago

In GitLab by @Yushan-Wang on Sep 7, 2022, 13:37

Does the set_value plugin support floating-point values? All the examples provided by PDI website use integer numbers. https://pdi.dev/master/set_value_plugin.html

For example, I want to set the integer value of my_switch from an expression ${current_time} >= ${final_time} where current/final_time are floating-point numbers.

I got that the floating-point numbers are cast into integers before applying the >= operation.

For example, if current_time=1.0 and final_time=1.5, then my_switch=1 because [1.0]=1>=1=[1.5].

I also tried with ${current_time:f} >= ${final_time:f} but got the same wrong result.

jbigot commented 2 years ago

you're right, there's a bug in the logic where we do the math not based on the type of the operands (double) as expected, but on the type of the result (boolean, hence int)

jbigot commented 2 years ago

created branch 430-use-set_value-plugin-with-floating-point-values to address this issue

jbigot commented 2 years ago

created branch 430-use-set_value-plugin-with-floating-point-values to address this issue

jbigot commented 2 years ago

@Yushan-Wang, can you test with branch 430-use-set_value-plugin-with-floating-point-values?

jbigot commented 2 years ago

In GitLab by @Yushan-Wang on Sep 16, 2022, 15:08

@jbigot Sorry, the problem is still here.

jbigot commented 2 years ago

In GitLab by @Yushan-Wang on Sep 16, 2022, 19:13

After removing the old build and install, this new branch works perfectly. Thanks @jbigot

jbigot commented 2 years ago

mentioned in commit ab9edd1c7f6b919759fa3856bb19370d2811266f

jbigot commented 2 years ago

mentioned in commit 4972327772ba325fe1591864fcaa80131c3e0f67

jbigot commented 1 year ago

mentioned in commit e30b443eac49ddf135856d601b2d491517596d40

jbigot commented 1 year ago

mentioned in commit 44c212c418a07684eb9fe97c07966ebe68ca615d

jbigot commented 1 year ago

mentioned in commit a53d910378d7b2133527965cc5c16396e195124c

jbigot commented 1 year ago

mentioned in commit ae61cdaba15020ab8eb67427ccd1dfe5283bda09

jbigot commented 1 year ago

mentioned in commit dd5a3b1aaa3a98ef70a2ad76d740d6ca1a1506db

jbigot commented 1 year ago

mentioned in commit 3ef709ce012fcbf6d3a7f0d5c97fe42f180cd937

jbigot commented 1 year ago

mentioned in commit a6a012b6a618ec3c97fbb5016017d8578837f68b

jbigot commented 1 year ago

mentioned in commit 51550ba62f96cacb195eb35a7250f181d184b453

jbigot commented 1 year ago

mentioned in commit c222de1aeb68e8a1c80e9ed61c27140b32a3cd4a

jbigot commented 1 year ago

Fixed in 1.5.5