From WikiChip
/bigfloat Command - mIRC
< mirc‎ | commands
Revision as of 16:27, 27 November 2022 by Maroonbells (talk | contribs) (create page for new command)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The /bigfloat command either reports whether the script is in 'bigfloat mode', or can force the script in/out of bigfloat mode, where operation of several math identifiers are affected. Most notably, the results from $calc are no longer limited to numbers within doubles range, and fractions are no longer limited to 6 digits.

Synopsis

/bigfloat [on|off]
/bigfloat
  • NOTE: alternatively, individual script commands are shifted into bigfloat mode as soon as they encounter a variable name ending with '.bf', either as the variable being set, or its presence within the command string. The 'on' and 'off' mode can be silenced like .bigfloat on

Switches

none

Parameters

  • [on] - Moves the script's calculations into bigfloat mode.
  • [off] - Moves the script's calculations out of bigfloat mode.

Example

//bigfloat on | echo -a bigfloat mode is $bigfloat | bigfloat off | echo -a bigfloat mode is $bigfloat
//bigfloat off | echo -a bigfloat mode is $bigfloat but $left(%null.bf,0) now bigfloat mode is $bigfloat
* bigfloat mode is $false but now bigfloat mode is $true

Affected

* Commands:
/if ()
/while ()
var/set math:
//var -s %a.bf 2 ^ 64 , %a.bx 2 ^ 64
* Set %a.bf to 18446744073709551616
* Set %a.bx to 18446744073709552000
/inc and /dec and /hinc and /hdec
//var -s %a.bf $calc(2^53) , %a.bx %a.bf | inc -s %a.bf | inc -s %a.bx
* Inc %a.bf to 9007199254740993
* Inc %a.bx to 9007199254740992
//set %a.bf $calc(2^53) | set %a.bx %a.bf | inc -cs %a.bf | inc -cs %a.bx | timer 1 5 unset % $+ a.bf % $+ a.bx
* %a.bf continues incrementing past 2^53, while %a.bx remains constant because in non-bigfloat mode, $calc(2^53+1) = $calc(2^53)
 
Affects identifiers:
* Longer fractions returned from trig functions $cos $cosh $acos $sin $sinh $asin $tan $tanh $atan $atan2 $hypot and from $log $log2 $log10 $sqrt $cbrt $base $calc $pi $round
 
* Numbers larger than 2^53 handled without loss of precision. Note that this includes internal subtotals as well as the returned value
$calc $abs $int $ceil $floor $isnum
$gcd $modinv $lcm $numbits $powmod
$rand $min $max $sorttok
$sqrt $cbrt $log $log2 $log10
$and $xor $or $not
$isbit $biton $bitoff
 
The scope of bigfloat mode is that the called alias inherits the mode setting from the parent, but the parent is not affected by any changed setting in the child alias. For example, the next alias is called from the editbox...
 
alias bftestsub { var %mode $bigfloat | bigfloat $1 | return $qt(%mode -> $bigfloat) }
 
//bigfloat off | bftestsub on | echo -a $bigfloat
* BigFloat is off
* BigFloat is on
$false
 
//bigfloat off | echo -a $bigfloat $bftestsub(on) $bigfloat
* BigFloat is off
* BigFloat is on
$false "$false -> $true" $false
 
//bigfloat on | echo -a $bigfloat $bftestsub(off) $bigfloat
* BigFloat is on
* BigFloat is off
$true "$true -> $false" $true

Compatibility

Added: mIRC v7.72
Added on: 27 Nov 2022
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See also