Understanding Calculation

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
JUZAR
Posts: 53
Joined: Wed Feb 25, 2015 1:31 pm
Has thanked: 15 times
Been thanked: 4 times
Contact:

Understanding Calculation

Post by JUZAR »

Hi Sir,

I was just browsing one example of 3 digit seven segment display in FC6. Kindly see attached screen shot of subroutine "Seg2" of voltmeter example. The analog value 23.2365 is allocated to individual digits of by using calculation icon, but I am unable to understand how this calculation is done. Kindly explain how its done.

Regards.
Attachments
Screenshot (2).png
Screenshot (2).png (217.93 KiB) Viewed 3452 times

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Understanding Calculation

Post by mnf »

Hi Juzar,

The key to understand this is that % is mod (or remainder after division) note - this is working on integer maths.

So 13 % 10 = 3

This is used to get the individual digits.

as an example:

31.2 * 10 = 312.
312 % 10 = 2. Get last digit.
31.2 % 10 = 1
31.2 / 10 = 3 // division - again using integer maths

Martin

JUZAR
Posts: 53
Joined: Wed Feb 25, 2015 1:31 pm
Has thanked: 15 times
Been thanked: 4 times
Contact:

Re: Understanding Calculation

Post by JUZAR »

Thanks Sir for your quick response.

Post Reply