[Push] division and tangent instructions

PerPlex Ed edperplex at yahoo.com
Sun Jun 27 04:09:15 EDT 2010


I guess integer in Push like in other languages are used in two and only two ways: arithmetic computation and addressing. Unless I'm overlooking something.

You use integers to compute 2 + 2 or 3 * 405 or 100*99*98*97*96... etc. because you are looking for that value as a result or you use integers because you want to yank the nth (integer) element from one of the stacks or because you want the nth (integer) element of a Sequence instruction etc.

In the first case you may need BigInts. In the second case it's very unlikely that you need address a stack that is orders of magnitudes bigger than your virtual memory.
I guess that the two kind of integers, even if their are represented by the same platform data type could in theory be stored in different stack and allowed to be "converted" and passed from a stack to the other just like you do with the Code and Exec stack. Not that you need to do this but I guess that it's possible and it would not hurt the power and expressivity and applicability of Push.

Separating the "purely arithmetic integers" from the "addressing integers" could even cause slightly better programs to be generated.

So I guess the basic integer type and stack should be 32 bit or 64 bit, depending on the machine and maybe configurable on some implementations. And an additional type and stack for BigInts should be provided. You may require that a Push implementation always provide BigInts, if you think it's appropriate. I guess they are supported in most of the current platforms so it's not a big effort for someone writing a software implementation. For a Push hardware processor it may be different.

Then if the items in the BigInts stack (think of it as the "purely arithmetic integer stack" as opposed to the "addressing integer stack") are always represented as BigInts or sometimes as int and then promoted automatically is an implementation detail that you not need necessarily to care about when doing genetic programming in Push.

I hope what I wrote is not silly. I think I *almost* managed to make my first symbolic regression yesterday. :) I'm fixing some problem in my implementation to check and semplify the result. 

PerPlexEd.

Lee said:
>I agree that it'd be just as well to add ratios and/or arbitrary 
precision floats as new, independent types. Integers are different, 
because integer is a core type that figures in a lot of standard 
instructions for other types.



      



More information about the Push mailing list