Skip to content

Commit

Permalink
fixes nim-lang#24666; Compilation error when formatting a complex num…
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout authored Feb 5, 2025
1 parent 7695d51 commit 485b414
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/pure/complex.nim
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ runnableExamples:
{.push checks: off, line_dir: off, stack_trace: off, debugger: off.}
# the user does not want to trace a part of the standard library!

import std/[math, strformat]
import std/[math, strformat, strutils]

type
Complex*[T: SomeFloat] = object
Expand Down
6 changes: 5 additions & 1 deletion tests/stdlib/tcomplex.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ discard """
matrix: "--mm:refc; --mm:orc"
"""

import std/[complex, math]
import std/[complex, math, strformat, formatfloat]
import std/assertions

proc `=~`[T](x, y: Complex[T]): bool =
Expand Down Expand Up @@ -113,3 +113,7 @@ doAssert 123.0.im + 456.0 == complex64(456, 123)

let localA = complex(0.1'f32)
doAssert localA.im is float32

block: # bug #24666
let z = complex64(1, 2)
doAssert fmt"{z}" == "(1.0, 2.0)"

0 comments on commit 485b414

Please sign in to comment.