Author Topic: Where are my F-(Foating) variables?  (Read 6610 times)

Offline BBarry

  • PLUS+1 Developer
  • ***
  • Posts: 14
  • Karma: +0/-0
Where are my F-(Foating) variables?
« on: July 06, 2022, 12:20:40 AM »
 :o
Ok - So the manual seems to suggest that F32 and F64 floats exist. But I do not seem to have access to that as a datatype?
I have to take 2 byte CAN data and i need to scale it by 0.00390625 %/bit. I realize I could just do some rounding and multiply it by 39 and then divide it by 10,000. But I could loose a percent in rounding resolution there.
My other option is use the whole numbers in all my math and just keep the rounded low res for display. I hate doing that to future programmers. (I would then have 2 variables "VariableName" and "VariableNameDivide10K"

Any way to get access to the floats?
Is there a better way?



Offline SJ Industries

  • PLUS+1 Expert
  • ****
  • Posts: 60
  • Karma: +2/-0
Re: Where are my F-(Foating) variables?
« Reply #1 on: July 06, 2022, 12:20:29 PM »
Maybe a direct route to a Structured text POU. ?? I haven't had to deal with floats as such but I do use POUs for more complex maths.

Offline FluidPowerTom

  • PLUS+1 Guru
  • *****
  • Posts: 363
  • Karma: +33/-0
Re: Where are my F-(Foating) variables?
« Reply #2 on: July 06, 2022, 06:59:40 PM »
GUIDE doesn't support floats in the graphical environment at all.  As mentioned by SJ you'll have to just run the signal to a Structured Text POU wherein you can use the 'REAL' data type.
Controls Engineer
Hydra-Power Systems