[Pachi] Pachi with doubles

Petr Baudis pasky at ucw.cz
Fri May 18 16:49:54 CEST 2012


  Hi!

On Wed, May 16, 2012 at 08:40:01AM -0700, Michael Williams wrote:
> Isn't this routine broken when floating_t is defined as double?
> 
> floating_t
> fast_frandom(void)
> {
> 	/* Construct (1,2) IEEE floating_t from our random integer */
> 	/* http://rgba.org/articles/sfrand/sfrand.htm */
> 	union { unsigned long ul; floating_t f; } p;
> 	p.ul = (((pmseed *= 16807) & 0x007fffff) - 1) | 0x3f800000;
> 	return p.f - 1.0f;
> }

  It is! Thanks for catching that. As a quick fix, I forced it to
work with float instead of floating_t; we do not currently use this
function so no code has been immediately broken.

-- 
				Petr "Pasky" Baudis
	Smart data structures and dumb code works a lot better
	than the other way around.  -- Eric S. Raymond


More information about the Pachi mailing list