Commit 0e8ec95
fix(jinja): support negative exponents in ** operator
Negative integer exponents (e.g. 10 ** -9) were failing with
"unable to calculate 10 ** -9" because the I128 branch tried to
convert the exponent to u32 for checked_pow, which fails for
negative values.
Fix by promoting to f64 arithmetic when the exponent is negative,
matching Python/Jinja2 behavior. Adds unit tests covering the
exact conversion_factor values used in dbt adapter macros.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent ac8ca95 commit 0e8ec95
File tree
2 files changed
+32
-3
lines changed- .changes/unreleased
- crates/dbt-jinja/minijinja/src/value
2 files changed
+32
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | | - | |
416 | | - | |
417 | | - | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
418 | 424 | | |
419 | 425 | | |
420 | 426 | | |
| |||
720 | 726 | | |
721 | 727 | | |
722 | 728 | | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
723 | 745 | | |
0 commit comments