mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 252
T
Talon Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 252
ok we all know, or most have found out that $calc will only reproduce a number to the 6th decimal place.. example.. x.xxxxxx, so why does mIRC have identifiers that return numbers larger than 6 decimal places? For those of you who know a little math, one method for solving for pi is the Atangent of 1 multiplied by 4... example... echo -s $calc($Atan(1) * 4)
you should see 3.141592
$pi returns a much larger number.
3.14159265358979323846
whats the purpose of stopping there? or why even go that far? why not make it longer then? like
31415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679 (which truely is a piece of "Pi")

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I agree that limiting numbers/calculations to 6 decimal places is a bit ridiculous. I have a simple hand held calculator that gives me more precision than that. I don't know why Khaled stopped at 6 decimal places, but I, for one, would love to see it expanded to, say, 15...For the work that I do, 15 decimal places would be quite sufficient.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
It is not useless in that you still use those extra places when doing the calculation. The final output can only be 6 places, but the internal calculations can be greater.

Try out something simple:

//echo -a $calc(1.0000004 + 1.0000004 + 1.0000004)
3.000001

If it ignored or rounded the 7th digit above, then it would give 3 as the output. Note that I used 4 at the end rather than using two of those with a 5 at the end so there is no confusion about those being rounded.

This really is the same as most calculators, as well. Regardless of the number of places it can output, it will usually do calculations using many more places and then give the result in X number of places.

Although it does use those digits internally to give an accurate output (to 6 places), I agree that we should get the same number of places as a standard FLOAT output or DOUBLE or whatever.


Invision Support
#Invision on irc.irchighway.net
Joined: Sep 2004
Posts: 200
I
Fjord artisan
Offline
Fjord artisan
I
Joined: Sep 2004
Posts: 200
what I think would be good, would be $calc(calculations,N) where N is the # of decimal places you want it to output, if no decimal place is given, it assumes 6.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yes, it would be good to have that option.


Invision Support
#Invision on irc.irchighway.net
Joined: Jun 2016
Posts: 2
H
Bowl of petunias
Offline
Bowl of petunias
H
Joined: Jun 2016
Posts: 2
this thing is still not fixed
what a shame
many calculations dont work without this

Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
https://forums.mirc.com/ubbthreads.php/topics/256988/$calc_bugs?#Post256988
There is not something to fix as this happens by default. Check this post for Khaled's answer.

Last edited by OrFeAsGr; 08/06/16 01:45 PM.

Link Copied to Clipboard