Re: Serialization of binary floating point numbers

2019-05-18 Thread J. Lewis Muir
On 05/17, Sad Clouds wrote:
> A bit of a random question/thought - what is a good and portable method
> of storing/transmitting binary floating point numbers?

Maybe heavier than you'd like, but Protocol Buffers has a double type:

  https://developers.google.com/protocol-buffers/docs/proto3#scalar

Another possibility is XDR which has IEEE float and IEEE double types:

  https://en.wikipedia.org/wiki/External_Data_Representation

Lewis


Re: Rock-solid USB ethernet adapters?

2019-05-18 Thread Travis Paul


> On May 19, 2019, at 1:07 AM, Mark Carroll  wrote:
> 
> Still, it's easy to change the plug-in adapter. I thus wondered if
> there's some easily obtained USB ethernet adapter that is well-known for
> being rock solid with NetBSD in case I should just try one of those.

Hi Mark,

You reminded me that I have a couple shady looking USB ethernet adapters I 
acquired and I never tested.

[1] The first device (KY-RD9700) uses the udav driver. VERY slow, but seems to 
be stable:

  udav0: SUNRISING (0xfe6) USB 2.0 10/100M Ethernet Adaptor (0x9700), rev 
1.10/1.01, addr 5

[2] Second device (QTS-LAN8152B) uses the ure driver. Much faster and also 
seems to be stable:

  ure0: Realtek (0xbda) USB 10/100 LAN (0x8152), rev 2.10/20.00, addr 6
  ure0: RTL8152 ver 4c10

I did some light testing (ssh, scp, cvs, git) with both of these on an Intel 
NUC (NUC5CPYH) running current.

I also scp'ed a 100MiB file from another computer on my lan with all 3 ethernet 
devices I had for the NUC:

ure0 (usb): 18.81s
udav0 (usb): 151.60s
re0 (on board PCIe): 3.63s

Not sure how easy these are to find online. I picked them both up at Sim Lim 
Square in Singapore but at least it’s another data point that I hope is helpful.

Best of luck,
Travis

[1] 
https://us-east.manta.joyent.com/tpaul/public/netbsd/hardware/usb/ethernet/KY-RD9700.jpg
[2] 
https://us-east.manta.joyent.com/tpaul/public/netbsd/hardware/usb/ethernet/QTS-LAN8152B.jpg

Re: Serialization of binary floating point numbers

2019-05-18 Thread Rhialto
I recall reading of a hexadecimal serialization of floating point
numbers. I'm not sure of all the details, but it sounds like it would be
a fairly easy way to exactly represent a whole class of FP formats.

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert  -- "What good is a Ring of Power
\X/ rhialto/at/falu.nl  -- if you're unable...to Speak." - Agent Elrond


signature.asc
Description: PGP signature


Rock-solid USB ethernet adapters?

2019-05-18 Thread Mark Carroll
Still trying out NetBSD 8.0 on an old Intel Broadwell NUC. I've been
running into odd issues with USB ethernet adapters that run for a while
then stop until reboot. For example, one reporting as,

aue0: corega K.K. (0x7aa) corega FEther USB-TXS (0x0d), rev 1.10/1.01, addr 3

acphy0 at aue0 phy 1: ACXXX 10/100 media interface, rev. 0

would soon start reporting,

aue0: watchdog timeout
aue0: usb error on tx: TIMEOUT

and not work thereafter. Much less frequently I'm also seeing the same
issue with an RTL8153 adapter reporting as,

cdce0: Realtek (0xbda) USB 10/100/1000 LAN (0x8153), rev 2.10/30.00, addr 3

cdce0: watchdog timeout
cdce0: usb error on tx: TIMEOUT

I don't know if seeing this from two quite different adapters suggests a
USB issue more than a network adapter driver issue, nor if there are any
USB-related options I should try applying via sysctl or whatever, even
via the BIOS.

Still, it's easy to change the plug-in adapter. I thus wondered if
there's some easily obtained USB ethernet adapter that is well-known for
being rock solid with NetBSD in case I should just try one of those. If
spending a little money is likely to fix the problem then that's fine
with me. I don't have demanding requirements, the adapter doesn't have
to be a recent model or highly performant so long as it works fine.

Incidentally, I also tried an adapter with an ASIX AX88179 on it that
the axen driver recognized but that promptly drops the carrier. That,
I'm happy to mail to any developer who wants to experiment with it.

I'll also try to get around to trying a more up-to-date NetBSD to see if
any recent changes fix the issue.

-- Mark


Re: Serialization of binary floating point numbers

2019-05-18 Thread Sad Clouds
On Sat, 18 May 2019 17:23:57 +0200
Martin Husemann  wrote:

> On Sat, May 18, 2019 at 08:58:35AM +0100, Sad Clouds wrote:
> > what I can see most of the modern hardware use 2's complement
> > integer arithmetic and IEEE 754 floating point, but not sure if
> > there are any specific exceptions I'm not aware of.
> 
> There are variations in the ieee 754 formats though, and all details
> depend on your use case and the "portability" you are trying to
> achive.
> 
> Martin

So when you say there are variations, are you referring to IEEE
754-2008 decimal floating point numbers, or something else? There are
only a few platforms that support this in hardware.

The use cases are around storing floating point numbers on disk, or
transmitting them across a network. For example, if you have different
platforms with different FPU hardware, provided that you stick to IEEE
754, they all should be able to load floating point number and perform
calculations with it, without any compatibility issues. Another example
is SQLite REAL data type, which is 8-byte IEEE floating point number.
Their databases are portable, so I assume you can read/write the same
database across different architectures.


Re: Serialization of binary floating point numbers

2019-05-18 Thread Martin Husemann
On Sat, May 18, 2019 at 08:58:35AM +0100, Sad Clouds wrote:
> what I can see most of the modern hardware use 2's complement
> integer arithmetic and IEEE 754 floating point, but not sure if there
> are any specific exceptions I'm not aware of.

There are variations in the ieee 754 formats though, and all details depend
on your use case and the "portability" you are trying to achive.

Martin


Re: Serialization of binary floating point numbers

2019-05-18 Thread Sad Clouds
On Fri, 17 May 2019 21:06:14 +0200
Rhialto  wrote:

> On Fri 17 May 2019 at 17:37:45 +0100, Sad Clouds wrote:
> > 1. Make sure software always built to use IEEE 754 format.
> 
> For VAX, you would need to do some work there, since it natively uses
> a different floating point format. It is the canonical example for
> that, these days :-) I'm not up to date on whether there are math
> libraries available that do ise IEEE soft-float.

OK thanks for the info, I found some useful links on VAX:

https://www.cv.nrao.edu/fits/os-support/vms/ieee2vax.c
http://home.fnal.gov/~yang/Notes/ieee_vs_dec_float.txt

However I don't think I'm going to bother supporting it, architectures
like VAX are probably confined to museums and hobbyist's sheds. From
what I can see most of the modern hardware use 2's complement
integer arithmetic and IEEE 754 floating point, but not sure if there
are any specific exceptions I'm not aware of.