Home > Archive > Fortran > September 2004 > accuracy and precision computing
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
accuracy and precision computing
|
|
|
| hi evrybody!
I'm developing a program to analyzing radiation pattern of microstrip
antennas using the moment methods.
the same code it's been ported to Mathematica (Wolfram Research)
running the 2 code I discover that there is some difference in the result
now I'm debugging all the variable and I'm writing a program in VB to do
that, cause the variable it's so much!
now I wonder which compiler is more accurate, Fortran or Mathematica??
in both code I'm using the max dimension for the real and complex variables
(in fortran: Real(8) and Double Complex, right?)
because if fortran it's more accurate than Mathematica I stop immediatly to
check the billion variables!!!!
thank to all!!
bye from Rome!
Marco
ps
the machine is a PC with windows2k
I've read somewhere that the core of mathematica it's been written in C but
I don't know how they have treated the accuracy of the number.
| |
| beliavsky@aol.com 2004-09-26, 3:57 pm |
|
"GioX®" <spamstop@email.it> wrote:
>hi evrybody!
>I'm developing a program to analyzing radiation pattern of microstrip
>antennas using the moment methods.
>
>the same code it's been ported to Mathematica (Wolfram Research)
>
>running the 2 code I discover that there is some difference in the result
>now I'm debugging all the variable and I'm writing a program in VB to do
>that, cause the variable it's so much!
>
>now I wonder which compiler is more accurate, Fortran or Mathematica??
>
>in both code I'm using the max dimension for the real and complex variables
>(in fortran: Real(8) and Double Complex, right?)
Which Fortran compiler are you using? Is your code written in Fortran 77,
90, or 95? Some compilers, including Lahey/Fujitsu and Absoft, support quadruple
precision (Real(16)). With Lahey, you can use the -quad option when compiling
and do not need to change your code (although this approach is not portable
across compilers). A free trial of the Lahey compiler is available -- see
http://www.lahey.com .
If your Fortran 90 compiler does not support quad precision, you can try
Alan Miller's code at http://users.bigpond.net.au/amiller/quad.html .
Quad precision will be slower than double.
Are you sure that your problems are due to lack of numerical precision? It's
good to compile your code with many compilers and with debugging options
turned on.
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
| |
|
| "beliavsky@aol.com" <beliavsky@127.0.0.1:7501> ha scritto nel messaggio
news:4156c245$1_1@127.0.0.1...
>
> "GioX®" <spamstop@email.it> wrote:
variables[color=darkred]
>
> Which Fortran compiler are you using? Is your code written in Fortran 77,
> 90, or 95? Some compilers, including Lahey/Fujitsu and Absoft, support
quadruple
> precision (Real(16)). With Lahey, you can use the -quad option when
compiling
> and do not need to change your code (although this approach is not
portable
> across compilers). A free trial of the Lahey compiler is available -- see
> http://www.lahey.com .
I'm using FORTRAN 90, with MS Dev Studio (FortranPowerStation4.0)
> If your Fortran 90 compiler does not support quad precision, you can try
> Alan Miller's code at http://users.bigpond.net.au/amiller/quad.html .
>
> Quad precision will be slower than double.
>
> Are you sure that your problems are due to lack of numerical precision?
yes, for sure...
> It's good to compile your code with many compilers and with debugging
options
> turned on.
now I try LF with quad precision and I'll post the result
thanks!
Marco
| |
| Tim Prince 2004-09-26, 3:57 pm |
|
"GioX®" <spamstop@email.it> wrote in message
news:2rnvquF1a5ereU1@uni-berlin.de...
> "beliavsky@aol.com" <beliavsky@127.0.0.1:7501> ha scritto nel messaggio
> news:4156c245$1_1@127.0.0.1...
result[color=darkred]
do[color=darkred]
> variables
77,[color=darkred]
> quadruple
> compiling
> portable
see[color=darkred]
>
> I'm using FORTRAN 90, with MS Dev Studio (FortranPowerStation4.0)
>
>
> yes, for sure...
>
> options
>
> now I try LF with quad precision and I'll post the result
> thanks!
>
> Marco
Don't forget to look for constants or variables which you have forgotten to
declare in full precision. LF may have an option to promote constants, in
case you missed them. Intel Fortran also has 128-bit quad precision.
| |
| beliavsky@aol.com 2004-09-26, 3:57 pm |
|
"GioX®" <spamstop@email.it> wrote:
>I'm using FORTRAN 90, with MS Dev Studio (FortranPowerStation4.0)
This compiler has a poor reputation. One Fortran expert opined "This is one
of the worst compilers on the planet."
Google "worst Microsoft fortran compiler planet" in comp.lang.fortran for
more info. If your code is standard Fortran 90 any Fortran 90 or 95 compiler
should handle it, but if you used any MS Fortran extensions it will be easiest
to migrate to Compaq Visual Fortran or Intel Visual Fortran.
It's important to use a solid compiler.
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
| |
|
| "beliavsky@aol.com" <beliavsky@127.0.0.1:7501> ha scritto nel messaggio
news:4156e4b2$1_1@127.0.0.1...
>
> "GioX®" <spamstop@email.it> wrote:
>
>
> This compiler has a poor reputation. One Fortran expert opined "This is
one
> of the worst compilers on the planet."
> Google "worst Microsoft fortran compiler planet" in comp.lang.fortran for
> more info. If your code is standard Fortran 90 any Fortran 90 or 95
compiler
> should handle it, but if you used any MS Fortran extensions it will be
easiest
> to migrate to Compaq Visual Fortran or Intel Visual Fortran.
> It's important to use a solid compiler.
>
yessss!
I've got the right result now!
I've tried with LF compiler (trial) but the result was identical to the MS
compiler
but with option -quad I have the same result of mathematica (almost!), and
the difference between
two software now go from 0 to 6.9E-18, and I think it's a mathematica's
fault cause when
it encounters a number smaller than 1E-20, it round to 0, but I don't know
how to set to don't do that
but how can mathematica be so precise??!
thanks for the help!
bye!
Marco
| |
| Rich Townsend 2004-09-26, 3:57 pm |
| GioX® wrote:
> but how can mathematica be so precise??!
It uses arbitrary-precision math. This sounds great in principle, but in
practice it tends to be very slow.
cheers,
Rich
--
Dr Richard H D Townsend
Bartol Research Institute
University of Delaware
[ Delete VOID for valid email address ]
| |
| Gerry Thomas 2004-09-27, 3:57 am |
|
"GioX®" <spamstop@email.it> wrote in message
news:2rnqr8F1c3g28U1@uni-berlin.de...
> hi evrybody!
> I'm developing a program to analyzing radiation pattern of microstrip
> antennas using the moment methods.
>
> the same code it's been ported to Mathematica (Wolfram Research)
>
> running the 2 code I discover that there is some difference in the result
> now I'm debugging all the variable and I'm writing a program in VB to do
> that, cause the variable it's so much!
>
> now I wonder which compiler is more accurate, Fortran or Mathematica??
>
> in both code I'm using the max dimension for the real and complex
variables
> (in fortran: Real(8) and Double Complex, right?)
>
> because if fortran it's more accurate than I stop immediatly to
> check the billion variables!!!!
>
> thank to all!!
> bye from Rome!
> Marco
>
> ps
> the machine is a PC with windows2k
> I've read somewhere that the core of mathematica it's been written in C
but
> I don't know how they have treated the accuracy of the number.
>
>
In numerics, Mathematica is always superior to fortran. Ditto for Matlab.
--
Ciao,
Gerry T.
|
|
|
|
|