Jump to content

Is this a logic error?

This is the flow chart my teacher gave me for a program that solves the quadratic formula

how could b^2-4ac not be >= 0 and b^2 be much greater than 4ac at the same time?

Capture.PNG

Linux "nerd".  If I helped you please like my post and maybe add me as a friend :)  ^_^!

Link to comment
https://linustechtips.com/topic/582433-flow-chart-logic-error/
Share on other sites

Link to post
Share on other sites

Bit of a guess this, often these things are trick questions to make you R&D and learn, but from 1st glance, there is no decision on No side of circled decision so variable would inject into that and could be yes at same time resulting in 2 forumlae end points. but this could be process flow logic graph drawing error. 

 

By design, process flow diagrams if done correctly cannot result in multiple decisions being correct at the same, otherwise you need to revise the flow diagram to make sure the path has a decision and correctly resolved. Same for electronic design.

 

how is the >> operator processed in this environment / language?

 

might want to look into how binary operators work?

>>   right shift            integer >> unsigned integer
Link to comment
https://linustechtips.com/topic/582433-flow-chart-logic-error/#findComment-7603317
Share on other sites

Link to post
Share on other sites

5 minutes ago, Starglider said:

Bit of a guess this, often these things are trick questions to make you R&D and learn, but from 1st glance, there is no decision on No side of circled decision so variable would inject into that and could be yes at same time resulting in 2 forumlae end points. but this could be process flow logic graph drawing error. 

 

By design, process flow diagrams if done correctly cannot result in multiple decisions being correct at the same, otherwise you need to revise the flow diagram to make sure the path has a decision and correctly resolved. Same for electronic design.

I'm looking at the previous "no".  If the previous statement (b^2-4ac>=0) is "no", then how could (b^2>>4ac) be "yes"? 

Linux "nerd".  If I helped you please like my post and maybe add me as a friend :)  ^_^!

Link to comment
https://linustechtips.com/topic/582433-flow-chart-logic-error/#findComment-7603339
Share on other sites

Link to post
Share on other sites

It's been many years since I've been doing this stuff, but certain equations can result in 2 answers and thus 2 values go through the process flow.

 

But by design, logical operators, depending on what you use but >= , <= etc only match one. 

 

About all I can remember...

 

Quadratic can be + or - if memory is correct?

Link to comment
https://linustechtips.com/topic/582433-flow-chart-logic-error/#findComment-7603353
Share on other sites

Link to post
Share on other sites

An operator cannot defy its function.

 

Quadratic has two answers (in theory).

 

however, if logic flow chart is run via single value, and it is correct, and you put a conditional test on what you are trying to prevent, it will never be wrong, thus the flow chart is incorrect or incomplete.

Link to comment
https://linustechtips.com/topic/582433-flow-chart-logic-error/#findComment-7604722
Share on other sites

Link to post
Share on other sites

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

×