TIL (about the Dark Arts of HTML)
-
@anotherusername said in TIL (about the Dark Arts of HTML):
Whoa.
Only thing wrong with that article: we know of quite a few much bigger ticking timebombs. Volcanology is scary stuff!
-
TIL about anthropodermic bibliopegy.
Well. Time to go out for lunch.
-
@Zecc said in TIL (about the Dark Arts of HTML):
TIL about anthropodermic bibliopegy.
Well. Time to go out for lunch.
-
@ScholRLEA groovy.
-
-
TIL the lead singer of the Village People wasn't gay, and the GI is the brother of the guy who famously fell from the WTC on 9/11.
-
TIL:
float i = 0; while (i < ++i);
This terminates at
i == 16777220
i == 16777216
I need to learn more about IEEE754.
-
@aliceif That's reasonable undefined behavior for a floating point type with 24 bits of mantissa precision, and shows that the compiler you're using is actually computing
++i
as a running total in a double-precision register, then converting it to single-precision for the comparison.Here's a version without the UB:
stephen@kitchen:/tmp$ cat f.c #include <stdio.h> void main() { float i = 0; double j = 16777214; while (i < j) { i = j; ++j; printf("%f %f\n", i, j); } } stephen@kitchen:/tmp$ gcc -o f f.c stephen@kitchen:/tmp$ ./f 16777214.000000 16777215.000000 16777215.000000 16777216.000000 16777216.000000 16777217.000000 16777216.000000 16777218.000000 16777218.000000 16777219.000000 16777220.000000 16777220.000000 stephen@kitchen:/tmp$
A single-precision float has 24 bits of precision, so the largest odd integer it can store precisely is 111111111111111111111111b (twenty-four ones) = 0x00FFFFFF = 16777215. Odd integers greater than that need to be rounded to fit.
Even integers don't start to require rounding until their values exceed 1111111111111111111111110b (twenty-four ones and a zero) = 0x01FFFFFE = 33554430.
The default rounding for IEEE754 is round half to even which in this case means that odd integers between 16777217 and 33554429 always get rounded to the nearest multiple of 4.
Following the generated sequence:
16777214 is an integer <= 16777215, so no rounding is required; it's less than 16777215 so the loop continues.
16777215 is an integer <= 16777215, so no rounding is required; it's less than 16777216 so the loop continues.
16777216 is an even integer <= 33554430, so no rounding is required; it's less than 16777217 so the loop continues.
16777217 is an odd integer > 16777215, so it needs rounding; nearest multiple of 4 is 16777216, which is less than 16777218 so the loop continues.
16777218 is an even integer <= 33554430, so no rounding is required; it's less than 16777219 so the loop continues.
16777219 is an odd integer > 16777215, so it needs rounding; nearest multiple of 4 is 16777220, which is not less than 16777220 so the loop terminates.
If you force the arithmetic to be done in single precision as well, so that the incrementing result is itself rounded on every step, the loop terminates at 16777216:
stephen@kitchen:/tmp$ cat f.c #include <stdio.h> void main() { float i = 0; float j = 16777214; while (i < j) { i = j; ++j; printf("%f %f\n", i, j); } } stephen@kitchen:/tmp$ gcc -o f f.c stephen@kitchen:/tmp$ ./f 16777214.000000 16777215.000000 16777215.000000 16777216.000000 16777216.000000 16777216.000000 stephen@kitchen:/tmp$
-
@flabdablet said in TIL (about the Dark Arts of HTML):
undefined behavior
Oh, I ran that in C#, not C without symbols after it.
-
@aliceif Pretty sure the explanation I provided will be correct for both.
-
@Boner Interesting, but I don't think it's as strictly true as it says. In my experience, shape and colour are often interchangeable in order, and I can think of situations where I'd put origin before them instead of after (I'd say a French oval table rather than an oval French table).
A better way to think about it is from least-meaningful to most-meaningful. You can also think in terms of a composite quasi-noun: if we want to add "oval" and "French" to "table", we can describe a "French table" as oval or we can describe an "oval table" as French. "Oval table" works better as a compound noun IMO because it is more concrete, easier to get an image of.
As for the specific example of "green great dragons", I would disagree, provided that the distinction between great dragons and lesser dragons is more important than the distinction between green dragons and other coloured dragons. If each colour of dragon has specific abilities and the great dragons are just better and stronger versions, then "great green dragon" is the correct order. If great dragons are very different to lesser dragons and the green is purely external colouration with no other significance, then "green great dragon" is the correct order. The adjective with the strongest impact should be closest to the noun.
-
@flabdablet
Actually, I just learnt something new again.TIL:
Thef
format string for floating point types in C# is utter junk.
For whatever reason,16777216f.ToString("f0")
is"16777220"
while16777216f.ToString("r")
is"16777216"
-
@flabdablet said in TIL (about the Dark Arts of HTML):
Pretty sure the explanation I provided will be correct for both.
Yes, except that putting the increment in there is not UB in C# as that has an explicitly-defined evaluation order. I think it's only C and C++ that make things complicated like that as having an undefined evaluation order usually turns out to not be a big enough performance win to justify the headaches.
-
@dkf said in TIL (about the Dark Arts of HTML):
putting the increment in there is not UB in C# as that has an explicitly-defined evaluation order.
It's interesting that in the C# code,
i < ++i
does top out at 16777220 instead of 16777216.I can understand the result of
++i
being a double; all that needs is an assumption that C# always does float arithmetic as double. However, I would have expected the implied store back intoi
to need a double to float conversion, meaning that the next value of++i
should be the result of that conversion, converted back to a double, then incremented. This should yield the sequencefloat 16777215 convert to double = double 16777215, add 1 = double 16777216, convert to float = float 16777216; float 16777215 < double 16777216 so continue
float 16777216 convert to double = double 16777216, add 1 = double 16777217, convert to float = float 16777216; float 16777216 < double 16777217 so continue
float 16777216 convert to double = double 16777216, add 1 = double 16777217, convert to float = float 16777216; float 16777216 < double 16777217 so continue
...
so
i
should get stuck at float 16777216 though the value of++i
is double 16777217, and the loop should never terminate.It looks like the compiler has optimized away the assumed-redundant double-to-float-and-back conversion between increments of
i
and is caching the result that's actually being incremented in a double register, thus mimicking the behavior of my C snippet withfloat i
anddouble j
.I wonder how many programs fixing that bug would break :-)
-
@flabdablet said in TIL (about the Dark Arts of HTML):
It's interesting that in the C# code, i < ++i does top out at 16777220 instead of 16777216.
Nope, C# is LYING.
The "F" format string is broken.
-
@aliceif said in TIL (about the Dark Arts of HTML):
@flabdablet
Actually, I just learnt something new again.TIL:
Thef
format string for floating point types in C# is utter junk.
For whatever reason,16777216f.ToString("f0")
is"16777220"
while16777216f.ToString("r")
is"16777216"
No idea at all how they fucked that up. Would be interested to see the generated code.
-
@flabdablet said in TIL (about the Dark Arts of HTML):
No idea at all how they fucked that up.
It's Microsoft.
-
-
@flabdablet said in TIL (about the Dark Arts of HTML):
No idea at all how they fucked that up.
Float formatting is astonishingly hard to not fuck up. It's dangerous in that you can get it 95% right quite easily, but that last 5% is EEEEVIL!
-
See, we're already paying rent for this space. So, what this idea allowed us to do is actually use that space to help pay off our rent
I'm pretty sure that idea already existed before.
-
@anonymous234 said in TIL (about the Dark Arts of HTML):
See, we're already paying rent for this space. So, what this idea allowed us to do is actually use that space to help pay off our rent
I'm pretty sure that idea already existed before.
Yes, which is why apartment contracts that don't allow subletting already existed before too.
-
-
TIL about LD_PRELOAD, the cousin of LD_LIBRARY_PATH. Why the fuck did I not know about it before?
-
-
TIL it's perfectly possible to run a Visual Studio Online build and release from mobile. The site is not responsive at all, but works surprisingly well.
Of course if I weren't stuck in a Scrum retrospective with a "no laptop" policy I wouldn't have needed to know that...
-
@dse said in 🔗 Quick links thread:
TIL
In 2007, a European Space Agency satellite carried thousands of tardigrades into the vacuum of space. Named the Tardis - tardigrades in space - project
-
Today I also learned there is such a thing as free beer:
And there's also an open cola:
I'm curious about what each tastes like, but not as much as to actually try to follow the recipes.
-
@Zecc said in TIL (about the Dark Arts of HTML):
Today I also learned there is such a thing as free beer:
Meh. There are tons of recipes freely (free as in... "free beer", as opposed to free as in "free speech" which is I think what your link is about) available, and a huge community of afficionados and/or craft brewers willing to share theirs.
I never had to pay anything or ask anyone for permission or whatever for any of the beers I've brewed and the same goes even for some friends that are now professional brewers, so publishing one recipe under a CC license just sounds like a marketing/hipster gimmick to me.
-
@Zecc said in TIL (about the Dark Arts of HTML):
OpenCola is a brand of open-source cola, where the instructions for making it are freely available and modifiable. Anybody can make the drink, and anyone can modify and improve on the recipe.
Pretty sure that's how the vast majority of recipes posted online work.
-
I knew this one before, but was reminded of it just now: In Queer as Folk (the US version, at least), the motto of the private school one of the characters attends, St James Academy, has the motto "Veni, Veni, Veni".
Filed Under: accurate translations are a to humor
-
TIL the domain http://pocketpc.com/ still works (redirects to Microsoft's Windows Phone store).
Amazing. Should I start an anti-WTFs thread?
-
Also on this topic (yes, I was trying random generic domain names):
http://smartphones.com/
shows authentication dialog, then redirects to
http://smartphones.com/><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></><head><title>error</title></head><body topmargin=Why do people keep extremely valuable domains just lying around?
-
TIL you can't disable the annoying bing search in the Windows 10 menu at all (or at least I could not find how to do it).
You can however block SearchUI.exe using the Windows firewall. Frankly I'd have blocked Bing entirely if it were possible. I used to decry the Google monopoly but Microsoft is dedicated to proving that they are still the most evil ones.
-
@anonymous234 said in TIL (about the Dark Arts of HTML):
I could not find how to do it
http://www.howtogeek.com/224159/how-to-disable-bing-in-the-windows-10-start-menu/
-
At the risk of misinterpreting you, do you mean this?
Edit: it's new with the Anniversary Update.
Edit 2: I should have added: to pull up those settings I clicked the magnifying glass next to the window menu, not the window menu.
-
@Zecc Yes, I mean this. And that option is not there at all. Do you have the anniversary update?
-
@anonymous234 Yes, I have it. It's what forced me to search how to disable the web results again.
-
@anonymous234 said in TIL (about the Dark Arts of HTML):
Yes, I mean this. And that option is not there at all.
Might depend on the country (i.e. whether EU privacy laws apply or whether Microsoft can get away with it).
There's also a group policy (Computer Configuration -> Administrative Templates -> Windows Components -> Search). You can either disable Cortana entirely there or disallow online searches.
-
@asdf I changed the language to English to take a screenshot
After which I noticed it wasn't searching bing anymore, even after removing the Windows Firewall rule.
...turns out by changing the language, Cortana (which is now what Bing search has been integrated into) got disabled. So there's no way for me to disable that "feature" except by accident.
It's just after .
-
@Zecc That button does not bring up that menu for me...
EDIT: Nevermind, gotta start searching to make the settings button transform into an identical-looking settings button in the exact same place but now does something different.
EDIT 2: However, "Search online and include web results" is not an option. However I was able to turn off the setting that lets "Cortana pipe up from time to time with thoughts and greetings"
-
@anonymous234 said in TIL (about the Dark Arts of HTML):
So there's no way for me to disable that "feature" except by accident.
So you have Windows 10 home? That sucks. I'm glad I have Pro on my Surface, because without access to the group policy editor to disable all bullshit, I'd hate Windows 10.
-
@mott555 said in TIL (about the Dark Arts of HTML):
gotta start searching to make the settings button transform into an identical-looking settings button in the exact same place but now does something different
I remember when discoverability was thought to be a good thing.
I miss those days.
-
@Scarlet_Manuka said in TIL (about the Dark Arts of HTML):
I remember when discoverability was thought to be a good thing.
Unless you choose to hide it, there's also a dedicated search button in the task bar. If you click that, you'll get to the search windows right away, which includes the search settings button. That's the more obvious way of navigation to that settings window.
-
@asdf said in TIL (about the Dark Arts of HTML):
Unless you choose to hide it, there's also a dedicated search button in the task bar
Which is what I clicked before I took that screenshot. I probably should have mentioned that.
-
@Scarlet_Manuka said in TIL (about the Dark Arts of HTML):
I remember when discoverability was thought to be a good thing.
I miss those days.I blame Opera.
Mouse gestures were the first sign of the non-discoverability rot taking hold.
-
@Scarlet_Manuka said in TIL (about the Dark Arts of HTML):
I remember when discoverability was thought to be a good thing.
I miss those days.I blame Opera.
Mouse gestures were the first sign of the non-discoverability rot taking hold.
-
TIL: you can use OneNote in OneDrive for free, but creating local files is a paid feature.
If you use the Windows 10 built-in app or the web interface like 99% of users, you are literally not allowed, by design to download your (most likely, very important) data anywhere. Microsoft is so sure that nothing can ever go wrong with OneDrive that they're forcing their users to trust it too. Except that MY FILES ARE FUCKING CORRUPTED so forgive me for not doing that.
However, you can still do it from the "desktop" program (which they try their best to hide the existence of), with a semi-hidden option called "backups". You just get some reduced functionality and some nagging messages that you should really be using the cloud.
Bonus points: they had a "recycle bin" feature but it's not implemented in the apps. Because it's soooooo much more difficult to move a reference instead of deleting it. And it's not like accidental deletions ever happen, right?
Back to Google Keep I guess...
-
@anonymous234 you can't create the file in OneDrive and then download it to your local machine?
-
@anonymous234 Bonus : You cannot uninstall the useless app. The only way to get rid of it is via Remove-AppxPackage. (PowerShell)
-
@anotherusername Nope.
Well, maybe through the API. I'll have to try.