Earlier quoted context omitted.
It uses type dispatch to perform an epsilon comparison: static int pretty_float_equal (float a, float b) { return fabsf(a - b) So it’s https://docs.python.org/library/math.html#math.isclose
This code is incorrect, but I don't blame them. :) Probably one of the most common float-related mistakes, even among people who "know how floats work". FLT_EPSILON is the difference between 1.0 and the next larger float. It's impossible for numbers less than -2.0 or greater than 2.0 to have a difference of FLT_EPSILON, they're spaced too far apart. You really want the acceptable error margin to be relative to the si…
Pretty.c
71–80 of 227 posts
Re: Pretty.c
#72Earlier quoted context omitted.
Also because the special characters were (and are) difficult to type on European keyboards. Characters like []{}\|~ are behind multi-finger access and often not printed at all on the physical keys (at least in the past). You can see how this adds a hurdle to writing C… Pascal was designed by a European, so he preferred keywords which could be typed on every international keyboard. C basically just used every symbol f…
Just as example, on my slovenian QWERTZ layout: [ - altgr+f, ] - altgr+g, { - altgr+b, } - altgr+n, \ - altgr+q, | - altgr+w, ~ - altgr+1. You get used to them, though you start feeling like a pianist after a short coding session. The one most annoying for me are the fancy javascript/typescript quotes, which I have to use all too often: ` - altgr+7.
Re: Pretty.c
#73Earlier quoted context omitted.
Just as example, on my slovenian QWERTZ layout: [ - altgr+f, ] - altgr+g, { - altgr+b, } - altgr+n, \ - altgr+q, | - altgr+w, ~ - altgr+1. You get used to them, though you start feeling like a pianist after a short coding session. The one most annoying for me are the fancy javascript/typescript quotes, which I have to use all too often: ` - altgr+7.
Today I learned that there exist people who use non-US layouts when coding. That’s spectacular!
Re: Pretty.c
#74Can someone clarify whether this is intended as a joke or whether the author is actually confused? I mean, nothing about this makes sense: it's not "scripting"; it claims to introduce "strong typing" while it does nothing about typing; it introduces all kinds of operator aliases "modeled after Lua and Lisp" that are present in neither of these languages. But it's not an obvious parody either, so I'm genuinely not sur…
Re: Pretty.c
#75Earlier quoted context omitted.
https://en.wikipedia.org/wiki/Stephen_R._Bourne https://www.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/sh
Now that's just silly. And I see the backwards keyword terminators (LOOP/POOL). I have wondered why we have case/esac, if/fi but while/done. I imagine the author himself figured that while/elihw would just be entirely ridiculous.
With the reverse-keyword convention we'd get "od", not "elihw", though.
while ... for ...
do do
... ...
od od
The 'od' utility already existed, apparently, so Bourne opted for "done".[edit: typos]
Re: Pretty.c
#76Earlier quoted context omitted.
Just as example, on my slovenian QWERTZ layout: [ - altgr+f, ] - altgr+g, { - altgr+b, } - altgr+n, \ - altgr+q, | - altgr+w, ~ - altgr+1. You get used to them, though you start feeling like a pianist after a short coding session. The one most annoying for me are the fancy javascript/typescript quotes, which I have to use all too often: ` - altgr+7.
Today I learned that there exist people who use non-US layouts when coding. That’s spectacular!
Also practically everytime I need to write a comment, commit message or email I need my č, š and ž. It's kinda nice to have them only a single keypress away.
Re: Pretty.c
#77I give up.
Re: Pretty.c
#78Re: Pretty.c
#79Re: Pretty.c
#80Earlier quoted context omitted.
Today I learned that there exist people who use non-US layouts when coding. That’s spectacular!
I tried switching to US a few times, but every time muscle memory made me give up soonish - especially since there are big benefits to using same keyboard layout as other people in your office are using. Also practically everytime I need to write a comment, commit message or email I need my č, š and ž. It's kinda nice to have them only a single keypress away.