← log operator page · numeric/log/sc_comp/component_base
pandas ✅ · DuckDB ✅
log of a scalar number with the base in a component, inside calc.
Logarithm: "log ( 1024, 2 ) gives 10", although the page's table and its sentence "calculates the logarithm of num base op" put the base first. The page types the second operand as component<integer> | integer, so that operand may be a component while the first is a scalar.
Me_2 = log(1024, Me_1), read as the page's examples read it: base 2 gives 10.0, base 4 gives 5.0 and base 32 gives 2.0, a Number although both operands are Integers; the other components are kept.
DS_r := DS_1[calc Me_2 := log(1024, Me_1)];
| Id_1 | Me_1 |
|---|---|
| 1 | 2 |
| 2 | 4 |
| 3 | 32 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 2 | 10.000000 |
| 2 | 4 | 5.000000 |
| 3 | 32 | 2.000000 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Integer", "role": "Measure"},
{"name": "Me_2", "type": "Number", "role": "Measure"}
]
}
]
}