( expr: MathJsonExpression | null | undefined )
| 287 | * has a precision outside of the machine range. |
| 288 | */ |
| 289 | export function machineValue( |
| 290 | expr: MathJsonExpression | null | undefined |
| 291 | ): number | null { |
| 292 | if (typeof expr === 'number') return expr; |
| 293 | |
| 294 | if (typeof expr === 'string' && matchesNumber(expr)) |
| 295 | return machineValueOfString(expr); |
| 296 | |
| 297 | // Strictly, expr.num should be a string, but we allow it to be a number |
| 298 | if (expr !== undefined && isNumberObject(expr)) return machineValue(expr.num); |
| 299 | |
| 300 | return null; |
| 301 | } |
| 302 | |
| 303 | /** |
| 304 | * Return a rational (numer over denom) representation of the expression, |
no test coverage detected