exp
, xexp
¶
Raise to a power
exp
¶
Raise e to a power
exp x exp[x]
Where
x
is numeric- \(e\) is the base of natural logarithms
returns as a float \(e^x\), or null if x
is null.
q)exp 1
2.718282
q)exp 0.5
1.648721
q)exp -4.2 0 0.1 0n 0w
0.01499558 1 1.105171 0n 0w
q)exp 00:00:00 00:00:12 12:00:00
1 162754.8 0w
exp
is a multithreaded primitive.
Implicit iteration¶
exp
is an atomic function.
It applies to dictionaries and tables
q)exp(1;2 3)
2.718282
7.389056 20.08554
q)k:`k xkey update k:`abc`def`ghi from t:flip d:`a`b!(10 -21 3;4 5 -6)
q)exp d
a| 22026.47 7.58256e-10 20.08554
b| 54.59815 148.4132 0.002478752
q)exp t
a b
-----------------------
22026.47 54.59815
7.58256e-10 148.4132
20.08554 0.002478752
q)exp k
k | a b
---| -----------------------
abc| 22026.47 54.59815
def| 7.58256e-10 148.4132
ghi| 20.08554 0.002478752
Domain and range¶
domain b g x h i j e f c s p m d z n u v t
range f . f f f f f f f . f f f z f f f f
Range: fz
xexp
¶
Raise x to a power
x xexp y xexp[x;y]
Where x
and y
are numerics, returns as a float where x
is
- non-negative, xy
- null or negative,
0n
q)2 xexp 8
256f
q)-2 2 xexp .5
0n 1.414214
q)1.5 xexp -4.2 0 0.1 0n 0w
0.1821448 1 1.04138 0n 0w
The calculation is performed as exp y * log x
.
If y
is integer, this is not identical to prd y#x
.
q)\P 0
q)prd 3#2
8
q)2 xexp 3
7.9999999999999982
q)exp 3 * log 2
7.9999999999999982
xexp
is a multithreaded primitive.
Implicit iteration¶
xexp
is an atomic function.
It applies to dictionaries and keyed tables
q)3 xexp(1;2 3)
3f
9 27f
q)k:`k xkey update k:`abc`def`ghi from t:flip d:`a`b!(10 -21 3;4 5 -6)
q)3 xexp d
a| 59049 9.559907e-11 27
b| 81 243 0.001371742
q)3 xexp k
k | a b
---| ------------------------
abc| 59049 81
def| 9.559907e-11 243
ghi| 27 0.001371742
Domain and range¶
xexp| b g x h i j e f c s p m d z n u v t
----| -----------------------------------
b | f . f f f f f f . . . . . . . . . .
g | . . . . . . . . . . . . . . . . . .
x | f . f f f f f f . . . . . . . . . .
h | f . f f f f f f . . . . . . . . . .
i | f . f f f f f f . . . . . . . . . .
j | f . f f f f f f . . . . . . . . . .
e | f . f f f f f f . . . . . . . . . .
f | f . f f f f f f . . . . . . . . . .
c | . . . . . . . . . . . . . . . . . .
s | . . . . . . . . . . . . . . . . . .
p | . . . . . . . . . . . . . . . . . .
m | . . . . . . . . . . . . . . . . . .
d | . . . . . . . . . . . . . . . . . .
z | . . . . . . . . . . . . . . . . . .
n | . . . . . . . . . . . . . . . . . .
u | . . . . . . . . . . . . . . . . . .
v | . . . . . . . . . . . . . . . . . .
t | . . . . . . . . . . . . . . . . . .
Range: f