# Dispaying long number (with , in it)

## Recommended Posts

for example

i have

`\$pi=3.1415926535897932384626433832795`

but \$pi will have real value

`\$pi=3.14159265358979`

i cannot use something like

```\$pi1=3.14159265358979
\$pi2=3238462643383279```

or in another example

```\$a=10
\$b=\$a/3```

Anyone now how to make \$b

`\$b=0,333333333333333333333333333333333333`

not only

`\$b=0,3333333333333333`

Edited by Uriziel01

##### Share on other sites

Maybe this post may give you some ideas:

http://www.autoitscript.com/forum/index.php?showtopic=56915

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

Nice ! Txh alot but now i have another problem, im writing function that can quick calculate PI walue (http://en.wikipedia.org/wiki/Pi) my script looks like this

```Dim \$tStruct = DllStructCreate("double"), \$i=0
for \$ii=0 To 18
DllStructSetData(\$tStruct, 1, DllStructGetData(\$tStruct, 1) + ((1/(16^\$i))*((4/((8*\$i)+1))-(2/((8*\$i)+4))-(1/((8*\$i)+5))-(1/((8*\$i)+6)))))
\$i+=1
MsgBox(0,"PI value",DllStructGetData(\$tStruct, 1),1)
next```

I think the problem is in (im loosing the precision in this pleace)

`((1/(16^\$i))*((4/((8*\$i)+1))-(2/((8*\$i)+4))-(1/((8*\$i)+5))-(1/((8*\$i)+6)))))`

because it is buildet from normal variables not from DllStruct. Is somebody able to help me with this ? Im stuck

Edited by Uriziel01

##### Share on other sites

Nice ! Txh alot but now i have another problem, im writing function that can quick calculate PI walue (http://en.wikipedia.org/wiki/Pi) my script looks like this

```Dim \$tStruct = DllStructCreate("double"), \$i=0
for \$ii=0 To 18
DllStructSetData(\$tStruct, 1, DllStructGetData(\$tStruct, 1) + ((1/(16^\$i))*((4/((8*\$i)+1))-(2/((8*\$i)+4))-(1/((8*\$i)+5))-(1/((8*\$i)+6)))))
\$i+=1
MsgBox(0,"PI value",DllStructGetData(\$tStruct, 1),1)
next```

I think the problem is in (im loosing the precision in this pleace)

`((1/(16^\$i))*((4/((8*\$i)+1))-(2/((8*\$i)+4))-(1/((8*\$i)+5))-(1/((8*\$i)+6)))))`

because it is buildet from normal variables not from DllStruct. Is somebody able to help me with this ? Im stuck

AutoIt uses signed 32-bit integers, which limits you to -2147483648 to +2147483647 because you get 31 bits for magnitude and lose a bit for sign. Switching to unsigned (which is what SmOke_N did with 'uint') only gets you one more bit to play with, still limiting you to between 0 and 4294967296. (You could use 'uint64' to double the bits, but there will still be a limit.)

The struct type you used, "double" is a 64-bit floating point. It can't represent greater precision than a 64-bit float supports. If you want to calculate Pi to more than about 16 places to the right of the decimal place, you'll have to use a different technique. You won't be able to represent your complete value as a number variable format that AutoIt recognizes. Instead you'll have to work the math for calculating the next digit, and then assemble it as a string.

There are already scripts to calculate Pi to a million digits or more, but they don't store that result as a number variable, but as a 1MB string.

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...