fn double_scalar(val: Option<&RValue>, default: f64) -> f64
Extract a scalar f64 from an RValue, returning a default if NULL or missing.