Skip to content

Commit 9cdb10a

Browse files
GiggleLiuclaude
andcommitted
fix: always wrap Big O fallback in O(...) for consistent output
When asymptotic_normal_form fails (e.g., variable^variable like num_vars^num_vars), the fallback now wraps the raw expression in O(...) instead of displaying it bare. This ensures consistent format for both human and JSON output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9748b85 commit 9cdb10a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • problemreductions-cli/src/commands

problemreductions-cli/src/commands/graph.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,11 @@ pub fn show(problem: &str, out: &OutputConfig) -> Result<()> {
242242
}
243243

244244
/// Format an expression as Big O notation using asymptotic normalization.
245-
/// Falls back to the original expression string if normalization fails.
245+
/// Falls back to wrapping the original expression if normalization fails.
246246
fn big_o_of(expr: &Expr) -> String {
247247
match asymptotic_normal_form(expr) {
248248
Ok(norm) => format!("O({})", norm),
249-
Err(_) => expr.to_string(),
249+
Err(_) => format!("O({})", expr),
250250
}
251251
}
252252

0 commit comments

Comments
 (0)