Jump to content

Mars Hotspot


Sande

Recommended Posts

  • Replies 1k
  • Created
  • Last Reply

Top Posters In This Topic

  • 5 weeks later...
  • 5 weeks later...
  • 4 weeks later...
  • 1 month later...
2 hours ago, Greatest Mothers said:

It's 100% even with -48 

There's no need of -48.00000001

 

Good to know! Thanks for letting us know! The floating point calculations seem to vary slightly between machines, which makes predicting them.. complicated unfortunately.

Link to comment
Share on other sites

2 hours ago, Greatest Mothers said:

It's 100% even with -48 

There's no need of -48.00000001

 

6 minutes ago, Luna said:

 

Good to know! Thanks for letting us know! The floating point calculations seem to vary slightly between machines, which makes predicting them.. complicated unfortunately.

 

Wait hold on, did you place them at -48, -72 using a URL with lat=-48 in it? Or did you place them using a URL with lat=-48.00000001 in it and then look at your mars page afterwards and see that they say -48.00000? The mars page should say -48.00000 since that page rounds. I'm seeing that all 3 of your wonders are at -48.00000001,-72 by looking at the source code of your nation's mars page.

Link to comment
Share on other sites

5 hours ago, Luna said:

 

 

Wait hold on, did you place them at -48, -72 using a URL with lat=-48 in it? Or did you place them using a URL with lat=-48.00000001 in it and then look at your mars page afterwards and see that they say -48.00000? The mars page should say -48.00000 since that page rounds. I'm seeing that all 3 of your wonders are at -48.00000001,-72 by looking at the source code of your nation's mars page.

I placed at -48, -72 using a URL with lat=-48 in it, both the Colony and the Mine.

I placed the Base at -48.00000001, -72

And now all three are at 100%

The system says that all three are at -48.00000, -72.00000 - just only five zeros after the point and nothing else.

 

 

 

Edited by Greatest Mothers
Link to comment
Share on other sites

I tried such modification out of curiosity, not a great risk since it wasn't a big loss to have the Colony at 99.999% rather than 100% but after the move it wasn't 99.999%, it was 100%. 

Probably after a certain number after the point, perhaps from the 6th number after the point, differences become irrelevant.

Edited by Greatest Mothers
Link to comment
Share on other sites

If I can weigh in on that extra 0.00000001

...

 

I tried with just lat=-48 ...

 

Quote

 

... only gave me 99%

 

Quote
Mars Base

Owner: Snow Dan
Base Effectiveness: 99%
Last Moved: 11/5/2023
Date Purchased: 12/4/2022
Expires: 864 Days
Location: -48.00000, -72.00000

 

Then I tried with lat=-48.00000001 ...

 

Quote

https://www.cybernations.net/national_wonders_map.asp?Nation_ID=47400&Location=Mars&Type=Mine&lat=-48.00000001&lon=-72&VALUE=F4419F1480

 

... that gave me 100%

 

Quote
Mars Mine

Owner: Snow Dan
Mine Effectiveness: 100%
Resource: Sodium
Last Moved: 11/5/2023
Date Purchased: 3/7/2022
Expires: 292 Days
Location: -48.00000, -72.00000

 

---

 

So, that's how it played out for me

Edited by Snow Dan
Link to comment
Share on other sites

13 hours ago, Snow Dan said:

If I can weigh in on that extra 0.00000001

...

 

I tried with just lat=-48 ...

 

 

... only gave me 99%

 

 

Then I tried with lat=-48.00000001 ...

 

 

... that gave me 100%

 

 

---

 

So, that's how it played out for me

 

Thanks for testing it! I do see your base at -48 and your colony and mine at -48.00000001 from your mars page's source code. The source code from Greatest Mothers's page shows all 3 wonders at -48.00000001. So I'm going to assume -48, -72 actually gives 99%.

 

Good to test stuff like this, as there have been some weird surprises with floating point stuff which don't fit the google sheet. They're rare it seems, but it happens.

Edited by Luna
Link to comment
Share on other sites

  • 4 weeks later...

Refined the test: 

 

With -54.9999999 (7 digits after the point rather than 8) it gives 100%

 

With -54.999999 (6 digits after the point rather than 8) it gives 99%

 

With -55 it gives 99%, just like -54.999999 (6 digits after the point rather than 8).

 

