News for hackers. Stuff that matters.
Re:Cursed Excel: "1/2"+1=45660 by realo on Monday April 07, 2025 @11:23AM (#43612549)
I cannot imagine any programming language interpret "1/2" as a day and month in that specific context.

It takes a very special mindset to do that, maybe the kind that comes from a junior MBA manager, for example ... and even then I find that farfetched.

It sounds more like one of those things that is observed, but some manager decided it is not high priority enough to fix right away. And then technical debt raises its ugly head.

Re:Cursed Excel: "1/2"+1=45660 by hnlmorg on Monday April 07, 2025 @12:08PM (#43613023)
“1/2” is a string. So “1/2”+1 is either an error because of datetype mismatch (which is terrible UX for a spreadsheet or going to mean one of the following to scenarios:

    Date plus a day

    “1/2” concatenates with “1”
The latter is wrong, the former, while unexpected, does kind of make the most sense here.
Re:Cursed Excel: "1/2"+1=45660 by SAI_Peregrinus on Monday April 07, 2025 @12:49PM (#43613419)
Excel allows bare strings, so `"1/2" + 1` is a string with embedded quotation marks. So that's a third option for what to do.
Re:Cursed Excel: "1/2"+1=45660 by hnlmorg on Monday April 07, 2025 @01:37PM (#43613948)
True. And that would probably make the most sense too.

A very good point you’ve made there :)

Re:Cursed Excel: "1/2"+1=45660 by dmurray on Monday April 07, 2025 @12:49PM (#43613422)
Why would you favour "date plus a day" rather than "number plus a number"?

I agree Excel has to guess, and in isolation guessing that "1/2" should be parsed a date is not a terrible choice, and that parsing the individual components separately is simpler and more predictable than using the full context that it's about to be added to a number. But evaluating to 1.5 would raise few eyebrows.

Re:Cursed Excel: "1/2"+1=45660 by hnlmorg on Monday April 07, 2025 @01:34PM (#43613919)
> Why would you favour "date plus a day" rather than "number plus a number"?

Date is a number though. It’s only when we print them in a human readable way that they become anything else.

Whereas 1/2 is an expression.

Re:Cursed Excel: "1/2"+1=45660 by fragmede on Monday April 07, 2025 @02:20PM (#43614358)
Haven't seen "1/21" as an answer yet
Re:Cursed Excel: "1/2"+1=45660 by hnlmorg on Monday April 07, 2025 @02:39PM (#43614555)
An answer where? Not sure I follow
Re:Cursed Excel: "1/2"+1=45660 by fragmede on Monday April 07, 2025 @02:52PM (#43614653)
I just wanted to introduce "1/21" as an answer
Re:Cursed Excel: "1/2"+1=45660 by hnlmorg on Monday April 07, 2025 @05:21PM (#43616076)
Ahh I see the confusion now. I suggested it in the comment you were replying to:

> “1/2” concatenates with “1”

…and thought you’d spotted that and was saying others had disagreed with the concatenation way of handling + operators with strings.

Re:Cursed Excel: "1/2"+1=45660 by fragmede on Monday April 07, 2025 @05:23PM (#43616104)
"“1/2” concatenates with “1”" != "1/21"
Re:Cursed Excel: "1/2"+1=45660 by hnlmorg on Monday April 07, 2025 @05:25PM (#43616122)
That’s literally what concatenation is.
Re:Cursed Excel: "1/2"+1=45660 by fragmede on Monday April 07, 2025 @05:28PM (#43616155)
> Concatenate is a process of combining two or more strings into a single larger string. It's an important function in programming and computing because it allows you to store and combine multiple pieces of data when needed.

https://www.lenovo.com/us/en/glossary/concatenate/#:~:text=C...

That doesn't make those two strings equal, however.

Re:Cursed Excel: "1/2"+1=45660 by hnlmorg on Monday April 07, 2025 @05:32PM (#43616183)
Im not using the term in any weird way here. JavaScript even has a function specifically called “concat” and the ‘cat’ utility in UNIX is short for “concatenation”

You can try string concatenation in 3 differently languages using the links below:

https://www.w3schools.com/python/python_strings_concatenate....

https://go.dev/play/p/Q5VPF2ANk7Y

https://www.w3schools.com/jsref/jsref_concat_string.asp

Edit: who said anything about making both side of the operator equal? That’s not how operators work.