Quadruple precision floating-point format??

It is an old issue. Double precision sometime is not enough and may make numerical instability. Below are some examples.

printf, "sin(pi)=%60.59e, \r cos(pi/2)==%60.59e \r", sin(pi), cos(pi/2)
 sin(pi)=1.22464679914735320717376402945839660462569212467758006379626e-16,
 cos(pi/2)==6.12323399573676603586882014729198302312846062338790031898128e-17

•t1 = 1.111111111111111111111111111111111111111111110000e+0
printf, "%51.50e \r", t1
  1.11111111111111116045435665000695735216140747070312e+00


Is it easy to extend the precision in Igor Pro? Is there an external extension or procedure to enable the quadruple precision floating-point format?

thanks,

Yaohua

APMath [/EX=exDigits /N=numDigits /V/Z] destStr = Expression

The APMath operation provides arbitrary precision calculation of basic mathematical expressions. It converts the final result into the assigned string destStr , which can then be printed or used to represent a value (at the given precision) in another APMath operation.

APMATH/N=300 str=sin(pi);print str


6.7347005794838329051862907577625120980156974543349335765678199860491653699531940255406
426260983442409807515245321189050452744896181592072531843128404076585624217557119581114
769963591534168320727473249785236073085838044687863572568774443854237570874920443223633
07839365907992185938202077150501914743174E-309


--Jim Prouty
Software Engineer, WaveMetrics, Inc.
Hello Yaohua,

IGOR supports extended (arbitrary) precision for a limited set of functions and expressions. To read more about this execute the command:

DisplayHelpTopic "APMath"

I hope this helps,

A.G.
WaveMetrics, Inc.
Thanks. It helps. However there seems some bugs when the command lines are used.

APMATH /V aa = pi^10
  9.36480474760830209737166901849193456359981572755147E+4
APMATH /V bb = pi^10
  9.36480474760830209737166901849193456359981572755147E+4
APMATH /V cc = aa + bb
  9.36480568408877685820187875565883641279327208753304E+49


It works fine when I used a function.

Function test()
        APMATH /V aa = pi^10
        APMATH /V bb = pi^10
        APMATH /V cc = aa + bb
End


9.36480474760830209737166901849193456359981572755147E+4
9.36480474760830209737166901849193456359981572755147E+4
1.87296094952166041947433380369838691271996314551029E+5



By the way, I wish that it supports the matrix operation in the near feature.

Yaohua
yaohualiu wrote:
Thanks. It helps. However there seems some bugs when the command lines are used.

APMATH /V aa = pi^10
  9.36480474760830209737166901849193456359981572755147E+4
APMATH /V bb = pi^10
  9.36480474760830209737166901849193456359981572755147E+4
APMATH /V cc = aa + bb
  9.36480568408877685820187875565883641279327208753304E+49


It works fine when I used a function.

Function test()
        APMATH /V aa = pi^10
        APMATH /V bb = pi^10
        APMATH /V cc = aa + bb
End


9.36480474760830209737166901849193456359981572755147E+4
9.36480474760830209737166901849193456359981572755147E+4
1.87296094952166041947433380369838691271996314551029E+5


Hm. I tried it using Igor Pro 6.21 on a Macintosh:
APMATH /V aa = pi^10
  9.36480474760830209737166901849193456359981572755147E+4
APMATH /V bb = pi^10
  9.36480474760830209737166901849193456359981572755147E+4
APMATH /V cc = aa + bb
  1.87296094952166041947433380369838691271996314551029E+5

Can you provide some details about your operating system and Igor version?

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Hello Yaohua,

I am unable to reproduce this problem on current versions of IGOR. Please make sure that you are not mixing between variables and strings in these expressions. All APMath results are stored in strings because regular variables can't represent arbitrary precision. If you are able to reproduce this problem please report to support@wavemetrics.com including information about your version of IGOR and the operating system that you are running on your computer.

Unless we get more demand for this, we have no plans to extend APMath to complex valued functions. In fact one could argue that there are few applications where APMath is really necessary (if one performs an otherwise proper numerical analysis). Feel free to write to me directly if you would like advice on implementing your application using other tools.

A.G.
WaveMetrics, Inc.

I found the reason. By using the command line, the APMATH does not overwrite the variable if it has the same name. It prints out the result, but there is no string with the given name created.

Thanks,

Yaohua
BY the way, I want to know how many bits a single "double-precision" variable uses in IGOR64, 64 bits or 128 bits?