Follow Slashdot blog updates by subscribing to our blog RSS feed


Forgot your password?
DEAL: For $25 - Add A Second Phone Number To Your Smartphone for life! Use promo code SLASHDOT25. Also, Slashdot's Facebook page has a chat bot now. Message it for stories and more. Check out the new SourceForge HTML5 internet speed test! ×

Comment This has been planned for a very long time! (Score 5, Interesting) 138

As Kjella writes in another post, this particular area is the single worst weather hurdle along the entire Norwegian coast, and we do have a lot of coastline:

I.e. significantly longer than the US even when you include Alaska, this meant that sea travel was by far the most important transportation network here at least since the vikings.

It is somewhat telling that the coastal route around the country (where the Hurtigruten goes between Bergen and Kirkenes, taking 11 days for the round trip) is considered "highway 1", our road system numbering therefore starts with highway 2.

The english wikipedia article about this project is somewhat short but still pretty good, mentioning that the first proposal came in 1874.


Comment My worst boss ever, by far. (Score 1) 299

This is a true story, it happened to me 10-15 years ago:

At that time I had a very independent role as the main IT troubleshooter for a large (75K employees in 70+ countries) international company, I ran my own group doing this, but company policy required me to have a manager who would be responsible for signing any travel expense reports and handle my year-end evaluation talk.

I knew going into that interview that I had a _lot_of very happy (internal) customers, with a 98+% solving rate for all the issues my group had gotten, so I was expecting a good review, and things started well:

"Terje, as we both know you don't really work for me so I had to talk to some of your corporate customers and they were very happy indeed! In fact, according to them we should probably put up a bronze statue of you outside the main office building."

(Yes, this means a huge raise right?)

"However, since you don't actually do any work for me directly I have given you a zero rating so that I can use the entire salary allocation for my own people."

At that point I just stood up, said "I don't think we have anything else to discuss" and walked over to the HR department and told them to find me a new manager.

Needless to say it took me a few years to recover the raise I should have gotten that year. :-(


Comment Re:cars bad, buses good. (Score 1) 160

Before EVs, the bus (& taxi) lanes were never clogged here in Oslo, they did in fact have significant spare capacity.

When the regulators wanted to encourage EVs they said up front that we can let them drive in the bus lanes, but only up to a point: As soon as there are enough of them that they actually slow down the buses, then we'll take away that incentive.

This duly happened a year or two ago, for a few highly congested stretches, and now you cannot drive E18 bus lanes during rush hours unless your EV is also a HOV, which in this case means having at least two people in the car.


Comment Re:Not tab vs space but "Dual bottom variables" (Score 1) 300

1. Division is the dual of multiplication, namely it is defined as:

        a/b = c
        a = b*c

However when a != 0, such as 1, b =0, and using the broken IEEE re-definition of c=Inf, then this implies that 'a' is ...

        1 = 0*inf ... which is utterly stupid as this is impossible. Why is the IEEE754 standards hijacking mathematics to redefine basic concepts???

First, 754 is very emphatically NOT mathematics, it is rather a (imho) very good attempt to make an internally consistent set of rules that allow you to perform real-life calculations with as good a precision as the storage format allows.

The decision to define 1/0 as Inf (and 1/-0 as -Inf) follows directly from this: If the only thing you use such an Inf for is to scale another value (1/0 -> inf, x/inf -> 0), then you will end up with a true zero, which is the closest possible approximation to the real result (i.e. if the zero divisor was the truncated limit of something approaching but not quite becoming a true mathematical zero). If you try to use such an Inf for almost anything else, the result will indeed become a NaN, which is what you wanted anyway, right?

I.e. 754 tries to retain as much potentially useful information as possible.

Like I said there is a neverending split between those who work in polar coordinates and _know_ that there is only a single Inf, and those who use cartesian and absolutely require signed Inf. If you read some of the 754 history out there you will see that this has been a very sore spot all the way back to the original 8087. :-)

