Earlier quoted context omitted.
Have you heard of Zig?
It requires a different compiler. This is just a collection of C preprocessor macros
Pretty.c
181–190 of 227 posts
Re: Pretty.c
#182Re: Pretty.c
#183Earlier quoted context omitted.
generally they aren't, as scripting usually implies an interpreter, though no one is stopping you from using a wrapping script that quietly compiles on first run and caches a bunch of executables somewhere. not much different than python producing bytecode files as it goes along.
Script usually implies some kind of task that runs once and the exits. As opposed to a system that is expected to run indefinitely. There are good reasons for why scripts are often interpreted and why systems are often compiled, but that's not what defines them. There are definitely scripts that are compiled and systems that are interpreted out in the wild.
Re: Pretty.c
#184Earlier quoted context omitted.
Indeed, FLT_EPSILON is not a one-size-fits-all solution, but it's good enough for frequent case of comparing big enough numbers, which is not covered by regular ==. So it's a convenience/correctness trade-off I'm ready to make.
If the numbers you are comparing are greater than 2, abs(a - b) < FLT_EPSILON is equivalent to a == b. Because it's not possible for two large numbers to not be equal, but also closer together than FLT_EPSILON.
// FLT_EPSILON == 0.01
equal(4.999, 5); // true
4.999 == 5; // false
am i missing?Re: Pretty.c
#185> The goals for Pretty C are: > Provide so much syntactic sugar as to cause any C developer a diabetes-induced heart attack. :-D
As someone who just got diagnosed with type-1 diabetes (the auto-immune variety, not the “you eat too much sugar” variety), this was far more depressing than funny. I’m probably being overly-sensitive, but man my life has gone to shit in the last couple of years…
Honest advice: I have heard fasting + healthy diet can permanently fix diabetes (though I forgot which type)
Maybe try it? Good luck in any case!
Re: Pretty.c
#186does this transpile to C or how does it actually work?
preprocessor is using those #defines to replace tokens in the code so it ends up as usual C
Re: Pretty.c
#187Influenced by windows.h I see :)
Re: Pretty.c
#188> ifnt for if(!...). "unless" seems more readable than "ifnt".
Re: Pretty.c
#189Earlier quoted context omitted.
If the numbers you are comparing are greater than 2, abs(a - b) < FLT_EPSILON is equivalent to a == b. Because it's not possible for two large numbers to not be equal, but also closer together than FLT_EPSILON.
what // FLT_EPSILON == 0.01 equal(4.999, 5); // true 4.999 == 5; // false am i missing?
But it's impossible to have a number that's 0.00000011920929 less than 5.0, or 0.00000011920929 more than 5.0, because the floats with enough magnitude to represent 5 are spaced further apart than that. Only numbers with magnitude In other words, the only 32-bit float that's within ±0.00000011920929 of 5.0 is 5.0 itself.