(expr: Expression)
| 257 | // Use a base cost similar to Sqrt |
| 258 | nameCost = 5; |
| 259 | } else if (['Multiply'].includes(name)) { |
| 260 | // We want 2x to be less expensive than x + x, so if the first operand |
| 261 | // is a small number coefficient, treat it as cheaper |
| 262 | const fnExprMul = isFunction(expr) ? expr : undefined; |
| 263 | const ops = fnExprMul?.ops ?? []; |
| 264 | if (ops.length === 2 && isNumber(ops[0])) { |
| 265 | // A numeral times something is a "coefficient" shape and is priced |
| 266 | // near an `Add`, so that `2x` beats `x + x`. |
| 267 | // |
nothing calls this directly
no test coverage detected