- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
program jellby0
implicit none
double precision znq,zmax,zmin,t3,vz, dum1, dum2,dum3,dum4,dum5
znq = 1.0D0
zmax = znq+1.0D0
zmin = -1.00000000000000D99
t3 = 1.00000000000000D0
dum1 = zmax-zmin
dum2 = dum1*t3
dum3 = znq - dum2
dum4 = dum3 - zmin
vz = zNQ-(zmax-zmin)*t3-zmin
dum5 = abs(zmin)*0.05D0
write(*,10)"vz = ",vz, "znq - zmax = ",(zNQ-zmax),"zmax - zmin = ",dum1,"dum1*t3 = ",dum2,"znq - dum2 = ",dum3,"theoretically vz = ",dum4
10 Format (6(A,es20.12,/))
write(*,20)"error = ",dum5
20 Format(6(A,es20.12,/))
! both should be -1 (if calculated with infinite precision arithmetic)
end program
We do not live in a world of infinite precision, even the universe must have a countable number of atoms for as far as we can see.
So the real answer depends on the error in your numbers, introduced by whatever method, so both 1 and 0 both answers, which is more correct is a matter of opinion, in terms of kindergarten math, -1 in terms of real physics, it is a cat in two boxes.
This is the same as the integer problem.
Line 8 should signal a flag in the addition operation that the first number is smaller than the error on the second number, just from the programming mathematics.
I meant to add this past the post by @mecej4 in the jelby posts, but I made a mistake, apologies.
This is like the thought experiments given in exams in Pure Math 1 at ANU.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
is only to about E15, certainly if the number is a = 1e16, then the math is a + 1 = a, only if exp is less than 16 is a+ 1 = b where a and b are distinct.
Sorry just bored and waiting for a download.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page