On Friday, 24 June 2016 at 20:34:38 UTC, deadalnix wrote:
On Friday, 24 June 2016 at 10:33:43 UTC, Patrick Schluter wrote:
On Friday, 24 June 2016 at 10:11:11 UTC, deadalnix wrote:
On Friday, 24 June 2016 at 08:40:26 UTC, Patrick Schluter
wrote:
On Thursday, 23 June 2016 at 20:01:26 UTC,
On Friday, 24 June 2016 at 10:33:43 UTC, Patrick Schluter wrote:
On Friday, 24 June 2016 at 10:11:11 UTC, deadalnix wrote:
On Friday, 24 June 2016 at 08:40:26 UTC, Patrick Schluter
wrote:
On Thursday, 23 June 2016 at 20:01:26 UTC, deadalnix wrote:
On Thursday, 23 June 2016 at 19:24:54 UTC, via
On Friday, 24 June 2016 at 15:17:52 UTC, Ola Fosheim Grøstad
wrote:
On Friday, 24 June 2016 at 13:51:33 UTC, Andrei Alexandrescu
wrote:
On 06/24/2016 02:58 AM, Martin Tschierschke wrote:
Second: Just look at Wikipedia and take the IEEE floating
point standard:
On Friday, 24 June 2016 at 03:22:11 UTC, Timon Gehr wrote:
On 24.06.2016 04:36, Smoke Adams wrote:
You do realize that e^(-1/t)^t is a counter example?
e^(-1/t) -> 0 as t -> 0
t -> 0 as t -> 0
That's not a counterexample to anything I said. ^ is
discontinuous at (0,0) and indeed,
On Friday, 24 June 2016 at 13:51:33 UTC, Andrei Alexandrescu
wrote:
On 06/24/2016 02:58 AM, Martin Tschierschke wrote:
Second: Just look at Wikipedia and take the IEEE floating
point standard:
https://en.wikipedia.org/wiki/Exponentiation#Zero_to_the_power_of_zero
Scrolling down, I see how
On 06/24/2016 10:03 AM, Kagamin wrote:
On Thursday, 23 June 2016 at 23:33:46 UTC, Timon Gehr wrote:
I don't want to argue this at all. x^^0 is an empty product no matter
what set I choose x and 0 from. 0^^0 = 1 is the only reasonable
convention, and this is absolutely painfully obvious from
On Thursday, 23 June 2016 at 23:33:46 UTC, Timon Gehr wrote:
I don't want to argue this at all. x^^0 is an empty product no
matter what set I choose x and 0 from. 0^^0 = 1 is the only
reasonable convention, and this is absolutely painfully obvious
from where I stand. What context are you using
On 24.06.2016 08:11, H. S. Teoh via Digitalmars-d wrote:
On Fri, Jun 24, 2016 at 05:22:11AM +0200, Timon Gehr via Digitalmars-d wrote:
[...]
(BTW: It would be fine with me if 0.0^^0.0 was NaN -- that's a
completely different case than the one at hand: pow on integers.)
That's even worse. So
On 06/24/2016 02:58 AM, Martin Tschierschke wrote:
Second: Just look at Wikipedia and take the IEEE floating point standard:
https://en.wikipedia.org/wiki/Exponentiation#Zero_to_the_power_of_zero
Scrolling down, I see how IEEE prescribes pown(0, 0) to return 1. I
guess that's a good practical
On 06/23/2016 06:08 PM, Seb wrote:
[1] https://github.com/wilzbach/perf-d/blob/master/test_pow.d
[2] https://github.com/wilzbach/perf-d/blob/master/test_powi.d
Thanks for this work! I shamelessly copied it into
https://issues.dlang.org/show_bug.cgi?id=16200 to measure the proposed
pow
On Friday, 24 June 2016 at 10:11:11 UTC, deadalnix wrote:
On Friday, 24 June 2016 at 08:40:26 UTC, Patrick Schluter wrote:
On Thursday, 23 June 2016 at 20:01:26 UTC, deadalnix wrote:
On Thursday, 23 June 2016 at 19:24:54 UTC, via Digitalmars-d
wrote:
On Thu, Jun 23, 2016 at 07:11:26PM +,
On Friday, 24 June 2016 at 08:40:26 UTC, Patrick Schluter wrote:
On Thursday, 23 June 2016 at 20:01:26 UTC, deadalnix wrote:
On Thursday, 23 June 2016 at 19:24:54 UTC, via Digitalmars-d
wrote:
On Thu, Jun 23, 2016 at 07:11:26PM +, deadalnix via
Digitalmars-d wrote:
| is bitwize or. || is
On Friday, 24 June 2016 at 09:04:55 UTC, Ola Fosheim Grøstad
wrote:
Inf^-1 = 0.0
Inf^0 = 1.0
Inf^1 = Inf
:-)
Or actually:
NaN^-epsilon = Nan
Nan^0 = 1.0
NaN^epsilon = Nan
Inf^-epsilon = 0.0
Inf^0 = 1.0
Inf^epsilon = Inf
It is rather difficult to argue that this is reasonable...
On Friday, 24 June 2016 at 06:58:14 UTC, Martin Tschierschke
wrote:
On Thursday, 23 June 2016 at 23:18:03 UTC, H. S. Teoh wrote:
On Thu, Jun 23, 2016 at 11:14:08PM +, deadalnix via
Digitalmars-d wrote:
On Thursday, 23 June 2016 at 22:53:59 UTC, H. S. Teoh wrote:
> This argument only works
On Thursday, 23 June 2016 at 20:01:26 UTC, deadalnix wrote:
On Thursday, 23 June 2016 at 19:24:54 UTC, via Digitalmars-d
wrote:
On Thu, Jun 23, 2016 at 07:11:26PM +, deadalnix via
Digitalmars-d wrote:
| is bitwize or. || is binary or.
& is bitwize and. && is binary and.
^ is bitwize xor.
On Thursday, 23 June 2016 at 23:18:03 UTC, H. S. Teoh wrote:
On Thu, Jun 23, 2016 at 11:14:08PM +, deadalnix via
Digitalmars-d wrote:
On Thursday, 23 June 2016 at 22:53:59 UTC, H. S. Teoh wrote:
> This argument only works for discrete sets. If n and m are
> reals, you'd need a different
On Thursday, 23 June 2016 at 23:18:03 UTC, H. S. Teoh wrote:
On Thu, Jun 23, 2016 at 11:14:08PM +, deadalnix via
Digitalmars-d wrote:
On Thursday, 23 June 2016 at 22:53:59 UTC, H. S. Teoh wrote:
> This argument only works for discrete sets. If n and m are
> reals, you'd need a different
On Fri, Jun 24, 2016 at 05:22:11AM +0200, Timon Gehr via Digitalmars-d wrote:
[...]
> (BTW: It would be fine with me if 0.0^^0.0 was NaN -- that's a
> completely different case than the one at hand: pow on integers.)
That's even worse. So 0^0=1 if 0 is regarded as an integer, and 0^0=NaN
if 0 is
On 24.06.2016 05:22, Timon Gehr wrote:
... break the laws of physics by
arbitrarily defining something to be true when it is not.
...
Utter nonsense. (Also note that the 'laws of physics' typically give
rise to piecewise analytic functions, and if you only consider analytic
functions, 0 ^ 0
On 24.06.2016 04:36, Smoke Adams wrote:
You do realize that e^(-1/t)^t is a counter example?
e^(-1/t) -> 0 as t -> 0
t -> 0 as t -> 0
That's not a counterexample to anything I said. ^ is discontinuous at
(0,0) and indeed, you can force the limit to an arbitrary value by
choosing
On Friday, 24 June 2016 at 01:49:27 UTC, Timon Gehr wrote:
On 24.06.2016 02:14, H. S. Teoh via Digitalmars-d wrote:
On Fri, Jun 24, 2016 at 01:58:01AM +0200, Timon Gehr via
Digitalmars-d wrote:
On 24.06.2016 01:18, H. S. Teoh via Digitalmars-d wrote:
On Thu, Jun 23, 2016 at 11:14:08PM +,
On 24.06.2016 02:14, H. S. Teoh via Digitalmars-d wrote:
On Fri, Jun 24, 2016 at 01:58:01AM +0200, Timon Gehr via Digitalmars-d wrote:
On 24.06.2016 01:18, H. S. Teoh via Digitalmars-d wrote:
On Thu, Jun 23, 2016 at 11:14:08PM +, deadalnix via Digitalmars-d wrote:
On Thursday, 23 June
On Friday, 24 June 2016 at 00:26:52 UTC, John Colvin wrote:
My biggest bugbear is actually the opposite of what you are
point out here: people doing careful benchmarking and
asm-inspection of small code-fragments in isolation when in
reality it is always going to be inlined and optimised in
On Thursday, 23 June 2016 at 23:34:54 UTC, David Nadlinger wrote:
On Thursday, 23 June 2016 at 22:08:20 UTC, Seb wrote:
[1] https://github.com/wilzbach/perf-d/blob/master/test_pow.d
[2] https://github.com/wilzbach/perf-d/blob/master/test_powi.d
This is a bad way to benchmark. You are
On Fri, Jun 24, 2016 at 01:58:01AM +0200, Timon Gehr via Digitalmars-d wrote:
> On 24.06.2016 01:18, H. S. Teoh via Digitalmars-d wrote:
> > On Thu, Jun 23, 2016 at 11:14:08PM +, deadalnix via Digitalmars-d wrote:
> > > On Thursday, 23 June 2016 at 22:53:59 UTC, H. S. Teoh wrote:
> > > > This
On Fri, Jun 24, 2016 at 01:33:46AM +0200, Timon Gehr via Digitalmars-d wrote:
> On 24.06.2016 00:53, H. S. Teoh via Digitalmars-d wrote:
> > > >Because 0^^0 = 1, and 1 is representable.
> > > >
> > > >E.g. n^^m counts the number of functions from an m-set to an n-set,
> > > >and there is exactly
On 24.06.2016 01:18, H. S. Teoh via Digitalmars-d wrote:
On Thu, Jun 23, 2016 at 11:14:08PM +, deadalnix via Digitalmars-d wrote:
On Thursday, 23 June 2016 at 22:53:59 UTC, H. S. Teoh wrote:
This argument only works for discrete sets. If n and m are reals,
you'd need a different argument.
On Thursday, 23 June 2016 at 23:34:54 UTC, David Nadlinger wrote:
I get the following results:
(This is of course not intended to be a comprehensive analysis.
For example, the codegen for the two functions is actually
identical on GDC and LDC, the relative differences are due to
measurement
On Thursday, 23 June 2016 at 22:08:20 UTC, Seb wrote:
[1] https://github.com/wilzbach/perf-d/blob/master/test_pow.d
[2] https://github.com/wilzbach/perf-d/blob/master/test_powi.d
This is a bad way to benchmark. You are essentially testing the
compiler's ability to propagate your constants
On 24.06.2016 00:53, H. S. Teoh via Digitalmars-d wrote:
>Because 0^^0 = 1, and 1 is representable.
>
>E.g. n^^m counts the number of functions from an m-set to an n-set,
>and there is exactly one function from {} to {}.
This argument only works for discrete sets.
No, it works for any
On Thu, Jun 23, 2016 at 11:14:08PM +, deadalnix via Digitalmars-d wrote:
> On Thursday, 23 June 2016 at 22:53:59 UTC, H. S. Teoh wrote:
> > This argument only works for discrete sets. If n and m are reals,
> > you'd need a different argument.
> >
>
> For reals, you can use
On Thursday, 23 June 2016 at 22:53:59 UTC, H. S. Teoh wrote:
This argument only works for discrete sets. If n and m are
reals, you'd need a different argument.
For reals, you can use limits/continuation as argument.
On Thu, Jun 23, 2016 at 11:30:51PM +0200, Timon Gehr via Digitalmars-d wrote:
> On 23.06.2016 23:04, Andrei Alexandrescu wrote:
> > On 06/23/2016 02:59 PM, Timon Gehr wrote:
> > > On 23.06.2016 19:22, Andrei Alexandrescu wrote:
> > > > So I was looking for an efficient exponentiation
Can you post codegen for each ?
On Thursday, 23 June 2016 at 21:03:08 UTC, Andrei Alexandrescu
wrote:
On 06/23/2016 02:37 PM, Seb wrote:
On Thursday, 23 June 2016 at 18:05:07 UTC, Andrei Alexandrescu
wrote:
On 06/23/2016 01:34 PM, H. S. Teoh via Digitalmars-d wrote:
I don't understand why that goto is necessary.
Eh, thank
On 23.06.2016 23:04, Andrei Alexandrescu wrote:
On 06/23/2016 02:59 PM, Timon Gehr wrote:
On 23.06.2016 19:22, Andrei Alexandrescu wrote:
So I was looking for an efficient exponentiation implementation, and
http://www.stepanovpapers.com/PAM.pdf has a nice discussion starting at
page 54.
On Thursday, 23 June 2016 at 21:03:08 UTC, Andrei Alexandrescu
wrote:
However you should test how it performs against the LLVM
intrinsics
available in LDC, e.g.:
llvm.intrinsincs.llvm_pow and llvm_powi (i = integer).
Cool! Is that a CPU operation?
Andrei
It is going to depend on the
On 6/23/2016 10:22 AM, Andrei Alexandrescu wrote:
https://dpaste.dzfl.pl/e53acb41885a
Paste bin links are ephemeral. The code from the link:
/**
*/
int pow(int lhs, uint rhs, ref bool overflow)
{ return powImpl(lhs, rhs, overflow); }
/// ditto
long pow(long lhs, uint rhs, ref bool overflow)
{
On 06/23/2016 02:59 PM, Timon Gehr wrote:
On 23.06.2016 19:22, Andrei Alexandrescu wrote:
So I was looking for an efficient exponentiation implementation, and
http://www.stepanovpapers.com/PAM.pdf has a nice discussion starting at
page 54. Stepanov's solution, however, duplicates code, so I
On 06/23/2016 02:37 PM, Seb wrote:
On Thursday, 23 June 2016 at 18:05:07 UTC, Andrei Alexandrescu wrote:
On 06/23/2016 01:34 PM, H. S. Teoh via Digitalmars-d wrote:
I don't understand why that goto is necessary.
Eh, thank you all who set me straight! I've been in my head for too
long. So
On Thursday, 23 June 2016 at 19:24:54 UTC, via Digitalmars-d
wrote:
On Thu, Jun 23, 2016 at 07:11:26PM +, deadalnix via
Digitalmars-d wrote:
| is bitwize or. || is binary or.
& is bitwize and. && is binary and.
^ is bitwize xor. ^^ is... no, never mind.
binary xor is !=
lol
3 != 5
On Thu, Jun 23, 2016 at 07:11:26PM +, deadalnix via Digitalmars-d wrote:
> | is bitwize or. || is binary or.
> & is bitwize and. && is binary and.
> ^ is bitwize xor. ^^ is... no, never mind.
binary xor is !=
lol
On Thursday, 23 June 2016 at 18:49:56 UTC, ketmar wrote:
On Thursday, 23 June 2016 at 18:35:23 UTC, jmh530 wrote:
You're thinking of pow in std.math. I don't see
opBinary!("^^") anywhere in there. I only see ^^ in comments.
the "^^" is very special, 'cause it is the one and only thing
that
On Thu, Jun 23, 2016 at 08:59:07PM +0200, Timon Gehr via Digitalmars-d wrote:
[...]
> Unrelated comment: 0^^0 should not overflow.
Says who?
On 23.06.2016 19:22, Andrei Alexandrescu wrote:
So I was looking for an efficient exponentiation implementation, and
http://www.stepanovpapers.com/PAM.pdf has a nice discussion starting at
page 54. Stepanov's solution, however, duplicates code, so I eliminated it:
On Thursday, 23 June 2016 at 18:35:23 UTC, jmh530 wrote:
You're thinking of pow in std.math. I don't see opBinary!("^^")
anywhere in there. I only see ^^ in comments.
the "^^" is very special, 'cause it is the one and only thing
that compiler recognizes as "function call" in expression
On Thu, Jun 23, 2016 at 06:35:23PM +, jmh530 via Digitalmars-d wrote:
> On Thursday, 23 June 2016 at 18:20:00 UTC, H. S. Teoh wrote:
> > On Thu, Jun 23, 2016 at 02:05:07PM -0400, Andrei Alexandrescu via
> > Digitalmars-d wrote:
> > > On 06/23/2016 01:34 PM, H. S. Teoh via Digitalmars-d wrote:
On Thursday, 23 June 2016 at 18:05:07 UTC, Andrei Alexandrescu
wrote:
On 06/23/2016 01:34 PM, H. S. Teoh via Digitalmars-d wrote:
I don't understand why that goto is necessary.
Eh, thank you all who set me straight! I've been in my head for
too long. So where is the current implementation of
On Thursday, 23 June 2016 at 18:20:00 UTC, H. S. Teoh wrote:
On Thu, Jun 23, 2016 at 02:05:07PM -0400, Andrei Alexandrescu
via Digitalmars-d wrote:
On 06/23/2016 01:34 PM, H. S. Teoh via Digitalmars-d wrote:
> I don't understand why that goto is necessary.
Eh, thank you all who set me
On Thu, Jun 23, 2016 at 02:05:07PM -0400, Andrei Alexandrescu via Digitalmars-d
wrote:
> On 06/23/2016 01:34 PM, H. S. Teoh via Digitalmars-d wrote:
> > I don't understand why that goto is necessary.
>
> Eh, thank you all who set me straight! I've been in my head for too
> long. So where is the
On Thursday, 23 June 2016 at 18:05:07 UTC, Andrei Alexandrescu
wrote:
On 06/23/2016 01:34 PM, H. S. Teoh via Digitalmars-d wrote:
I don't understand why that goto is necessary.
Eh, thank you all who set me straight! I've been in my head for
too long. So where is the current implementation of
On 06/23/2016 01:34 PM, H. S. Teoh via Digitalmars-d wrote:
I don't understand why that goto is necessary.
Eh, thank you all who set me straight! I've been in my head for too
long. So where is the current implementation of "^^"? If it's not as
fast as this, we should replace it. -- Andrei
On Thursday, 23 June 2016 at 17:22:55 UTC, Andrei Alexandrescu
wrote:
So I was looking for an efficient exponentiation
implementation, and http://www.stepanovpapers.com/PAM.pdf has a
nice discussion starting at page 54. Stepanov's solution,
however, duplicates code, so I eliminated it:
On 6/23/16 1:22 PM, Andrei Alexandrescu wrote:
So I was looking for an efficient exponentiation implementation, and
http://www.stepanovpapers.com/PAM.pdf has a nice discussion starting at
page 54. Stepanov's solution, however, duplicates code, so I eliminated it:
// Loop invariant: r * (b ^^ e) is the actual result
for (;;)
{
if (e % 2 != 0)
{
r = mul(r, b, overflow);
if (e == 1) return r;
}
b = mul(b, b, overflow);
e /= 2;
}
?
On Thu, Jun 23, 2016 at 01:22:55PM -0400, Andrei Alexandrescu via Digitalmars-d
wrote:
> So I was looking for an efficient exponentiation implementation, and
> http://www.stepanovpapers.com/PAM.pdf has a nice discussion starting
> at page 54. Stepanov's solution, however, duplicates code, so I
>
So I was looking for an efficient exponentiation implementation, and
http://www.stepanovpapers.com/PAM.pdf has a nice discussion starting at
page 54. Stepanov's solution, however, duplicates code, so I eliminated it:
https://dpaste.dzfl.pl/e53acb41885a
The cost is the use of one goto. Can the
57 matches
Mail list logo