Commit Graph

34 Commits

Author SHA1 Message Date
Angel Ezquerra
fbfd4decca 'j' format specifier docs (#22928)
This is a small improvement on top of PR #22924, which documents the new
'j' format specifier for Complex numbers. In addition to that it moves
the handling of the j specifier into the function that actually
implements it (formatValueAsComplexNumber), which seems a little
cleaner.

---------

Co-authored-by: Angel Ezquerra <angel_ezquerra@keysight.com>
Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
2023-11-17 10:22:57 +01:00
Angel Ezquerra
52784f32bb Add strformat support for Complex numbers (#22924)
Before this change strformat used the generic formatValue function for
Complex numbers. This meant that it was not possible to control the
format of the real and imaginary components of the complex numbers.

With this change this now works:
```nim
import std/[complex, strformat]
let c = complex(1.05000001, -2.000003)
echo &"{c:g}"
# You now get: (1.05, -2)
# while before you'd get a ValueError exception (invalid type in format string for string, expected 's', but got g)
```

The only small drawback of this change is that I had to import complex
from strformat. I hope that is not a problem.

---------

Co-authored-by: Angel Ezquerra <angel_ezquerra@keysight.com>
2023-11-10 05:29:55 +01:00
ringabout
4d11d0619d complete std prefixes for stdlib (#22887)
follow up https://github.com/nim-lang/Nim/pull/22851
follow up https://github.com/nim-lang/Nim/pull/22873
2023-10-30 17:03:04 +01:00
Dan Rose
c2cdc752c8 Simpler complex division implementation (#20088) 2022-09-01 17:44:07 +02:00
Dan Rose
cc81866da1 Implement complex sgn (#20087)
Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
2022-08-28 22:17:18 -04:00
Andreas Rumpf
a9b62de895 CIs: attempt to use csources_v1 (#16282)
* CIs: attempt to use csources_v1
* also updated the BSDs
* also updated azure pipelines
* std modules should not itself use the 'std/' import dir...
* compiler has to be careful with std/ for v1 booting
2021-04-21 07:41:33 +02:00
konsumlamm
0c4bd65e8d Improve documentation for complex (#16588)
* Improve documentation for complex

Add missing doc comments

* Add runnableExample

Add links for principal values
Optimize `-`
Change var to let

* Use std prefix for imports
2021-01-05 17:50:15 +01:00
ee7
140ebe6019 complex.nim: Use func everywhere (#16294) 2020-12-09 10:57:12 +01:00
flywind
dd57d46f2f complex minor improvement (#16086) 2020-11-21 12:20:33 -08:00
Andreas Rumpf
e58c2d261c [backport] fix #12528, fix #12525: incorrect generic type resolution for default values (#12538) 2019-10-28 16:56:38 +01:00
narimiran
6c994b2498 [backport] run nimpretty on numbers stuff 2019-09-30 13:58:05 +02:00
Palash Nigam
f28a47ea7b fixes #11834 (#12000) 2019-08-23 07:42:33 +02:00
Andreas Rumpf
8317de7648 complex.nim: reformating [other] 2019-06-09 22:22:50 +02:00
Arne Döring
c2c05f5e72 fix #9639 (#9640) 2018-11-07 10:58:48 +01:00
Arne Döring
cc5b8c6ad2 Generic Complex type (#9590)
* remove `**`
* const `im` can now be used with Complex64
* converters from float|int to Complex are replaced by procs
* converters between various Complex types must stay to allow usage
of `im` with Complex64
* limit types for `+`, `-`, `/`, and `*` between Complex and float
* add `pow` for Complex and a number
* complex type changes
* unpublish approximation function
2018-11-05 20:27:46 +01:00
Koki Fushimi
3acedd4cd9 Add imaginary unit. (#7922) 2018-06-01 11:20:28 -04:00
Araq
bbb0fd4eb7 remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
Adam Strzelecki
43bddf62dd lib: Trim .nim files trailing whitespace
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
2015-09-04 23:03:56 +02:00
Charles Blake
840f80e45c Fix buggy rect(), doc comment, and unit test. 2015-02-28 19:21:52 -05:00
Jonathan Edwards
b1e0d2058b Addition of some complex hyperbolic functions 2015-02-28 16:12:36 -05:00
def
00e82c2fc6 Extend complex to convert to/from polar coordinates 2015-02-16 20:44:23 +01:00
gmpreussner
defbd10c19 Added complex conjugate 2015-01-24 22:57:19 -05:00
Araq
338598d9d0 fixes #495 2014-12-26 02:09:15 +01:00
Araq
bae9a0ceac more modules updated 2014-08-28 01:30:12 +02:00
Araq
11b6958755 big rename 2014-08-27 23:42:51 +02:00
def
b1a494e8b9 Add missing complex arithmetic procs 2014-07-14 14:44:58 +02:00
Grzegorz Adam Hankiewicz
72a3e21f28 Removes executable bit for text files. 2013-03-16 23:53:07 +01:00
Araq
37741f28fd additions to complex module 2011-01-07 00:32:15 +01:00
Andreas Rumpf
b2ad7b30dc bugfix: complex.nim compiles 2010-04-04 18:43:57 +02:00
Andreas Rumpf
c5d8a5c1da Bugfix: empty echo statement 2010-03-20 01:07:34 +01:00
Andreas Rumpf
40ea1d0330 fixed pango/pangoutils new wrappers 2010-02-26 01:26:16 +01:00
rumpf_a@web.de
40a5d6c3b9 continued work on html/xmlparser 2010-02-14 00:29:35 +01:00
Andreas Rumpf
66a7e3d37c added tools and web dirs 2009-09-15 23:22:22 +02:00
Andreas Rumpf
4d4b3b1c04 version0.7.10 2009-06-08 08:06:25 +02:00