Please rid me of this goto

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 23 15:53:59 PDT 2016


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 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 code be restructured to
> > > > not need it?
> > > > 
> > > > 
> > > > Thanks,
> > > > 
> > > > Andrei
> > > 
> > > Unrelated comment: 0^^0 should not overflow.
> > 
> > Why not? -- Andrei
> 
> 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.  If n and m are reals, you'd
need a different argument.


T

-- 
Verbing weirds language. -- Calvin (& Hobbes)


More information about the Digitalmars-d mailing list