Fortran coding do loop

luvbite38

Active Member
Joined
Jun 25, 2008
Messages
368
Can some1 kindly help me understand the following code, I am trying to translate the following code in VBA:

Thanks in advance

FFLC = FLC .......i understand this part
ANGLE=PI/6 !Suppose 30 Degrees .......i understand this part
Do 21800 I=i,5 .......Don't understand this
FLC=FFLC-COS(ANGLE)*NDIA
FLE=SQRT(FLB*FLB+FLC*FLC) .......i understand this part
21800 ANGLE=ATAN2(FLC,FLB).......i understand this part
if (R.NE.o.)D=R/2.+NDIA/2.......i understand this part
FLCUT = ........ .......i understand this part
LE=IFIX(FLE).......Don't understand this

My answer for FLCUT is 2387 when using the 30 degree angle but fortran result 2397 (after using the iteration which I dont understand)

Can someone please help me understand this please?

Regards
<!-- google_ad_section_end --><!-- / message -->
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
More or less

FFLC = FLC .......i understand this part
ANGLE=PI/6 !Suppose 30 Degrees .......i understand this part
For i = 1 To 5 'Do 21800 I=i,5 .......Don't understand this
FLC = FFLC - Cos(Angle) * NDIA
FLE=SQRT(FLB*FLB+FLC*FLC) .......i understand this part
ANGLE=ATAN2(FLC,FLB).......i understand this part
Next i
if (R <> 0) then D=R/2.+NDIA/2.......i understand this part
FLCUT = ........ .......i understand this part
LE=Int(FLE).......Don't understand this
 
Upvote 0
Thanks VoG,

could you please explain, what is Do loop is doing and why I am getting two differnt results.....
 
Upvote 0
I just want to understand, if I do this calculation using my calculator how should I do this???

Thanks
 
Upvote 0
I must confess that after looking at the code again I cannot understand why a loop is needed at all.
 
Upvote 0
Thanks for prompt response.

I am also confused about this.

but i believe the loop is changing the angle used in the second line. BTW what does IFIX does ??

if I do it on the paper how would it should look like and what angle I should end up with after running the loop.

Regards.

I really appreciate your help mate
 
Upvote 0
I think I'm confused too :eeek:

You are right, it is refining the value of Angle inside the loop.

The VBA equivalent of IFIX is Int
 
Upvote 0
Thanks for prompt response.

I am also confused about this.

but i believe the loop is changing the angle used in the second line. BTW what does IFIX does ??

if I do it on the paper how would it should look like and what angle I should end up with after running the loop.

Regards.

I really appreciate your help mate
 
Upvote 0
hahaha.... thanks really appreciate all your assistance........ :D

I'll have to search online and see if I can find something.....

Once again really appreciate your assistance......

Could you briefly describe how does Loop work in Fortran??? an example with answer will be appreciated.... only if it is possible...
 
Upvote 0

Similar threads

Forum statistics

Threads
1,223,952
Messages
6,175,596
Members
452,658
Latest member
GStorm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top