BTW. You wouldn't happen to be THE Terje Mathisen of optimization fame by chance?!

Guilty as charged, still trying to optimize code every week, and to teach the mindset needed to younger programmers. :-)

I know that classic quote, "premature optimization is the root of all evil", but I still find it impossible to write any significant code at all before I have figured out an efficient way to solve any given problem. :-(


Comment Re:Not tab vs space but "Dual bottom variables" (Score 1) 300

I hope we all agree that 1/0 should indeed return Inf?

The problem areas are mostly related to single vs dual zeroes and infinities imho, what is your particular problem?

Quoting from the standard:

7.3 Division by zero 7.3.0 The divideByZero exception shall be signaled if and only if an exact infinite result is defined for an
operation on finite operands. The default result of divideByZero shall be an (Infinity symbol) correctly signed according to
the operation:
  For division, when the divisor is zero and the dividend is a finite non-zero number, the sign of the
infinity is the exclusive OR of the operands’ signs (see 6.3).


Comment Not tab vs space but "Dual bottom variables" (Score 3, Interesting) 300

I've read all comments as of this time and nobody seems to have taken note of his suggestion about bottom vars:

"There's an argument among language designers, should we have bottom values at all? But there's nobody who thinks you should have two of them."

I would like to _strongly_ disagree, you _do_ need two different kinds:

    undefined (Not a Number/Not a Result) which traps if you try to use it, and none which means empty/ignore!

In the Mill cpu architecture ( we have those two different kinds and they make coding both easier/more elegant/more compact, and at the same time faster and more secure!

Another example:

I am currently on the group that works on the 2018 revision of the IEEE 754 (i.e. floating point) standard. In the original '754 version the "Not a Number" (NaN) type was defined as a way to create a "sticky" error marker in a numeric calculation. I.e. if you accidentally try to calculate 0/0 or Inf/Inf the result will be undefined, the operation might trap or not depending upon how your language runtime is setup, but the result will always be a NaN. There are two kinds of NaNs, Signaling NaN and Quiet NaN, the only difference is that the next time a SNaN is taken as input to an operation it will trap and then be converted to the equivalent QNaN while a QNaN as input will just propagate to the output.

It should be obvious that if your runtime initializes all FP variables to NaN, then any accidental use-before-load should be detected, right?

The problem is that for the 2008 (current) revision of the standard, enough people wanted a totally different behavior when searching for the maximum value in an array, typically used to scale a matrix: They managed to define minNum(a,NaN)/maxNum(NaN,b) so as to ignore any quiet NaN val
ues, always returning the other value. I.e. in those functions they got NaN to behave as None!

The real problem, and the main reason these functions are going away is how the definition above interact with the SNaN/QNaN rules:

maxNum(1.0, QNaN) -> 1.0
maxNum(QNaN, 1.0) -> 1.0

maxNum(1.0, SNaN) -> QNaN
maxNum(SNaN, 1.0) -> QNaN

So if you look for the maximum of 4 values, one of them a SNaN, the result will depend on the order of comparisons, i.e. if you do them pairwise you get this result:

max(1.0, SNaN, 2.0, 3.0) -> maxNum(maxNum(1.0, SNaN), maxNum(2.0, 3.0)) -> maxNum(QNaN, 3.0) -> 3.0

while taking alternate inputs results in

maxNum(maxNum(1.0, 2.0), maxNum(SNaN, 3.0)) -> maxNum(2.0, QNaN) -> 2.0

I.e. we would have been much better off here with a single bit pattern meaning None which would never propagate.

Comment Norway is way lower than that (Score 4, Informative) 641

Norway has had 0.02 as the legal limit for _many_ years now, this basically means that you cannot drive after a single half liter of beer, glass of wine or a shot of whisky.

I.e. all driving after drinking is drunk driving. BTW, when Norway introduced a legal driving limit in 1936, it was the first country in the world to do so:

This web site (in Norwegian) shows the current rules: 0.02 to 0.05% leads to a fine of 1.5 months worth of your gross salary (or average income if you're a stock broker or similar), which means that it can get very expensive indeed when if the driver is a rich idiot. (Those fines are for when you are stopped without any accident, in a crash they will go up and your insurance won't cover anything.)

At 0.12%, i.e. 50% over the US limit, you are looking at at least 21 days in prison on top of that huge fine.

We have a lot more Teslas per capita here than in any other country but I haven't heard of a single drunk driving incident so far.

"Fast cars don't kill people, bad drivers kill people."

Comment Virtual machines for the win! (Score 5, Interesting) 348

We had this exact problem at a former place of employment, i.e. we had contract requirements to provide access to original oil field data for the 25-year lifetime of the field, the problem was that most of this data was in the form of seismic data locked into a specific version of the exploration sw.

The solution we came up with depended on making a virtual machine image of everything needed to run the original application & data, including license files and user databases, and then freeze the system clock: This way we could restart that image at any point in the future and as far as the sw would know it was still 2005.

We would still need regular maintenance, to make sure that newer versions of the virtualization platform could still run the original image. In the worst case we expected to have to add an additional virtualization layer, i.e. so we could run the 2005 sw inside a 2015 virtual machine which would run inside a 2030 VM host.

This approach has of course been used to good effect in order to save classic games.


Comment Re:Why? (Score 1) 84

Easy answer:

Some of those fjords are 200+ meters deep at the narrowest points near the outlet, i.e. where you would want to build a bridge/tunnel/submerged tube.

We already use tunnel crossings underneath a lot of shallower crossings, and several not so shallow, like the one about half an hour south of Oslo, near Drøbak:

The tunnel is 7-8 km long even though the fjord is less than a km wide at that point, the extra distance was required in order to keep the incline at or below the (highway) maximum allowable 7%. The problem is that 3+ km of 7% downhill (requiring a lot of braking for a heavy rig) and then 3+ km of steep uphill is sufficient to cause trailer breakdowns more or less every week. We also get truck/bus fires inside tunnels almost every year here in Norway.

I am currently in the Hvaler archipelago on the south-east corner of Norway, a few km from the Swedish border. The main/only road leading to the largest of the many islands is nearly 4 km long and still needed 10% descent/ascent angles to get deep enough.

This is dangerous enough to force the entire tunnel to close down whenever a truck with dangerous/inflammable cargo (i.e. gasoline/LPG/diesel) needs to pass through.

Comment 3 months is the rule here... (Score 2) 765

I have worked previously in the US but I must say that I prefer the Scandinavian setup we have here (in Oslo, Norway):

You must give notice, typically 3 months from the end of the current month, and if your employer wants to fire you they must also give similar notice, i.e. 3+ months.

For older/more senior employees the notice interval increases for the employer, up to 6+ months for a worker in her sixties.

What this means is that both parties know that they have to stay civilized.

In a case of possible conflict of interest it is common for these long notice intervals to be negotiated down, sometimes to zero. I.e. when I considered leaving my then job to go work for a major client of ours, my CEO told me that I would be allowed to leave immediately. (I didn't accept that offer so the question became moot.)

OTOH, I have been in a situation where I effectively quit immediately, but that was only an in-house transfer:

I went to my yearly performance review after a year of effectively being my own boss, but I still needed someone to be responsible for signing my time sheets and travel expenses etc, so the same person was doing my review.

The guy started the review by saying "Terje, as we both know you aren't really working for me so I had to go out and ask a few of the people you have been helping over the last year, and according to them it sounded like we should put a statue of you outside the corporate headquarters!"

OK, so at this point I was thinking 'This is going very well!' but then he continued "- but since I have a limited sum to distribute for pay raises I have reserved that for my own people and given you a negative evaluation so you will not be getting anything this year".

At this point I stood up, saying "I don't think we have anything else to talk about", left the room and went directly to HR telling them they had better find me a new boss to report to.


Comment Re:The usual way (Score 1) 515

That was indeed the usual way:

Personally I had written algorithms and used them on paper for several years when I started university in 1977 (an MSEE program) and got a compulsory PROGRAMMING 101 class. By the time week two or three came around and we got the second programming assignment I had a wonderful lightbulb moment: "Yes! I can do this! I can calculate anything now"

In 1982 I got a couple of IBM compatible PCs and had to start writing asm code almost at once, because there were no hardware drivers at all, but the result was that I understood everything that happened in those machines, in particular how to make really small & efficient code so that a 4.77 MHz machine with a 4-clock (byte) bus cycle could actually d something useful.

The years since then has been spent filling in all the gaps, i.e. all the stuff that I didn't realize I didn't know.

In the meantime I've been lucky enough to be involved with lots of interesting stuff, like helping to optimize the world's first SW DVD player, the core assembly code for Quake, one of the AES candidates, Intel's reference h.264/CABAC decoder and many more. I've also been part of the NTP Hackers team for 15-20 years now, and I'm also writing FP emulation code for the Mill cpu (, a cpu with a belt instead of registers).


I've learned to program by being intensely interested in it for almost 40 years now.

Anyone who became a "programmer" simply because it seemed like an easy way to make a living is more likely to be a part of the problem instead of a part of the solution.


Comment IPX LAN gaming at Novell (Score 3, Interesting) 351

I went from Norway to Utah in 1991, there I met John Cash who used to spend a night every week or two playing Doom deathmatch.

When he fired up his network sniffer he discovered that all LAN communication took place over IPX global broadcast, i.e. they would traverse all routers and end up at every single one of the 6000+ PCs on Novell's internal network!

John found the email of a guy at iD who seemed to know something (John Carmack :-) ) and sent off a message stating basically that the networking code sucked.

A few days later he got a reply: "Sorry about that, we outsourced that development. Here is the source code, please fix it!"

This was "put up or shut up" time, so Jiohn rewrote that code over the next couple of days and returned it.

A couple of years later Cash was hired by Carmack and Abrash as the third core programmer on the Quake team.

PS. I personally sucked at Doom, but since I was involved with Quake asm development from the beginning I became significantly better at that series.

Comment Re:Europe (Score 5, Informative) 160

That's the key question: Unless you have an available open access frequency band, this standard is just wishful thinking instead of a new product.

The current allocations in Europe ( covers all of 890-942, 942-960 and 960-1164 MHz, with usage mostly cell phone, radio-navigation and broadcasting.


Comment Why didn't they optimize the new generator? (Score 1) 136

The new 128-bit generator is shown as this piece of code, using a pair of 64-bit state variables:

uint64_t state0 = 1;
uint64_t state1 = 2;
uint64_t xorshift128plus() {
    uint64_t s1 = state0;
    uint64_t s0 = state1;
    state0 = s0;
    s1 ^= s1 > 17;
    s1 ^= s0;
    s1 ^= s0 >> 26;
    state1 = s1;

The absolute minimum latency of that code is 8 clock cycles, assuming that the two initial loads happen at the same time and that the writeback of s1 to state1 is overlapped with the return, i.e. free.

It seems like an obvious optimization to notice that s0 could be updated in parallel with the two initial s1 updates, i.e.

    s1 ^= s0;
    s1 ^= s0 >> 26;

can instead be written as

    s0 ^= s0 >> 26; // These two clock cycles can be overlapped with the previous s1 updates!
    s1 ^= s0;

since we don't care about the s0 value after this point and XOR operations are commutative (it is of course possible that the compiler is smart enough to do the same optimization, but I doubt it):

This is two clock cycles faster than the original code.


Slashdot Top Deals

Man is the best computer we can put aboard a spacecraft ... and the only one that can be mass produced with unskilled labor. -- Wernher von Braun