Repository navigation
Commit 429ace7
A complex number prints the number it holds, whatever the downcasting setting at printing (#1611)
Printing a complex number with a negative imaginary part negated that part, to print a minus
sign before its magnitude. Negating makes a new number, and a new number is downcast under the
setting in force when it is made. A number made with downcasting off, and printed once it was
back on, printed as another number: 1 - 0.333...i, the decimal to forty digits, as 1 - 1/3i,
a fraction without the product sign it needs, which reads back as 1 + i/3; and the imaginary
part of erfc(16 - 0.5i), -9.49e-114, as 0. Latexize did the same. The library returns such
numbers itself as well: Number.Factorial evaluates a complex argument with the downcasting off
and returns what it made there.
Both printers negate with the downcasting off, so the negation is the same number with its sign
changed. Under one setting throughout nothing prints differently: Real.Create rounds nothing in
either mode, and what it snaps to an integer or a small rational it snaps the same way at either
sign.
StringizeRoundTripTest gains three numbers made with downcasting off. Each reads back as itself
from what Stringize prints, and Latexize prints its imaginary part's magnitude. All three fail
without the change.
Closes #1610.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent 2eeb163 commit 429ace7
3 files changed
Lines changed: 45 additions & 2 deletions
File tree
- Sources
- AngouriMath/Functions/Output
- Latex
- ToString
- Tests/UnitTests/Convenience
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
48 | 62 | | |
49 | 63 | | |
50 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
390 | 419 | | |
391 | 420 | | |
0 commit comments