- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if(Yb + YT .ne. D) then
If D is the depth, then YB is the calculated distance to the centroid from the bottom and YT is the calculated distance to the centroid from the top and YB+YT should exactly equal D.
But YB and YT come from a lot of calculations, there is no way the real representations of YB and YT do not contain some minor errors. There must be limits on the .ne. analysis to determine nearness, can some one enlighten me as to the value?
I will use a delta in the real program.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The designer of the program may very well have known that Vb+YT ought to be D, and that the then clause contains corrective code to select/derive a best value for Yb and/or YT. IOW this may be part of a convergence procedure.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jim:
Sorry - poor explanation.
I am using some old DXF drawing routines I wrote in Fortran in the last 1980s, to draw the bridge beams and the check the member properties are correct. The manuals do not give drawings of all of the beams. I can plot things like the Center of gravity and the neutral axis and do an engineering sanity check. You learn this in doing FEM models.
One of the critical dimensions is the depth D, followed by the Bottom Centroid Yb and the Top centroid Yt- ie the middle in real terms in tensor analysis. Aside :: The problem is the teaching of geometry is to tightly tied to rules, and not to the underlying mathematics, the determinant is an area function etc... Try to teach students to use this stuff and engineering students look at you like you are crazy.
So I put in a check to see if D = Yb + Yt. It is easy to mistype a number and this is a simple quick check.
As I was looking at the Fortran code I thought of the great book, how round is your circle. So from there, if YB = Yb +- error1 and YT = Yt +- error2
and d = D +- error3
then if d = YB + YT, what happens in the .ne. equation with random numerical errors, 1.00000000478 is that really one when the 478 is a rounding error.
The Intel manual does not tell me how the ne works. Is it a bit by bit comparison of two registers, say or is "A" the same as " A ". The humans says they are the same the computer says first is character*1 and the second is character*3. What is true and false, so in some languages true is any number that is not zero, popped to that little problem the other day.
The intel manual does not tell me the rules, practical experience tells me what generally happens, but my mental interest was the actual algorithm. The people who know this are the FORTRAN language people and the compiler writers, the boffins who inhabit this space.
So I asked.
boffin
-
a person with knowledge or a skill considered to be complex, arcane, and difficult."he had a reputation as a tax boffin, a learned lawyer"We small band of brothers?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This usage is a common source of bugs.
Comparison operators on floating point values use exact (all bits) comparisons (after any necessary automatic type conversions). So unless you have full knowledge/control over the full-bit values of the floats you should not use them when you need comparisons with some tolerance. Write/find a set of "near" comparisons with relative and absolute tolerances for such purposes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, that is what I thought, but it is nice that it is confirmed.
Conte and deBoore in 1979 taught me the small delta trick, but as @mecej4 noted there are some issues using IV code and one can add writing code on the fly.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page