JavaScript integers are very limited
-
The Number.MAX_SAFE_INTEGER constant represents the maximum safe integer in JavaScript (253 - 1).
Not even as high as an unsigned byte, huh?
-
Minimum safe integer is 253 +1. Trufax
-
This post is deleted!
-
@kazitor Unicode should have superscript and subscript versions of every Arabic digit.
-
@Gąska
:superscript_woman_in_steamy_room_medium-light_skin_tone:
^
is standard ASCII.
-
@Gąska
That would necessitate to expand every character to, say, 128 bits. And imagine the problems UTF-128 would cause.Oh, I thought you said number.
Filed under: Don't give them ideas
-
@topspin said in JavaScript integers are very limited:
^
is standard ASCII.You're welcome to change the entire humanity's habits and make them write exponentiation with ^ even when using a medium perfectly capable of all the advanced formatting features. Until you do so, the problem will remain - copying text from website to tooltip will erase the information that something is an exponent.
-
@Gąska said in JavaScript integers are very limited:
@kazitor Unicode should have superscript and subscript versions of every Arabic digit.
Shame it doesn't. Modern European/American digits however...
¹²³⁴⁵⁶⁷⁸⁹⁰
₁₂₃₄₅₆₇₈₉₀
-
@PleegWat hm. I always thought there's only 2 and 3.
-
@Gąska I think 2 and 3 superscripts where the only ones in iso-latin-1. I think that also only contained ½, ¼, and ¾. Unicode, of course, added more, such as:
⅓⅔
⅕⅖⅗⅘
⅙⅚
⅐
⅛⅜⅝⅞
⅑
And that's just the ones in my compose key tables.
-
@Gąska said in JavaScript integers are very limited:
@kazitor Unicode should have superscript and subscript versions of every Arabic digit.
@error_bot !xkcd Vomiting Emoji
-
-
@PleegWat There's even a generic fraction slash in Unicode which allows you to build arbitrary fractions.
-
@dfdub said in JavaScript integers are very limited:
@PleegWat There's even a generic fraction slash in Unicode which allows you to build arbitrary fractions.
Unicode sure loves its redundant composited characters.
-
Let's do some root cause analysis just for fun.
- Someone wrote the HTML fragment
2<sup>53</sup>
to represent a number. No problem here, although it poses the question of whether they should have used Unicode characters instead (it doesn't really matter though, could have been any other html fragment). - This text got placed in a context (tooltip) where rich text is not available, thus transforming it into plain text and losing crucial information.
First problem: you can't just transform content arbitrarily like that. Either keep rich text as rich text, or ensure the transformation is correct.
HOWEVER, sometimes an incorrect solution is better because it saves enough effort. So let's pretend we have no choice but to put HTML text in a tooltip. This leads us to the more interesting...
Second problem: there's no standard algorithm to transform an HTML fragment into plain text while losing the least amount of information. This would involve, for example, translating
2<sup>53</sup>
into 2^53 or 2⁵³.
- Someone wrote the HTML fragment
-
TRWTF is plain-text tooltips.
-
@anonymous234 The only thing I want to know: was this tooltip manually copy-pasta'd or automatically scraped? Because the real was whoever created the tooltip (or code for it), not who used HTML.
-
@Gąska said in JavaScript integers are very limited:
@PleegWat hm. I always thought there's only 2 and 3.
That was the limit of things like ISO-8859-1 or Windows-1252 character sets. Unicode has a Superscripts and Subscripts block, U+2070 to U+209F that contains mainly numbers 0–9 but also a few other characters useful for (mainly) chemistry.
-
@anonymous234 said in JavaScript integers are very limited:
Second problem: there's no standard algorithm to transform an HTML fragment into plain text while losing the least amount of information.
The meaning is context-dependent anyway, so I doubt you could come up with a universal algorithm.
This would involve, for example, translating
2<sup>53</sup>
into 2^53 or 2⁵³.The second would be preferred, given that without context you can’t tell if
<sup>53</sup>
represents an exponent or (say) a footnote number, but what if you can’t know whether it will even be displayed in a font that has the necessary glyphs?
-
I've seen, made, or almost-made enough errors involving copying and pasting "squared" and "cubed" signs to know by now: just use the damn unicode characters for them, always. It's not hard to Google for them and copy and paste. Using
<sup>
or doing whatever the heck you do in Microsoft Word to superscript stuff will eventually end in tears just like this.
-
@Cabbage said in JavaScript integers are very limited:
It's not hard to Google for them
WinCompose.
Compose, ^, 2
-
@PleegWat
Or simply + .For the many, many times when you have no clue what the compose sequence might be.
-
@dfdub I can only get emojicons in that thing. I'm assuming it's because I'm using English and we don't use any funny squiggles on our letters. Does it have accents and stuff in other languages?
-
@hungrier There are tabs at the top. Choose the third one.
-
@PleegWat said in JavaScript integers are very limited:
WinCompose.
Compose, ^, 2
I just stuck them all under keyboard shortcuts:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>^m</key> <dict> <key>0</key> <array> <string>insertText:</string> <string>₀</string> </array> <key>1</key> <array> <string>insertText:</string> <string>₁</string> </array> <key>2</key> <array> <string>insertText:</string> <string>₂</string> </array> <!-- rest snipped for brevity --> <key>^0</key> <array> <string>insertText:</string> <string>⁰</string> </array> <key>^1</key> <array> <string>insertText:</string> <string>¹</string> </array> <key>^2</key> <array> <string>insertText:</string> <string>²</string> </array> <!-- and here --> </dict> </dict> </plist>
That way, I can do Ctrl+M then 1 to get
₁
or Ctrl+M then Ctrl+1 for¹
.Only problem I encounter with this in practice is this forum, as Ctrl+M here hits the Submit button for the text field I’m typing in now.
-
@dfdub said in JavaScript integers are very limited:
@hungrier There are tabs at the top. Choose the third one.
ENOREPRO
I've got tabs at the bottom but they all have emojicons, no text.
-
@hungrier Which Windows 10 version are you on? Maybe that's new in 1903? If that isn't it, maybe it's only activated if you set your keyboard layout to US Intl? (Although that would be pretty dumb.)
On my system, I have 3 tabs at the top (emojis, ASCII emojis, symbols) and the the tabs at the bottom to select symbol/emoji categories.
-
@dfdub I'm on 1809 so that could be it.
-
I always liked the full width digits, U+FF10 - FF19... And yes, I had to add code to handle them. I blame Japan.
(Used to read the blog Sorting it All Out by Michael Kaplan. And don't get me started on what the upper case value of i is...)
-
@dfdub I don't think Microsoft has finished the 1903 rollout yet.
-
@powerlord said in JavaScript integers are very limited:
@dfdub I don't think Microsoft has finished the 1903 rollout yet.
I have 2 machines where it "turned" up - "Your machine is not compatible". One machine where there's no sign of it. One machine that actually updated when I clicked "update". And all the other machines were force-updated.
-
@powerlord said in JavaScript integers are very limited:
@dfdub I don't think Microsoft has finished the 1903 rollout yet.
I think for most people who haven't gotten it by now, it's due to "incompatible software". I verified this was the case for me with the Update Assistant.
I'll probably take my time updating that software; I don't mind that much.
-
I've taken to automating all my software installation and updates with Ansible and Chocolatey and a bit of PowerShell. So I can update everything at once and even go from fresh OS install to fully configured with a single command.
-
@error Mind sharing your scripts? I was planning to start doing the exact same thing.
-
It's mostly a whole bunch of registry patches, XSLT transforms, saved config files... Everything I need to make a PC feel like home to me.
E.g., Windows Explorer: show all files and file extensions, configure formatting settings in my IDEs, setup Git with Beyond Compare integration, etc.
It's pretty darn tailor-made to my own preferences.
-
@error Okay, guess I'll have to write my own Playbook from scratch, then.
-
This post is deleted!
-
Even more confusion to the whole long- and short- notation drama.
-
@kazitor said in JavaScript integers are very limited:
Even more confusion to the whole long- and short- notation drama.
Exactly. They spelled it wrong in two places. Firstly, it is called one lak. Secondly, it's written 1,00,000.