DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>,
	"Stephen Hemminger" <stephen@networkplumber.org>,
	dev@dpdk.org
Cc: "Ray Kinsella" <mdr@ashroe.eu>
Subject: RE: [RFT v2 1/3] random: add rte_rand_float()
Date: Wed, 25 May 2022 17:26:06 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D870B3@smartserver.smartshare.dk> (raw)
In-Reply-To: <589158f3-e42a-8e10-c5ad-5b05b4e6db04@ericsson.com>

> From: Mattias Rönnblom [mailto:mattias.ronnblom@ericsson.com]
> Sent: Wednesday, 25 May 2022 16.46
> 
> On 2022-05-25 00:18, Stephen Hemminger wrote:
> > The PIE code and other applications can benefit from having a
> > fast way to get a random floating point value. This new function
> > is equivalent to erand48_r in the standard library.
> >

> > +/**
> > + * @warning
> > + * @b EXPERIMENTAL: this API may change without prior notice
> > + *
> > + * Generates a pseudo-random floating point number.
> > + *
> > + * This function returns a nonnegative double-precison floating
> random
> > + * number uniformly distributed over the interval [0.0, 1.0).
> > + *
> > + * If called from lcore threads, this function is thread-safe.
> > + *
> > + * @return
> > + *   A pseudo-random value between 0 and 1.0.
> > + */
> > +__rte_experimental
> > +double rte_rand_float(void);
> > +
> 
> Newline after "double" missing.
> 
> I would call it something else than "float", in particular since it
> doesn't return "float" but a "double" type floating point value.
> 
> rte_drand() maybe? Short, but might be confused with rte_rand(), given
> the visual similarity. I still I would still prefer that over
> rte_rand_double().

Although we use foo32() and foo64() for many functions returning uint32_t/uint64_t, I don't think we need a common (and preferably short) postfix for functions returning double. Such functions should be rare.

So:
+1 to rte_drand() - it resembles drand48() in stdlib.h.


  reply	other threads:[~2022-05-25 15:26 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24 18:46 [RFT 0/2] pie: floating point fixes Stephen Hemminger
2022-05-24 18:46 ` [RFT 1/2] rte_pie: remove unnecessary floating point Stephen Hemminger
2022-05-24 18:46 ` [RFT 2/2] rte_pie: fix incorrect floating point math Stephen Hemminger
2022-05-24 19:31 ` [RFT 0/2] pie: floating point fixes Morten Brørup
2022-05-24 22:18 ` [RFT v2 0/3] pie: fix random number issues Stephen Hemminger
2022-05-24 22:18   ` [RFT v2 1/3] random: add rte_rand_float() Stephen Hemminger
2022-05-25 11:55     ` Ray Kinsella
2022-05-25 14:45     ` Mattias Rönnblom
2022-05-25 15:26       ` Morten Brørup [this message]
2022-05-25 15:45       ` Stephen Hemminger
2022-05-25 15:47       ` Stephen Hemminger
2022-05-24 22:18   ` [RFT v2 2/3] rte_pie: remove unnecessary floating point Stephen Hemminger
2022-05-24 22:18   ` [RFT v2 3/3] rte_pie: fix incorrect floating point math Stephen Hemminger
2022-05-25 17:12 ` [PATCH v3 0/3] introduce random floating point function Stephen Hemminger
2022-05-25 17:12   ` [PATCH v3 1/3] random: add rte_drand() funciton Stephen Hemminger
2022-05-25 17:12   ` [PATCH v3 2/3] rte_pie: remove unnecessary floating point Stephen Hemminger
2022-05-25 17:12   ` [PATCH v3 3/3] rte_pie: fix incorrect floating point math Stephen Hemminger
2022-05-25 20:31 ` [PATCH v4 0/3] introduce random floating point function Stephen Hemminger
2022-05-25 20:31   ` [PATCH v4 1/3] random: add rte_drand() function Stephen Hemminger
2022-05-26  9:56     ` Ray Kinsella
2022-05-26 13:20     ` Mattias Rönnblom
2022-05-26 15:25       ` Stephen Hemminger
2022-05-26 15:28       ` Stephen Hemminger
2022-05-26 20:19       ` Stephen Hemminger
2022-05-25 20:31   ` [PATCH v4 2/3] rte_pie: remove unnecessary floating point Stephen Hemminger
2022-05-25 20:31   ` [PATCH v4 3/3] rte_pie: fix incorrect floating point math Stephen Hemminger
2022-05-26  7:06   ` [PATCH v4 0/3] introduce random floating point function Morten Brørup
2022-05-26 20:26 ` [PATCH v5 " Stephen Hemminger
2022-05-26 20:26   ` [PATCH v5 1/3] random: add rte_drand() function Stephen Hemminger
2022-05-26 20:26   ` [PATCH v5 2/3] rte_pie: remove unnecessary floating point Stephen Hemminger
2022-05-30 11:50     ` Dumitrescu, Cristian
2022-06-21  8:18     ` Singh, Jasvinder
2022-05-26 20:26   ` [PATCH v5 3/3] rte_pie: fix incorrect floating point math Stephen Hemminger
2022-05-30 11:50     ` Dumitrescu, Cristian
2022-06-21  8:18     ` Singh, Jasvinder
2022-06-22  9:21   ` [PATCH v5 0/3] introduce random floating point function Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98CBD80474FA8B44BF855DF32C47DC35D870B3@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=dev@dpdk.org \
    --cc=mattias.ronnblom@ericsson.com \
    --cc=mdr@ashroe.eu \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).