Swedish Exchange paralyzed by buy order for "-6 stocks"
translate.google.com
translate.google.com
11111111111111111111111111111010
When interpreted as an unsigned int, this is 4,294,967,290 = 2^32 - 6.The wording "The value of words corresponding to" in the second sentence confused me, but I first chalked it up to me not understanding finance-speak in English well enough.
Then I realized hovering shows the original text, and investigated. The original Swedish text has a typo! It says "orden" (="the words") where it should say "ordern" (="the [purchase] order").
I found that amusing. :)
Also there was a Swedish word that was just copied ("anullerades", meaning more or less "cancelled", "voided" or something along those lines) into the English text.
But, overall, it's still rather impressive.
Anyway, plenty of text would probably match word-wise ("X bought Y for $AMOUNT $UNIT") in financial news, so the mapping of "dollar" over "kronor" seems a reasonable error.
For probably the same reason, google also translates hungarian "1000 forint" to english "1000 HUF" going from the full word to a quasi-acronym for "HUngarian Forint".
For example, the word "Eesti" will often get Google-Translated to "English" rather than "Estonian".
This means that a film at my local cinema that my web browser assures me is in "English" will in fact be in Estonian. And an interview with a Russian saying that he doesn't speak Estonian gets translated so that he appears to say that he doesn't speak English.
The product designers special-cased language names, doing extra work to produce what will almost always be the wrong result.
(And what they can do to place names is often patently ridiculous. For example, "Peterburi tee" should either be left alone or maybe translated to "St Petersburg Road" but actually somehow becomes "Hertford Road". And the ZIP + City name "13415 Tallinn" becomes "thirteen thousand four hundred and fifteen Tallinn".)
Are you sure about that? It would sound quite likely to me that simply, the word for "English" tends to appear in the same context (N-gram etc.) as the word for "Estonian". For example the sentence "I speak English" would be common in English, while "I speak Estonian" would be common in Estonian, so it might associate the words together.
They absolutely did not do this. It's an artefact of statistical translation. In the corpus there are a lot of English documents saying "This document is in English", whose translated versions in Afrikaans (because I know Afrikaans) say "Hierdie dokument is in Afrikaans". Thus the translator learns the "hierdie" is Afrikaans for "this", "dokument" is "document, ..., and "English" is "Afrikaans".
The street name issue probably comes from an organisation whose Estonian office is in Peterburi tee and whose English office is in Hertford Road.
I saw some article once, where the names of a prime minister or some such was "translated" to the name of the US president. Weird.
Though I imagine it is mostly machine translated and it requires several agreeing "contributions" before it accepts them as accurate.
The irony.
Looks like a typo, it should be around 500bn$. 3500 would be Germany. Proof that "fat finger" human mistakes can do as much damage as algos gone wild.
And put sensible limits and checks in processing untrusted data (that is, everything that comes from the outside)
For instance: http://google-styleguide.googlecode.com/svn/trunk/cppguide.x...
4e9 is invalid but in the middle of the way (more often than not) this may be interpreted as a negative number.
Hence you need to check for value 'bigger than allowed' and 'smaller than allowed'
For unsigned ints, there is a natural smallest value allowed: zero.
You're free to not follow my advice though.
And the google style guide is subtle, it's not what you're implying. You can't use 'short' for example unless explicitly.
nanex
Wrong example:
unsigned int z = x - y;
if (z > BIG_NUMBER) {
return false;
}
Good example: if (y > x) {
return false;
}
unsigned int z = x - y;With signed ints, you can notice that '2-3' has below 0, and act accordingly. If you do '2-3' with unsigned ints, there is not really any way of finding out something went wrong (other than looking for very large numbers).
Of course, particularly in a financal system, you should probably use an integer type which throws/aborts if an out-of-bounds error occurs.
Slightly better is 64bit signed. There can always be overflow though. The reason these values are POD's is because tickers move around at a very high speed.
Logic errors are rare but not that rare. At sea level you can expect ~1 bit flip in 4GB of memory every 24 hours. Often it's in an invalid line or gets overwritten anyway, but for applications like this where one logic error can cost you your shirt, application of hardware-level error checking (ECC, SEU detection and correction, etc).
4,294,967,290 at one sheet of paper per share is about one entire freight train of box cars. Depending on the paper.