Commit f1d32aa
Add CachedCBig, the cache-backed variant of CBig
CachedCBig is the complex twin of CachedFBig: it wraps a CBig plus a shared
Rc<RefCell<ConstCache>> handle and threads it through the complex
transcendentals (ln/exp/powf/sin/cos/tan/sin_cos/asin/acos/atan/arg),
reusing ConstCache unchanged — CBig's transcendentals are built entirely
from real FBig ops, so there are no complex-specific constants to cache.
It mirrors CBig's full always-on trait surface (formatting, ordering,
conversions, the binary operators incl. cross-type ops against both CBig
and FBig, Neg/Inverse, Sum/Product), is !Send + !Sync (so CBig stays
Send + Sync and static_cbig! is unaffected), and ships under the
dashu::FastComplex alias. The forward-compatible cache: Option<&mut
ConstCache> hook (convenience layer passes None, cached layer passes Some)
meant no Context signature change was needed.
Two intentional divergences from CBig: into_parts returns (CachedFBig,
CachedFBig) sharing the handle (vs CBig's (FBig, FBig)), and there are no
ZERO/ONE/I constants (Rc isn't const-constructible). Third-party traits
(serde/num-traits/num-order/num-complex/rand) are intentionally not
mirrored — reach them via .as_cbig().
Operator surface is macro-driven, mirroring fbig_cached_ops.rs. Tests live
as #[cfg(test)] mod tests blocks in the two source files (split by what
each owns), matching the CachedFBig layout.
Also updates AGENTS.md (cached-wrappers rule now covers CachedCBig +
FastComplex), TODO-v05.md (pulled forward from §3.4 into the Phase 3
"implemented" status), the complex changelog, and the guide's cached page
plus its SUMMARY title.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent a5f238e commit f1d32aa
9 files changed
Lines changed: 1162 additions & 11 deletions
File tree
- complex
- src
- guide/src
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
210 | 220 | | |
211 | 221 | | |
212 | 222 | | |
| |||
281 | 291 | | |
282 | 292 | | |
283 | 293 | | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | 294 | | |
293 | 295 | | |
294 | 296 | | |
| |||
391 | 393 | | |
392 | 394 | | |
393 | 395 | | |
394 | | - | |
| 396 | + | |
395 | 397 | | |
| 398 | + | |
396 | 399 | | |
397 | 400 | | |
398 | 401 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
6 | 19 | | |
7 | 20 | | |
8 | 21 | | |
| |||
0 commit comments