Re: [9fans] usb jtag

2011-10-03 Thread Gorka Guardiola
On Sun, Oct 2, 2011 at 8:52 PM, erik quanstrom  wrote:
> should the ctl file contain text?  i get something that looks like it should
> be a directory, but it's not.  the manual page doesn't say what should be
> in the jtag file.
>

Jtagxx is a directory.
jtag is a connection to the jtag.
ctl is ignored for now. It looks like reading
from the ctl returns count rather than 0 which is
why you are seeing noise. I'll send a patch.


G.



Re: [9fans] circular fonctions: precision?

2011-10-03 Thread tlaronde
On Sun, Oct 02, 2011 at 12:06:18PM -0700, Bakul Shah wrote:
> 
> > I sometimes wonder if the more common 64bits will not someday see
> > CAD or related software go back to scaled integer arithmetic =E0 la
> > Intergraph dgn, where 64bits is enough for the range of coordinates
> > and precision used...
> 
> double precision seems enough for most things. ieee754-2008
> has quad precision... Symbolic math package Macsyma (& Maxima)
> has had bigfloats (arbitray precision floating point) for
> decades.  Supposedly some Common Lisp implementation have
> those as well.  Mechanical CAD packages would probably get
> more benefit from symbolic math capabilities than just scaled
> integers (keep everything in formulas until when you
> absolutely need numerical results!).

To resort to algebra (infinite precision by symbol combinations) is,
indeed, a general rule. For symbolic math capabilities, I have wandered
around the concept for geometrical description (like METAFONT/MetaPost,
where there is this distinction that is mostly blurred in programming
languages---except for basic conditionnals--- : the distinction between
an assignation and an equation).

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.
-- 
Thierry Laronde 
  http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C



Re: [9fans] circular fonctions: precision?

2011-10-03 Thread Russ Cox
On Sun, Oct 2, 2011 at 12:38 PM,   wrote:
> Is there some documentation about the precision of the circular (i.e
> trigonometric) fonctions, depending on the (plan9) implementation and
> the hardware?

They are not terribly accurate.

If you need accurate versions, the best I know are the ones
that were written at Sun and included in the FreeBSD math library.
There are copies on any FreeBSD machine and also in the
vx32 distribution: http://code.swtch.com/vx32/src/tip/src/libvxc/msun.

For Go, we started with implementations of the Plan 9 library
algorithms but have been slowly replacing them with implementations
of the Sun/FreeBSD algorithms for the improved accuracy.

Russ



Re: [9fans] circular fonctions: precision?

2011-10-03 Thread Bakul Shah
On Oct 3, 2011, at 4:41 AM, tlaro...@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! 


Re: [9fans] circular fonctions: precision?

2011-10-03 Thread Bakul Shah
On Oct 3, 2011, at 6:03 AM, Russ Cox  wrote: 
> For Go, we started with implementations of the Plan 9 library
> algorithms but have been slowly replacing them with implementations
> of the Sun/FreeBSD algorithms for the improved accuracy.

Why not just use sun/FreeBSD functions in C? Unless of course go authors are 
planning to specify guaranteed minimum accuracy!


Re: [9fans] circular fonctions: precision?

2011-10-03 Thread erik quanstrom
> On Oct 3, 2011, at 4:41 AM, tlaro...@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.

- erik



Re: [9fans] circular fonctions: precision?

2011-10-03 Thread Russ Cox
On Mon, Oct 3, 2011 at 10:44 AM, Bakul Shah  wrote:
> Why not just use sun/FreeBSD functions in C?

Because we are writing in Go.

Russ



Re: [9fans] circular fonctions: precision?

2011-10-03 Thread Bakul Shah
On Oct 3, 2011, at 7:46 AM, erik quanstrom  wrote:

>> On Oct 3, 2011, at 4:41 AM, tlaro...@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! 







Re: [9fans] circular fonctions: precision?

2011-10-03 Thread Bakul Shah

On Oct 3, 2011, at 7:57 AM, Russ Cox  wrote:

> On Mon, Oct 3, 2011 at 10:44 AM, Bakul Shah  wrote:
>> Why not just use sun/FreeBSD functions in C?
> 
> Because we are writing in Go.

I don't get it. Surely go has a FFI? Or Are you planning to reimplement many 
libraries in go?


Re: [9fans] circular fonctions: precision?

2011-10-03 Thread Russ Cox
On Mon, Oct 3, 2011 at 11:34 AM, Bakul Shah  wrote:
> I don't get it. Surely go has a FFI? Or Are you planning to reimplement many 
> libraries in go?

Using FFI for square root is overkill.

Russ



Re: [9fans] circular fonctions: precision?

2011-10-03 Thread Bakul Shah
On Mon, 03 Oct 2011 08:29:40 PDT Bakul Shah   wrote:
>  In my test library a 'shift' was
> (+ (quotient 512-bit-reg 2^32) new-32-bit-value)).

