News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

The calculator

Started by RuiLoureiro, April 09, 2012, 02:16:47 PM

Previous topic - Next topic

dedndave

man - that is monotonous - lol
i just got through replacing 34*456*5*2 about 50 times
being careful not to hit the odd ones like 34*456*5*2^4

so - i forget what we decided
is 34*456*5*2^4 = 34*456*5*16  ???
or is 34*456*5*2^4 = (34*456*5*2)^4

also...
is 34*456^2*5*2 = 34*456^20  ?
or is 34*456^2*5*2 = 10*34*456^2 ?

RuiLoureiro

Quote
man - that is monotonous - lol
Dave, In the next version we will go
                 to test more complex expressions
                 but not too large  :green

Quote
so - i forget what we decided
is 34*456*5*2^4 = 34*456*5*16  ???
or is 34*456*5*2^4 = (34*456*5*2)^4

    34*456*5*2^4: first powers so 2^4=16
  = 34*456*5* 16

Quote
also...
is 34*456^2*5*2 = 34*456^20  ?
or is 34*456^2*5*2 = 10*34*456^2 ?

  34* 456^2 * 5*2: first powers so 456^2=207936
= 34* 207936 *5*2
=340* 207936
=70698240

dedndave

Quote from: RuiLoureiro on May 17, 2012, 10:25:27 AM
        Dave, In the next version we will go
                 to test more complex expressions
                 but not too large  :green

yah - this one is more of a test on my bad eye-sight - lol
it would make a great eye-chart for a driver's license exam  :eek
"Look into the machine and read the first 50 lines (snicker)."

RuiLoureiro

Hi all,

            3 things:

            1. calcula46 doesnt solve some expressions
               and i want it should solve any expression
               and i need to lose some time testing all
               that cases and cleaning some code to
               get the best code to do each task.
               To do this work i have a separated file
               with a lot of procedures to test and to
               follow each calculation step. I lose
               some time writing these particular procedures.
               
            2. Now, calcula47 solves chains of powers
               or exponentials and powers of rational
               numbers               

            3. The bigest problem i had to solve till now
               was exponentials or powers and chains of
               powers. I remember that the arguments or
               factors can be pi,+pi,-pi,e,+e,-e, scientific
               notation, integers, any real number, expressions
               inside brackets or functions or functions
               inside functions
           
        **** Here is calcula47 v1.07 ****

            1.  exponential or power of rational number

                How to calculate (expression)^(N/K)
                where N and K are integers ?

                Now, when we type any expression inside
                brackets followed by "^" and
                followed by brackets, the calculator
                try to decode the last as integers N
                or N and K.

                So, now we can solve (log(3)-1)^(1/3)
                (=-0.805626350626199) 
                or (log(3)-1)^(-1/3) = -1.241270223128524
                or (log(3)-1)^(1/-3) = -1.241270223128524

            2. chains of exponentials or powers

                How to calculate

                  real1^real2^real3^...^realN ?
                 
                where real1,real2,...,realN are any real number ?

                Now, we can solve expressions like this:
                                                                       
    Examples:
   
        1)      (-3.573718205179228E-0017)^(-3/5)= -7381214348.06242
       
                2+(log(3)^2)^(6/3) = 2.051822105661585

                2+(log(3)^2)^(1/3) = 2.610593967460875

                (cos(pi/3)^2+sin(3*pi/2)^2)^(1/3)  = 1.077217345015942

                2*(log(2)-log(3)^2^3)^(1/3)+1   = 2.33639853443889

                When the value is infinity it gives ERROR

        2)
                2^-2.21E-3^log(2)^+2e2^-pi  = 0.998469317422371

                2^-2.21E-3^log(2)^2e-2^-pi  = 0.5

                2^e^log(2)^-e^-pi  = 7.295225269786005

                2*(3-2^3^log(5*log(3)+1)^2^3^log(3)^2^3)^(1/2) / (log(2)+2^3^log(3)^2^3)
                =  0.571196983587843


        Try it and say something.
        Good luck !

        Thanks       
        Rui Loureiro
        EDIT: note that, to solve 2^3^4^5, the calculator
                     starts by 4^5 = x, next 3^x=y, next 2^y.