Post Reply 
(50g) Normal Distribution
12-06-2018, 11:36 PM (This post was last modified: 12-07-2018 12:00 AM by Albert Chan.)
Post: #16
RE: (50g) Normal Distribution
Hi, Dieter

lrint() is from C language, round-to-integer.
For rounding mode = FE_TONEAREST, it is same as nearest-integer, using bankers rounding.
My latest update change the code to more familiar Python.

(12-06-2018 10:54 PM)Dieter Wrote:  
(12-06-2018 08:30 PM)Albert Chan Wrote:  const double k = 0.9189385332046728; /* ln(sqrt(2 pi)) */

That's a border case – ln(sqrt(2*pi)) does not round very well to 16 decimals. The exact value is 0,91893 85332 04672 74178... Maybe one has to find out which decimal value is closer when the binary representation is considered. ;-)

I just switched to k = 1 - ln(sqrt(2 pi)) instead.
This constant is more precise, gaining 5 bits precision (or 1 decimal digit).

Round to 16 digits, 0.08106 14667 95327 25821 ... ==> 0.08106 14667 95327 26
This happens to be same value for binary float
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(50g) Normal Distribution - John Keith - 12-03-2018, 04:20 PM
RE: (50g) Normal Distribution - Dieter - 12-03-2018, 07:05 PM
RE: (50g) Normal Distribution - John Keith - 12-03-2018, 08:45 PM
RE: (50g) Normal Distribution - Dieter - 12-03-2018, 10:18 PM
RE: (50g) Normal Distribution - John Keith - 12-03-2018, 10:59 PM
RE: (50g) Normal Distribution - John Keith - 12-04-2018, 08:54 PM
RE: (50g) Normal Distribution - Dieter - 12-04-2018, 09:48 PM
RE: (50g) Normal Distribution - Dieter - 12-05-2018, 08:49 PM
RE: (50g) Normal Distribution - John Keith - 12-06-2018, 02:58 PM
RE: (50g) Normal Distribution - Dieter - 12-06-2018, 11:08 PM
RE: (50g) Normal Distribution - John Keith - 12-07-2018, 11:21 PM
RE: (50g) Normal Distribution - Dieter - 12-06-2018, 10:54 PM
RE: (50g) Normal Distribution - Albert Chan - 12-06-2018 11:36 PM
RE: (50g) Normal Distribution - John Keith - 12-08-2018, 07:13 PM
RE: (50g) Normal Distribution - Dieter - 12-08-2018, 09:18 PM
RE: (50g) Normal Distribution - John Keith - 12-08-2018, 09:28 PM
RE: (50g) Normal Distribution - John Keith - 01-26-2019, 10:01 PM
RE: (50g) Normal Distribution - pier4r - 01-26-2019, 10:12 PM



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