Jump to content

Rebase algorithm


dNY

Recommended Posts

Hello! 

I'm building a rebase algorithm that I need some help with. These are the variables, constants, and constraints (the values themselves are just examples):

Set of variables 1:

  • a1 = 1934464428151493937044
  • b = 54802476401439357
  • c = 1e18
  • result1 = ?

Set of variables 2:

  • a2 = 1837741206733939183658
  • b = 54802476401439357
  • c = 1e18
  • result2 = ?

Final invariant --> result1 == result2

As you can see b and c are constants and the only variables shared between sets, so you can't use a1 during the operations of Set 2 and vice versa (a1 and a2 might fluctuate in value, but not b and c).

Also, result1 is not known during the operations for result2, and vice versa.

The idea is to have result1 to equal result2. Feel free to add more variables, constants, escalating factors, etc. if you need them in order to achieve the final idea.

 

Thanks!

 

Link to comment
Share on other sites

Something is missing in this definition. As it is described, the simple solution would be just to have a "result" some constant or, more generally, independent on the variable "a".

Link to comment
Share on other sites

16 hours ago, Genady said:

Something is missing in this definition. As it is described, the simple solution would be just to have a "result" some constant or, more generally, independent on the variable "a".

Perhaps that something that's missing is the clarification that a1 and a2 are the only actual variables (while b and c are the constants)? 

You can also introduce more variables/constants in your end, if that helps to achieve the invariant of result1 === result2. 

Link to comment
Share on other sites

1 minute ago, dNY said:

Perhaps that something that's missing is the clarification that a1 and a2 are the only actual variables (while b and c are the constants)? 

You can also introduce more variables/constants in your end, if that helps to achieve the invariant of result1 === result2. 

So, what is wrong with defining, say, result1==result2==5?

Link to comment
Share on other sites

1 hour ago, Genady said:

So, what is wrong with defining, say, result1==result2==5?

You can't know result1 on the calculation of result2, and vice versa.

Each one happens in their own separate environment at runtime, so to say that result2 is equal to result1 in result2's environment, you'd need to know result1 beforehand, thus breaking this invariant.

Link to comment
Share on other sites

57 minutes ago, dNY said:

You can't know result1 on the calculation of result2, and vice versa.

Each one happens in their own separate environment at runtime, so to say that result2 is equal to result1 in result2's environment, you'd need to know result1 beforehand, thus breaking this invariant.

Let "result" to be a b's digit of the number \(\pi\).

I don't know it beforehand, but they will be equal.

Edited by Genady
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.