CKTIS / CSS
exp() — natural exponential function
`exp()` raises the constant e to the power supplied by a dimensionless calculation and returns a number.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
exp( <calc-sum> )exp() raises the constant e to the power supplied by a dimensionless calculation and returns a number.
The example gives calc(10px * exp(log(3))) a used width of 30px because exp and log cancel. exp(0) produces used 10px, while exp(-infinity) produces 0px. exp(1px) is rejected because a length is not a number.
Grammar: exp( <calc-sum> ).
The argument must resolve to a <number>; the result is equivalent to pow(e, A). At +infinity the result is positive infinity, while negative infinity returns positive zero. The destination property still applies its own range restrictions, so an extremely large result may be clamped or invalidate the value depending on context.
Examples
const make=width=>{const box=document.createElement('div');box.style.width=width;document.body.append(box);return getComputedStyle(box).width};
const inverse=make('calc(10px * exp(log(3)))');
const zero=make('calc(10px * exp(0))');
const negativeInfinity=make('calc(10px * exp(-infinity))');
const invalidDimension=CSS.supports('width','calc(10px * exp(1px))');
console.log('exp-log='+inverse+'; exp-zero='+zero+'; exp-negative-infinity='+negativeInfinity+'; dimension-argument='+invalidDimension);Result
exp-log=30px; exp-zero=10px; exp-negative-infinity=0px; dimension-argument=false
`exp()` raises the constant e to the power supplied by a dimensionless calculation and returns a number.