My conclusion: everything beyond the 7th digit after the point is irrelevant.

 

 

 

 

Edited by Greatest Mothers
Link to comment
Share on other sites


 

On 12/1/2023 at 1:30 AM, Greatest Mothers said:

Refined the test: 

 

With -54.9999999 (7 digits after the point rather than 8 ) it gives 100%

 

With -54.999999 (6 digits after the point rather than 8 ) it gives 99%

 

With -55 it gives 99%, just like -54.999999 (6 digits after the point rather than 8 ).

 

Thanks for testing it! This is useful information. 😊

 

 

On 12/1/2023 at 1:30 AM, Greatest Mothers said:

My conclusion: everything beyond the 7th digit after the point is irrelevant.

 

Not exactly. Here's an example of lat=-6.00000088280216559 giving 100% one month. That same month -5.99999999 and -5.99999996 gave 100% but -6 gave 99%.

 

Floating points actually use binary digits instead of decimal digits, which wouldn't really lend itself to a situation where  nothing beyond the 7th decimal digit matters. But it's wilder than that. Here are the 41 numbers closest to -55 (20 on each side of -55 plus -55 itself):

 

-54.9999999999998579    100
-54.9999999999998650    100
-54.9999999999998721    100
-54.9999999999998792    100
-54.9999999999998863    100
-54.9999999999998934    99
-54.9999999999999005    100
-54.9999999999999076    100
-54.9999999999999147    100
-54.9999999999999218    100
-54.9999999999999289    100
-54.9999999999999361    100
-54.9999999999999432    100
-54.9999999999999503    99
-54.9999999999999574    100
-54.9999999999999645    100
-54.9999999999999716    100
-54.9999999999999787    100
-54.9999999999999858    100
-54.9999999999999929    100
-55.0000000000000000    99
-55.0000000000000071    99
-55.0000000000000142    100
-55.0000000000000213    100
-55.0000000000000284    100
-55.0000000000000355    100
-55.0000000000000426    100
-55.0000000000000497    100
-55.0000000000000568    100
-55.0000000000000639    100
-55.0000000000000711    100
-55.0000000000000782    100
-55.0000000000000853    100
-55.0000000000000924    100
-55.0000000000000995    100
-55.0000000000001066    100
-55.0000000000001137    100
-55.0000000000001208    100
-55.0000000000001279    99
-55.0000000000001350    100
-55.0000000000001421    100

 

As you can see there is seemingly no pattern. And yes, these are the 41 closest numbers to -55. A double precision floating point number can't represent anything between -54.9999999999999929 and -55. The difference between those two is exactly 1 bit as far as the computer knows.

 

But it's even worse than that. You see, if you run the code to generate that on a different computer you get different results. Yes, I tried. Which means the list above isn't the absolute truth regarding the floating point calculation. And even worse, if the server-side CN code starts being run on a different computer the moon & mars calculations may start giving different results. In fact this has already happened. -55 used to work but then stopped working at some point:

 

 

 

 

If anyone wants to play around with this, it's really simple to do so. Here's the C++ code I used to generate the results above. The essential part is the checkLat function which is fortunately only a simple few lines. The rest of the code just exists to loop through a bunch of test values and print the results, so you can change that to test whatever you want to test. You don't need to understand the weird pointer referencing/deferencing trickery to test your own values. Just run checkLat(lat,-55) with whatever lat you want to test. It will return true for lat values that give 100% and false for values that don't.

 

#include <stdio.h>
#include <cmath>

bool checkLat(double lat1, double lat2)
{
    double testVal = cos(lat1*M_PI/180.0)*cos(lat2*M_PI/180.0) + sin(lat1*M_PI/180.0)*sin(lat2*M_PI/180.0);
    return testVal == 1;
}

int main(int argc, char *argv[])
{
    double neg55 = -55.0;
    long int neg55bits = *(long int*)&neg55;
    
    for (long int i = -20; i<=20; i++)
    {
        long int latBits = neg55bits + i;
        double lat = *(double*)&latBits;
        printf("%.16f\t%d\n",lat, checkLat(lat,-55)?100:99);
    }
    
    return 0;
}

 

Like I said, if you run it on a different computer sadly you'll get different results. I actually had difficulty finding a computer that doesn't think -55 gives 100%. I ran it on this website and it seems to agree with the results @Greatest Mothers posted above: https://www.online-cpp.com/

Edited by Luna
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...