• 2 Posts
  • 148 Comments
Joined 2 years ago
cake
Cake day: July 2nd, 2024

help-circle




  • arty@feddit.orgtoProgrammingTIL: Why ARM Has a JavaScript Instruction
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    5
    ·
    4 days ago

    Well, you tried to appeal to a common logic, and I appealed to even more common logic. If you arrange 3 apples on a table in an array, and ask anyone to take the 0th apple, they will be confused.

    0-based is just a convention, not a law of the universe. Only using integer-type numbers to address array elements is too merely a convention of some programming languages. And note that no one suggests using non-integer numbers here, only numbers of non-integer type.




  • arty@feddit.orgtoProgrammingTIL: Why ARM Has a JavaScript Instruction
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    4
    ·
    5 days ago

    Try interacting with anything that uses u64 and you’ll be a lot less happy!

    I’m sorry you had to experience this, but in all my years of development I hadn’t.

    …not actually quite as bad… While it’s UB for C, and it can return garbage. … the value it returns is 0x8000

    0x8000 is garbage. Insane.





  • I don’t think I’ll dive deeper than quoting Wikipedia:

    Most fixed-size integer formats cannot explicitly indicate invalid data. In such a case, when converting NaN to an integer type, the IEEE 754 standard requires that the invalid-operation exception be signaled.

    For example in Java, such operations throw instances of java.lang.ArithmeticException.

    In C, they lead to undefined behavior, but if annex F is supported, the operation yields an “invalid” floating-point exception (as required by the IEEE standard) and an unspecified value.

    In the R language, the minimal signed value (i.e. 0x80000000) of integers is reserved for NA (Not available).[citation needed] Conversions from NaN (or double NA) to integers then yield a NA integer.

    Perl’s Math::BigInt package uses “NaN” for the result of strings that do not represent valid integers.








  • I think it has a narrower scope, a standardized way to access data for applications which are simply delivered over Internet. As an example: “I want to have a diary editor, but I don’t want to download and install a local app, and neither do I want some external server to access my diary text”. Then you get the running code as a PWA, but the data never leaves your computer (or other trusted storage).