Subject: Re: [OPSAWG] Your floating-point draft (was: Fwd: [ruby-core:33638] [Ruby 1.9-Bug#4135] bug in calculations in 1.9.3dev / 1.9.2)

From: "Randy Presuhn" <[email-masked]>
Date: Sun, 12 Dec 2010 08:22:50 -0800

Hi Martin -

Thanks.  I mentioned the Goldberg article (probably with a different
link) in the mailing list discussion, but had decided to use the
older Knuth citation since it is more basic and covers the key
issues.  Do you think both are necessary?

I have to admit that I continue to be surprised by the number of
CS practitioners who seem to have forgotten their "Introduction
to Data Types" lectures.  :-)

Randy

----- Original Message ----- 
> From: "Martin J. Dürst" <[email-masked]>
> To: "Randy Presuhn" <[email-masked]>
> Sent: Sunday, December 12, 2010 4:43 AM
> Subject: Your floating-point draft (was: Fwd: [ruby-core:33638] [Ruby 1.9-Bug#4135] bug in calculations in 1.9.3dev / 1.9.2)
>
> Hello Randy,
>
> [please feel free to forward as you see fit]
>
> I saw you are working on a draft for floating-point number
> representation in SNMP. For the Ruby programming language, about once a
> week we see a bug report about floating numbers. Below is the standard
> answer that is sent to the bug reporters. This is then usually followed
> by a "stupid me" message from the bug reporter.
>
> I guess it might make sense to put a few pointers to material such as
> the stuff referenced below into your draft to avoid some people getting
> too surprised.
>
> Regards,   Martin.
>
> -------- Original Message --------
> Subject: [ruby-core:33638] [Ruby 1.9-Bug#4135] bug in calculations in
> 1.9.3dev / 1.9.2
> Date: Wed, 8 Dec 2010 22:12:52 +0900
> From: Yui NARUSE <[email-masked]>
> Reply-To: [email-masked]
> To: [email-masked]
>
> Issue #4135 has been updated by Yui NARUSE.
>
>
> Learn floating point numbers.
>
> What Every Computer Scientist Should Know About Floating-Point Arithmetic
> http://docs.sun.com/source/806-3568/ncg_goldberg.html
> http://wiki.github.com/rdp/ruby_tutorials_core/ruby-talk-faq#floats_imprecise
> http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
> ----------------------------------------
> http://redmine.ruby-lang.org/issues/show/4135
>
> ----------------------------------------
> http://redmine.ruby-lang.org
>
>

---

From: "Martin J. Dürst" <[email-masked]>
Date: Mon, 13 Dec 2010 18:40:14 +0900

Hello Randy,

> issues.  Do you think both are necessary?

I think in these days and ages, having a reference that can be reached 
by a link (rather than by grabbing a book from the bookshelf) can be 
very helpful. Also, Knuth doesn't talk about IEEE, at least not in the 
Second Edition that you cite and that I have in front of me. So I would 
be inclined to cite both.

> to Data Types" lectures.  :-)

Well, yes. But we learn 2+2=4 at age 2 or 3, which means it's deeply 
ingrained into our brain, whereas the floating point stuff is just a 
thin veneer on top. That may explain that people get easily confused by 
"almost" whole numbers.

Regards,    Martin.

>> From: "Martin J. Dürst"<[email-masked]>
>> To: "Randy Presuhn"<[email-masked]>
>> From: Yui NARUSE<[email-masked]>

-- 
#-# Martin J. Dürst, Professor, Aoyama Gakuin University
#-# http://www.sw.it.aoyama.ac.jp   mailto:[email-masked]

---

From: Andy Bierman <[email-masked]>
Date: Mon, 13 Dec 2010 08:19:48 -0800

Hi,

I guess I have forgotten that most SNMP agents have no floating point
support whatsoever.  Also agents tend to prefer storing numbers in
the fewest number of bytes.  I guess nowadays, SNMP agents need FP,
and don't care how much storage MIB objects take up on the device.

Andy

-----Original Message-----
From: [email-masked] [mailto:[email-masked]] On Behalf Of Randy Presuhn
Sent: Sunday, December 12, 2010 8:23 AM
To: Martin J. Dürst
Cc: [email-masked]
Subject: Re: [OPSAWG] Your floating-point draft (was: Fwd: [ruby-core:33638] [Ruby 1.9-Bug#4135] bug in calculations in 1.9.3dev / 1.9.2)

Hi Martin -

Randy

----- Original Message ----- 
> http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems

_______________________________________________
OPSAWG mailing list
[email-masked]
https://www.ietf.org/mailman/listinfo/opsawg

---

From: "Randy Presuhn" <[email-masked]>
Date: Mon, 13 Dec 2010 11:03:15 -0800

Hi -

> From: "Andy Bierman" <[email-masked]>
> To: "Randy Presuhn" <[email-masked]>; "Martin J. Dürst" <[email-masked]>
> Cc: <[email-masked]>
> Sent: Monday, December 13, 2010 8:19 AM
> Subject: RE: [OPSAWG] Your floating-point draft (was: Fwd: [ruby-core:33638][Ruby 1.9-Bug#4135] bug in calculations in 1.9.3dev /
1.9.2)
...
> support whatsoever.

In the embedded systems I've worked on, floating-point support (usually
via run-time libraries, rather than floating-point hardware) was generally
available. (e.g. Gnu C runtimes) However, as a *developer* *decision* we
chose not to use it, because the things we were doing in those products
did not need it.  Stripping out the floating point support itself didn't
make the binaries a lot smaller.  (As I recall the real bloat was in printf
and scanf, rather than the math code itself.)

>  Also agents tend to prefer storing numbers in
> the fewest number of bytes.

In every case I can think of where using floating point is preferable
to (scaled) integers, the floating point representation will be MORE
compact.  Floating point sacrifices precision (and in some cases
accuracy) in order to gain compactness for a given dynamic range.
If a scaled integer can cover the needed range and precision in fewer
bytes, then a floating-point type is the wrong tool for the job.

>  I guess nowadays, SNMP agents need FP,

Thinking about this as a former implementor, I'd argue that this
should have no impact whatsoever on the SNMP master agent.  The
only thing in the managed device that needs to know about it at
all would be the subagent(s) actually responsible for the
floating-point data. At the level of AgentX or SMUX or whatever
your communication mechanism happens to be, it's just an octet
string.  If none of your box's MIBs has floating-point data, its
a complete non-issue.

Randy