suve
mixed :pow ( mixed &ARG , … )
mixed :^ ( mixed &ARG , … )
Takes any number of arguments. Performs power between the rightmost pair of elements, then the second-rightmost, et cetera. Lifts the value of the left element to the power of the value of right one. Note that references will modify the values of variables.
Returns a copy of the value the leftmost argument ended up with.
The table below contains rules for powering values. Note that these rules are non-symmetrical; swapping the values may yield a different result. The row contains the type of the first (left) value in pair, while the column contains the type of the second (right) value in pair.
| NIL | bool | bin | oct | int | hex | float | string | array | dict | |
|---|---|---|---|---|---|---|---|---|---|---|
| NIL | Arithmetics on NIL values have no effect. | |||||||||
| bool | No effect. | |||||||||
| bin | Number is set to 1. | If bool is FALSE, number is set to 1. | No type juggling needed. | Power is calculated, result truncated and put into integer. | String is converted to number (with regard to base). | Powers by the number of entries in structure. | ||||
| oct | ||||||||||
| int | ||||||||||
| hex | ||||||||||
| float | Float is set to 1.0. | If bool is FALSE, float is set to 1.0. | No type juggling needed. | String is converted to float. | Powers by number of entries in structure. | |||||
| string | No effect. | |||||||||
| array | Powering is performed on each structure element separately. | Powering is performed between keys present in both structures. | ||||||||
| dict | ||||||||||
# :pow example. :set &D :sysinfo-disk-total :mkfloat &D :div &D :pow i2 i30 :writeln s'Disk size: ' $D s'GiB'
wikipage modified on 2014/0601/2317