9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Bakul Shah <bakul@bitblocks.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] circular fonctions: precision?
Date: Mon,  3 Oct 2011 08:29:40 -0700	[thread overview]
Message-ID: <5A54BCA4-D759-4EDC-9B9E-2259E654EF68@bitblocks.com> (raw)
In-Reply-To: <5c40d8ac0708e6def897a2f6807e20f1@chula.quanstro.net>

On Oct 3, 2011, at 7:46 AM, erik quanstrom <quanstro@quanstro.net> wrote:

>> On Oct 3, 2011, at 4:41 AM, tlaronde@polynum.com wrote: >>
>>> But to come back to programming, when calculus is the crux, the more
>>> common/known even new!  programming languages are not great tools,
>>> and "portability" i.e.  proved accuracy of the implementation for a
>>> wide range of hardware/software is fuzzy.  And it's amazing to see
>>> how one can rapidly face errors even with very basic computations.
>>> And even with integer arithmetic, not much help is guaranteed by
>>> languages.
>>> 
>> Integer & rational arithmetic is guaranteed in Scheme and some other
>> languages.  In an R5RS compliant Scheme implementation you have for
>> example (/ 5 7) => 5/7.  (If only people get over their irrational
>> fear of prefix syntax they would discover a great little language in
>> Scheme.) But most prog.  languages do not specify minimal required
>> accuracy on standard floating pt.  functions.  May be because most
>> language hackers are not numerical analysts!
> 
> i think you've got it there.  how do i stuff 5/7 in a 32-bit ethernet register?
> if you're close to the h/w, it's probablly just confusing to fight it.

Ethernet ctlrs have FP registers these days? Wow! It is just a different fight. Scheme has conversion functions + macros to do what you want. Also note that most people do not work as closely to h/w as perhaps you or I do. And of course, you don't have to use just one language.

Funny you mention h/w. I have used scheme in the past for h/w testing as well as for generating code for a custom network processor. This NP had a 512 bit barrel shifter (could hold an entire 64 byte pkt and we could poke at any bitfield upto 32 bits in length). In my test library a 'shift' was (+ (quotient 512-bit-reg 2^32) new-32-bit-value)). Could've done in C but this was more fun and far fewer lines of code and far quicker to develop! I could represent an entire test pkt as a single number and shift into the barrelshifter etc. No need to worry about grotty indexing or off by 1 errors! 







  reply	other threads:[~2011-10-03 15:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-02 16:38 tlaronde
2011-10-02 17:52 ` Bakul Shah
2011-10-02 18:06   ` erik quanstrom
2011-10-02 18:40     ` Bakul Shah
2011-10-02 18:44       ` erik quanstrom
2011-10-02 18:59         ` andrew zerger
2011-10-02 19:04         ` tlaronde
2011-10-02 19:14         ` Bakul Shah
2011-10-02 19:18           ` erik quanstrom
2011-10-02 18:44     ` tlaronde
2011-10-02 18:48       ` tlaronde
2011-10-02 18:28   ` tlaronde
2011-10-02 19:06     ` Bakul Shah
2011-10-03 11:41       ` tlaronde
2011-10-03 14:39         ` Bakul Shah
2011-10-03 14:46           ` erik quanstrom
2011-10-03 15:29             ` Bakul Shah [this message]
2011-10-03 15:58               ` Bakul Shah
2011-10-03 16:49           ` tlaronde
2011-10-03 13:03 ` Russ Cox
2011-10-03 14:44   ` Bakul Shah
2011-10-03 14:57     ` Russ Cox
2011-10-03 15:34       ` Bakul Shah
2011-10-03 15:47         ` Russ Cox
2011-10-03 16:53   ` tlaronde

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=5A54BCA4-D759-4EDC-9B9E-2259E654EF68@bitblocks.com \
    --to=bakul@bitblocks.com \
    --cc=9fans@9fans.net \
    /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).