• over_clox@lemmy.world
    link
    fedilink
    English
    arrow-up
    28
    ·
    14 days ago

    TL;DR - M$ Excel copied the bug from Lotus 123 for backwards fucked up compatibility.

    Saved you the read, you’re welcome.

  • Lvxferre [he/him]@mander.xyz
    link
    fedilink
    English
    arrow-up
    9
    ·
    14 days ago

    My question is, why did Lotus 1-2-3 have this bug?

    Because, seriously, even the Gregorian formula is simple:

    if year % 400 == 0; then leap = yes
      elif year % 100 == 0; then leap = no
      elif year % 4 == 0; then leap = yes
      else leap = no
    

    Sure, you’re running three tests instead of one, but with nested if’s you could make so most years are only tested once, like this:

    if year % 4 == 0; then
      if year % 100 == 0; then
        if year % 400 == 0; then leap = yes; else leap = no
        else leap = yes
      else leap = no
    

    Sure, it’s dirty but if you got it right it’s set up and forget about it.

    • Peer@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      2
      ·
      14 days ago

      Probably in the time lotus was released people would use it for relatively simple calculations involving dates that would not go that far back. So this bug would not be a problem for those uses and go undetected for some time. Or maybe it even was a deliberate choice to improve performance since the creator would consider it unlikely to use dates decades away.

      • Kairos@lemmy.today
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        14 days ago

        Much more likely : they just had a %4 and only added the %100 case when they tested dates with the year 2000. What about 1800? Can someone test this?

  • antlion@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    1
    ·
    14 days ago

    Also for any numeric less than 1 expressed as a date/time will display as January 0, 1900. Because January 1st is day 1. Kind of a shame because they really have an opportunity to support more dates in the past with negative values.