|
You know... It's 2021, and the IRONY flows freely in all things...
I expected to see a macro (written in JavaScript), that writes the javascript file:
for (x..)
if x % 1 == 0 write "if (number == " + x +") return false;"
else write "if (number == " + x +") return true;"
==
And to see him asking people to crowd source running that file, to help him out!
==
Next question... Where is his test harness... Or is he caught in an infinite loop?
|
|
|
|
|
They've missed a whole set of entries for those that speak British style English.
American: Thirty-Two Thousand One Hundred Twelve
British: Thirty-Two Thousand One Hundred And Twelve
I'd better get editing...
|
|
|
|
|
|
Now the question is...
Is the one with that request trolling him? Or does he really needs it for his usage?
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Well, my comment on that issue requesting support for the Yan tan tethera[^] counting system was perfectly legitimate.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
..got it perfectly..but are we on the same page? really?..
😇😇😇😇
|
|
|
|
|
The AND denotes the decimal or fractional portion of the number. So Brits in the example above, Twelve whats?
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
|
|
|
|
|
Not in British English (or just "English", as it's known).
"One hundred and twelve" === 112 , not 100.12 .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The British English convention is to put an 'and' between any hundreds and non-zero tens/units and 'point' to indicate the fraction part.
Therefore 123,456.789 is...
"One hundred and twenty three thousand, four hundred and fifty six point seven, eight, nine"
|
|
|
|
|
100% this is a joke, and I like it.
|
|
|
|
|
At first I thought "Dang! I am looking for a package that determines if a number is odd."
But it actually turns out that they have helpfully written one.
Here it is if anyone else needs it -> odd numbers[^]
A real godsend!
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Just what I was looking for!
My own isEven function only goes to 1000, this is a huge step forward
Just need to brace it properly and remove all those function exits...
function isEven(number) {
let result;
if (number === 1) {
result = false;
}
else if (number === 2) {
result = true;
}
else if (number === 3) {
result = false;
}
return result;
} And they have an is-odd package which is consistent with this one too.
As programmers we know how important it is to be consistent.
Thanks for this great find!
|
|
|
|
|
Github has a file size limit. So if someone wants to max it out....
|
|
|
|
|
They could even have used a switch statement. Odd that they didn't think of that
|
|
|
|
|
I feel the power of Javascript infusing me!
|
|
|
|
|
|
Inverse of square root? Just square it. 
|
|
|
|
|
Classic C bit-banging.
How we used to do arithmetic before we could afford an 8087.
The "kosher" version looks like this:
union
{
float f;
long n;
} mixup;
mixup.f = floatval;
longval = mixup.n;
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
|
That is a truly amazing resource. Thanks! 
|
|
|
|
|
..yes you can..il send you my pp acct.🤪🤪🤪🤪
|
|
|
|
|
raddevus wrote:
float fVal = 13.3892F;
printf("Float value ==> fVal :%f\n",fVal);
long lVal = * (long *) &fVal;
printf("float as long ==> lVal: %ld\n", lVal);
That 3rd line takes the address of the float &fVal and what!?! multiplies it times a long pointer? or something?!?
That's not what it does. It casts the address of fVal to a pointer to a long, and then dereferences that pointer. It's completely unnecessary code. All he had to do was cast the fVal to long and then assign that.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Richard Andrew x64 wrote: cast the fVal to long and then assign that. NO!!!
Casting involves arithmetic conversion, whereas what we are talking about involves treating the data as a bit pattern.
(long)2.0 == 2
but the bit patterns are wildly different.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Unfortunately... 'type punning' (which is the name for casting pointers to pointers of different types) is considered undefined behavior in C and C++ and so frowned upon these days...
Instead, you can use a good old memcpy , which usually gets generated to the same code as the type punning case:
float fVal = 13.3892F;
printf("Float value ==> fVal :%f\n",fVal);
long lVal;
memcpy(&lVal, &fVal, sizeof(fVal));
printf("float as long ==> lVal: %ld\n", lVal);
This sort of thing is often done when you need to get to the individual bits and bytes of a variable, rather than the quantity it represents. For example, a software implementation of floating point arithmetic would do this.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Ah, good to have a name for the thing.
Thanks for providing more insight. 
|
|
|
|