Oops. I meant:
  (+ (* (quotient 512-bit-reg 2^32) 2^32)) new-32-bit-value)
In one clock the top 32 bits shift out and new 32 bits shift
in.  It has been a while.



Re: [9fans] circular fonctions: precision?

2011-10-03 Thread tlaronde
On Mon, Oct 03, 2011 at 07:39:16AM -0700, Bakul Shah wrote:
> 
> 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! 

Thanks for your comments. I must really tackle Scheme some day!
-- 
Thierry Laronde 
  http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C



Re: [9fans] circular fonctions: precision?

2011-10-03 Thread tlaronde
On Mon, Oct 03, 2011 at 09:03:50AM -0400, Russ Cox wrote:
> On Sun, Oct 2, 2011 at 12:38 PM,   wrote:
> > Is there some documentation about the precision of the circular (i.e
> > trigonometric) fonctions, depending on the (plan9) implementation and
> > the hardware?
> 
> They are not terribly accurate.
> 
> If you need accurate versions, the best I know are the ones
> that were written at Sun and included in the FreeBSD math library.
> There are copies on any FreeBSD machine and also in the
> vx32 distribution: http://code.swtch.com/vx32/src/tip/src/libvxc/msun.
> 
> For Go, we started with implementations of the Plan 9 library
> algorithms but have been slowly replacing them with implementations
> of the Sun/FreeBSD algorithms for the improved accuracy.

Thanks for the tips. I will put the various clues given in the thread at
least to have a better understanding about what my code relies upon.
-- 
Thierry Laronde 
  http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C



Re: [9fans] copying fossil filesystem to a bigger disk

2011-10-03 Thread erik quanstrom
On Mon Oct  3 19:08:49 EDT 2011, slash.9f...@gmail.com wrote:
> > the way to interpret this information is you may use 512
> > byte sectors if you really want to suffer terrible performance
> > (usually 1/3 the normal performance for reasonablly random
> > workloads.)
> 
> That doesn't sound tempting at all. I am still within Amazon's return
> window. Can anyone recommend a 2 TB SATA drive that works on our
> favorite operating system out of the box at full speed? If it's quiet
> and cheap, all the better.
> 
> > let me think a bit about the correct solutions to this.  it's clear
> > to me that we just can't assume 512-byte sectors any more.
> 
> I knew Plan 9 is picky about hardware, but a hard disk? *sigh*

relax, it's really just the mbr code and fdisk that don't like a
non 512-byte sector size.  in fact, as long as you don't boot from
it, you can use the disk as-is.

- erik



Re: [9fans] copying fossil filesystem to a bigger disk

2011-10-03 Thread slash
> the way to interpret this information is you may use 512
> byte sectors if you really want to suffer terrible performance
> (usually 1/3 the normal performance for reasonablly random
> workloads.)

That doesn't sound tempting at all. I am still within Amazon's return
window. Can anyone recommend a 2 TB SATA drive that works on our
favorite operating system out of the box at full speed? If it's quiet
and cheap, all the better.

> let me think a bit about the correct solutions to this.  it's clear
> to me that we just can't assume 512-byte sectors any more.

I knew Plan 9 is picky about hardware, but a hard disk? *sigh*



Re: [9fans] copying fossil filesystem to a bigger disk

2011-10-03 Thread erik quanstrom
On Mon Oct  3 19:08:49 EDT 2011, slash.9f...@gmail.com wrote:
> > the way to interpret this information is you may use 512
> > byte sectors if you really want to suffer terrible performance
> > (usually 1/3 the normal performance for reasonablly random
> > workloads.)
> 
> That doesn't sound tempting at all. I am still within Amazon's return
> window. Can anyone recommend a 2 TB SATA drive that works on our
> favorite operating system out of the box at full speed? If it's quiet
> and cheap, all the better.
> 
> > let me think a bit about the correct solutions to this.  it's clear
> > to me that we just can't assume 512-byte sectors any more.
> 
> I knew Plan 9 is picky about hardware, but a hard disk? *sigh*

xp won't use it correctly either.  in fact, if you're using a standard
fdisk layout, chances are things are a little sideways on nearly any
os.

in any event, if i were buying a 2t hard drive today, i'd get
http://www.newegg.com/Product/Product.aspx?Item=N82E16822136365
since i'm paranoid about hard drives and only get enterprise ones.
if you're not, then (most) anything with 512-byte sectors should be no
troubles.  the easiest way to check is to do some math.  multiply
the number of sectors (that's always on the datasheet) by the
512, and see if that equals the claimed capacity.

- erik



[9fans] cb bug

2011-10-03 Thread erik quanstrom
no suprise here, cb sometimes eats unicode.
i'm currently too lazy to track the problem down.

- erik