Post Reply 
Simulating 15C RAN # on 35s
02-15-2015, 03:45 PM (This post was last modified: 02-15-2015 03:54 PM by Tugdual.)
Post: #15
RE: Simulating 15C RAN # on 35s
(02-15-2015 03:30 PM)rprosperi Wrote:  
(02-15-2015 07:28 AM)Thomas Klemm Wrote:  Or then we could use:
RND(n+1) = Frac(15743.52261*(\(10^5\)*RND(n)) + 0.1017980433)

This allows to split the factors into an integer and fraction part and use:
\((a+b)(c+d)=ac+ad+bc+bd\)
The good thing is that \(ac\) is an integer. Thus we can omit it.

Thomas - Could you plz explain the transition splitting the factors to "(a+b)(c+d)"? I simply can't follow this.
This is what I understood:
If RND(n) = 0.aaaaabbbbb then \(10^5\)*RND(n) = aaaaa.bbbbb
So this becomes
(15743 + 0.52261) * (aaaaa + 0.bbbbb)
aaaaa*15743 has no fractional part so you can drop it

What Thomas didn't mention (but implied in his code) is that 0.52261 * 0.bbbbb < 1 so you don't need to FP this part but aaaaa * 0.52261 > 1 as well as 15743 * 0.bbbbb > 1 so you need to FP the sum of these two ones first otherwise you will end up with 10 digits in the mantissa of which 5 will be used for IP.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Simulating 15C RAN # on 35s - Tugdual - 02-14-2015, 05:13 PM
RE: Simulating 15C RAN # on 35s - Namir - 02-15-2015, 03:44 AM
RE: Simulating 15C RAN # on 35s - Tugdual - 02-15-2015, 04:01 AM
RE: Simulating 15C RAN # on 35s - Tugdual - 02-15-2015 03:45 PM
RE: Simulating 15C RAN # on 35s - Tugdual - 02-15-2015, 08:03 AM
RE: Simulating 15C RAN # on 35s - Tugdual - 02-15-2015, 10:37 AM
RE: Simulating 15C RAN # on 35s - Tugdual - 02-15-2015, 11:42 AM
RE: Simulating 15C RAN # on 35s - Tugdual - 02-15-2015, 12:01 PM
RE: Simulating 15C RAN # on 35s - Tugdual - 02-15-2015, 05:17 PM



User(s) browsing this thread: 1 Guest(s)