Speed of math function atan: comparison D and C++
Uknown
sireeshkodali1 at gmail.com
Tue Mar 6 08:50:24 UTC 2018
On Tuesday, 6 March 2018 at 08:20:05 UTC, J-S Caux wrote:
> On Tuesday, 6 March 2018 at 07:12:57 UTC, Robert M. Münch wrote:
>> On 2018-03-05 20:11:06 +0000, H. S. Teoh said:
> [snip]
> Now, with Uknown's trick of using the C math functions, I can
> reconsider. It's a bit of a "patch" but at least it works.
I'm glad I could help!
> In an ideal world, I'd like the language I use to:
> - have double-precision arithmetic with equal performance to
> C/C++
> - have all basic mathematical functions implemented, including
> for complex types
> - *big bonus*: have the ability to do extended-precision
> arithmetic (integer, but most importantly (complex)
> floating-point) on-the-fly if I so wish, without having to rely
> on external libraries.
D has std.complex and inbuilt complex types, just like C [0][1].
I modified the mandelbrot generator on Wikipedia, using D's
std.complex and didn't have too much of an issue with
performance.[2]
Also, std.bigint and mir might be of interest to you.[3]
> C++ was always fine, with external libraries for extended
> precision, but D is so much more pleasant to use. Many of my
> colleagues are switching to e.g. Julia despite the performance
> costs, because it is by design a very maths/science-friendly
> language. D is however much closer to a whole stack of existing
> codebases, so switching to it would involve much less extensive
> refactoring.
Theres a good chance D can interface with those libraries you
mentioned...
[0]: https://dlang.org/phobos/std_complex.html
[1]: https://dlang.org/phobos/core_stdc_complex.html
[2]:
https://github.com/Sirsireesh/Khoj-2017/blob/master/Mandelbrot-set/mandelbrot.d
[3]: https://github.com/libmir
More information about the Digitalmars-d-learn
mailing list