Should uniform(-real.max, real.max) be inf?

Magnus Lie Hetland magnus at hetland.org
Thu Mar 1 02:56:35 PST 2012


On 2012-03-01 10:52:49 +0000, Magnus Lie Hetland said:

> I could just use
> 
>   uniform(cast(T) -1, cast(T) 1)*T.max
> 
> I guess (for some floating-point type T). Seems to work fine, at least.

Aaactually, not so much. The output here seems to get about the same 
exponent as T.max. Which isn't all that surprising, I guess. (Then 
again, most floating-point numbers *are* pretty large ;-)

So ... any suggestions?

-- 
Magnus Lie Hetland
http://hetland.org



More information about the Digitalmars-d-learn mailing list