Meaning of the code


#1

What is actual interpretation of following code, The programme has been created in Java NetBeans 8.2 ;

if(sum_total<=0.1 && sum_total>=(-0.1)) break;


#2

it checks if the value of sum_total is between 0.1 and -0.1 (inclusive), if so, it breaks the loop


#3

Thank you a lot. Can you pl tell me how to optimize my java codes. It takes 50 days to terminate in a 8GB i5 machine. Codes run in netbeans IDE


#4

terminate means killing the process, you mean the program takes 50 days to complete/run?

Then you should have put that in the original question, there isn’t one way to optimize code.

What kind of project is it?

The only advice i can give: study algorithms (sorting and searching algorithms), this will make you aware of optimizations.


#5

Thank you once again. you r right. It takes around 50 days to complete. Basically, the code is about solving a stochastic programming problem to find optimal cost of an Inventory Optimization Problem. I have sorted the algorithm as much as possible. Its a 600-line codes.


#6

if you wrote such complicated code, how do you not know what this line:

if(sum_total<=0.1 && sum_total>=(-0.1)) break;

does

Anyway, i am not going to check a 600 line program. That goes beyond my moderators duty.


#7

That is a valid question. while doing my PhD, there will be a possibility of forgetting many thing. Sometimes I get lot of confusion in statements.


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.