Force usage of double (instead of higher precision)

2017-06-28 Thread Simon Bürger via Digitalmars-d-learn
According to the standard (http://dlang.org/spec/float.html), the compiler is allowed to compute any floating-point statement in a higher precision than specified. Is there a way to deactivate this behaviour? Context (reason why I need this): I am building a "double double" type, which essent

Re: Force usage of double (instead of higher precision)

2017-06-28 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 22:16:48 UTC, Simon Bürger wrote: (If you are interested in the "double double" type, take a look here: https://github.com/BrianSwift/MetalQD which includes a double-double and even quad-double implementation in C/C++/Fortran) Nice work can you re or dual licens

Re: Force usage of double (instead of higher precision)

2017-06-28 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 23:56:42 UTC, Stefan Koch wrote: As for your problems they can be worked around. by assigning every temporary to a variable. Which will enforce the discarding of precision. Sorry for the misinformation! I was using the newCTFE fork which fixes this. Indeed you'll

Re: Force usage of double (instead of higher precision)

2017-06-28 Thread kinke via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 22:16:48 UTC, Simon Bürger wrote: I am currently using LDC on 64-bit-Linux if that is relevant. It is, as LDC on Windows/MSVC would use 64-bit compile-time reals. ;) Changing it to double on other platforms is trivial if you compile LDC yourself. You'll want to

Re: Force usage of double (instead of higher precision)

2017-06-29 Thread Simon Bürger via Digitalmars-d-learn
Thanks a lot for your comments. On Wednesday, 28 June 2017 at 23:56:42 UTC, Stefan Koch wrote: [...] Nice work can you re or dual license under the boost license ? I'd like to incorporate the qd type into newCTFE. The original work is not mine but traces back to http://crd-legacy.lbl.gov/~dh

Re: Force usage of double (instead of higher precision)

2017-06-29 Thread Simon Bürger via Digitalmars-d-learn
On Thursday, 29 June 2017 at 00:07:35 UTC, kinke wrote: On Wednesday, 28 June 2017 at 22:16:48 UTC, Simon Bürger wrote: I am currently using LDC on 64-bit-Linux if that is relevant. It is, as LDC on Windows/MSVC would use 64-bit compile-time reals. ;) Changing it to double on other platform

Re: Force usage of double (instead of higher precision)

2017-06-29 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 29 June 2017 at 12:02:48 UTC, Simon Bürger wrote: On Thursday, 29 June 2017 at 00:07:35 UTC, kinke wrote: On Wednesday, 28 June 2017 at 22:16:48 UTC, Simon Bürger wrote: I am currently using LDC on 64-bit-Linux if that is relevant. It is, as LDC on Windows/MSVC would use 64-bit c

Re: Force usage of double (instead of higher precision)

2017-06-30 Thread Luis via Digitalmars-d-learn
On Thursday, 29 June 2017 at 12:00:53 UTC, Simon Bürger wrote: Thanks a lot for your comments. On Wednesday, 28 June 2017 at 23:56:42 UTC, Stefan Koch wrote: [...] This is only happening on CTFE ? Enforcing to use the old 8086 FPU for any float/double operation would give a lot performance

Re: Force usage of double (instead of higher precision)

2017-06-30 Thread kinke via Digitalmars-d-learn
On Friday, 30 June 2017 at 11:42:39 UTC, Luis wrote: On Thursday, 29 June 2017 at 12:00:53 UTC, Simon Bürger wrote: Thanks a lot for your comments. On Wednesday, 28 June 2017 at 23:56:42 UTC, Stefan Koch wrote: [...] This is only happening on CTFE ? Enforcing to use the old 8086 FPU for an

Re: Force usage of double (instead of higher precision)

2017-06-30 Thread kinke via Digitalmars-d-learn
On Friday, 30 June 2017 at 16:21:18 UTC, kinke wrote: CTFE only (incl. parsing of literals). Just make sure you don't happen to call a std.math function only accepting reals; I don't know how many of those are still around. Oh, apparently most still are. There are even some mean overloads for

Re: Force usage of double (instead of higher precision)

2017-06-30 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 30 June 2017 at 16:29:22 UTC, kinke wrote: On Friday, 30 June 2017 at 16:21:18 UTC, kinke wrote: CTFE only (incl. parsing of literals). Just make sure you don't happen to call a std.math function only accepting reals; I don't know how many of those are still around. Oh, apparently

Re: Force usage of double (instead of higher precision)

2017-06-30 Thread kinke via Digitalmars-d-learn
On Friday, 30 June 2017 at 16:39:16 UTC, Stefan Koch wrote: On Friday, 30 June 2017 at 16:29:22 UTC, kinke wrote: On Friday, 30 June 2017 at 16:21:18 UTC, kinke wrote: CTFE only (incl. parsing of literals). Just make sure you don't happen to call a std.math function only accepting reals; I don