Jump to content

Recommended Posts

Posted

Gee, I hate to sound smug, but this seems like some situations I've dealt with back when I was still working...
I'd spend days trying to show someone how to deal with something, but in the end, the problem was;

they were not sharp enough to realize that they didn't understand what they did not know, so therefore they couldn't know what they didn't understand and could not realize where the problem really lay....

Pedro, please do your homework first, then come asking questions...😳

  • MVP 2023
Posted

This discussion is actually kind of funny.

@Pedro Borges - you're trying to get someone to say "Yes and here's how" to an impossible question.   You really, really want to do something that can't be done.

By definition, an integer such as a DW, ML, or MI  CAN NOT CONTAIN AN ACTUAL DECIMAL POINT.  The value in the integer can be 10, 100, or 1000 times bigger than the same number you might see on your calculator, but as Fernando pointed out those are Floating Point numbers, which are very different as far as a computer is concerned.

You'll sleep easier if you just accept you're going to have to divide by 10 in the SCADA system and write the result to a REAL data type.

Joe T.

Posted
On 4/16/2022 at 2:36 PM, Pedro Borges said:

thanks,  but this variable also goes to the Scada 

SCADAS aslo doenst like floats 😂 usually an integer Is sent and the decimal place is shifted, just because flat types uses more memory, for example  in binary form:

 0.1 = 0.000110011001100110011001101 this one needs 32 bits to be stored

    1 =  1  this one needs1 bit to be stored

 

Quote

Inside the computer, most numbers with a decimal point can only be approximated; another number, just a tiny bit away from the one you want, must stand in for it. For example, in single-precision floating-point, 0.1 becomes 0.100000001490116119384765625. If your program is printing 0.1, it is lying to you; if it is printing 0.100000001, it’s still lying, but at least it’s telling you you really don’t have 0.1.

Decimal to Floating-Point Converter - Exploring Binary

In your application I feel like you don't need to use floats, but you do you

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.