LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bug - Function "multiplier"

Solved!
Go to solution

Hello everybody,

 

I noticed a potential bug with the function "Multiplier". Maybe there is a rational explanation but I don't see for this moment.

 

I did 80*10 and the result is 32 and not 800 ??? Why???

 

I joined a picture.

 

Thank by advance at the community

 

regards,

 

Régis

0 Kudos
Message 1 of 6
(1,075 Views)
Solution
Accepted by topic author regis76

Your data type is a U8 or I8.  The value is being rolled over and so you get 32 (800 mod 256 = 32).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 6
(1,066 Views)

Yes, the local variable with the number "10" is U8. I forgot. But I'm surprised the result was 32 and not 256?

 

I put U16 and my problem has been corrected.

 

I'm a stupid man. ^^

 

Thank you very much.

 

Have a nice day,

 

Regards,

 

Régis

 

 

0 Kudos
Message 3 of 6
(1,054 Views)

It can't be 256 because a U8 can only b3 0-255.

 

It can't be 255 because when you do math on integers and the results go out of range, the value rolls over.  It doesn't stay stuck at the max or min.

0 Kudos
Message 4 of 6
(1,045 Views)

Ok, I understand better. Effectively, I thought the value blocked on max value 255 (and not 256, I did a mistake in my previous message, thank you for the correction).

 

Thank you a lot for your full explanation. Very clear.

 

I will sleep less stupid tonight ^^.

 

Have a nice day,

 

Regards,

 

Régis

0 Kudos
Message 5 of 6
(1,039 Views)

@regis76 wrote:

Yes, the local variable with the number "10" is U8. I forgot. But I'm surprised the result was 32 and not 256?


The mathematical algorithm down in the processor does not do a range check.  It will just do that mathematical process and stop once 8 bits have been defined.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 6
(1,023 Views)