|
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. 
|
|
|
|
|
I found a nearly 6" 7-color e-paper display, and my first thought is woo!
Then I realize, I can't actually use it with anything because 640x448x4bits is too large for nearly any IoT device to hold in memory at a time, and they way these things are designed, you have to hold the frame buffer in memory, or you can only write full screens directly off of flash which isn't practical.
So who designed this screen? Did they not think of memory requirements?
They claim it's compatible with a Raspberry Pi, and yeah, it would be because I can get one with 1GB of memory or more.
But who in the world is going to make a color e-reader with an $80 screen powered by a largish, power hungry $150 computer that usually requires fans and dedicated power?
I'm trying to figure out a real world use case for this screen, and the only thing that can realistically run it other than a raspberry pi is maybe an ESP32 WROVER, which isn't the most popular device for commercial products for reasons.
Real programmers use butterflies
|
|
|
|
|
I don't think all this IoT is good for you. Sounds very time-consuming and expensive. 
|
|
|
|
|
There are four possibilities as I see it:
(1) The screen manufacturer has a product and can manufacture it fairly cheaply as a loss leader to encourage computer hardware manufacturers. Build it and they will come, so to speak.
(2) The screen manufacturer has made a mistake. They thought IoT devices or embedded devices were coming soon and they are not.
(3) Or perhaps they are were correct and a new generation of devices are just about to be launched that can take advantage of their screen. It doesn't really need to be IoT; it could be embedded or self-build (although I regret to admit that the latter probably rarely constitutes a decent market size).
(4) The manufacturer is willing to release this on the basis that it shows what they can do in the expectation that they'll never sell much more than engineering samples but it will generate sales for follow-on products.
|
|
|
|
|
You could very well be right. I will say that a 7 color e-paper display is neat technology, but I wish they made it in smaller versions, like 200x200 as well, so that they could be opened up to a lot more devices.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: But who in the world is going to make a color e-reader with an $80 screen powered by a largish, power hungry $150 computer that usually requires fans and dedicated power?
Not exactly sure about the specs of your original question, but googling I found a CNC Lathe that has "Standard Program Memory, 1 GB". Which I suppose means you can add more memory than that.
Would that answer your question - at least hypothetically?
|
|
|
|
|
Never used an e-reader. Do they switch pages very fast?
This looks like an el-cheapo bunch of memory: (running at 133 mhz)
2pcs ESP-PSRAM64H Chip - 64 Mbit Serial Pseudo SRAM - ElectroDragon
Don't see any reason you couldn't compute (say) 10 scanlines in actual ram, before blasting em to the device, ready to be dumped to screen after you'd rendered the whole page. I did phong-shaded surface renderings of 4d julia fractals at 640x480 back in dos using only 64 k of memory using a similar trick for the zbuffer...
Of course, I've no idea how mem hungry the TTF stuff is, nor how many scanlines each line of text is high.
|
|
|
|