News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Coding comparison using the Po-Shen Loh's new quadratic formula

Started by Biterider, September 03, 2022, 03:55:57 PM

Previous topic - Next topic

Biterider

Hi
Here is a video by a well-known author in the asm community.
He makes a very interesting comparison, especially after minute 15:25 when he makes the asm comparison.  :biggrin:

Check it out https://www.youtube.com/watch?v=eZ5U0f14LaY

Biterider

hutch--

I watched the video, much depended on how the C compiler handled numbers. The ASM code was faster as expected but the author said it was not highly optimised. Interesting enough but I don't know what you use it for.

HSE

Quote from: hutch-- on September 03, 2022, 04:57:49 PM
Interesting enough but I don't know what you use it for.

Quadratic formula is reverse equation of polynomic of grade 2.


     Y = a + b*X + c*X^2

     Y = polynomic (a,b,c,X)  ;  X is known and Y is unknown

     X = quadratic (a,b,c,Y)  ;  X is unknown and Y is known


     If i know steers body weight in kg is related to age in days by:

           BW = -50.4 + 1.22*age - 0.000472*age^2

     What age could have a steer that weighs 450 kg?

           age = quadratic(-50.4, 1.22, - 0.000472, 450.0)
     



   
Equations in Assembly: SmplMath

FORTRANS

Hi,

   It was entertaining in an overdone sort of way.  So
thanks for posting.  Useful?  Maybe as an introduction
to algorithm testing I suppose.

Cheers,

Steve N.

Biterider

Hello Steve
You are absolutely right.
You don't always have to agree on the content, but one or the other pearl can almost always be found.

Biterider

hutch--

Hector,

There is a notation that I don't understand.

"Y = a + b*X + c*X^2" What is the "^" operator doing ?

It is a quirk leftover from when I went to primary school (early 1950s) where my arithmetic notation was different to what is being used today.

zedd151

c*X ^ 2
To the power of 2
More simple squared.

E=mc^2 is equal to E=mc2   
Used when you can't write superscript

NoCforMe

I'm surprised Steve didn't get that; I've always seen ^ used for exponentiation. Is there a Euro symbol for this that's different?
Assembly language programming should be fun. That's why I do it.

hutch--

Thanks Z, a "power of ...." makes sense. Its an era thing, having learnt arithmetic in the early 1950s, much modern notation does not fit where what I learnt long ago translates to assembler notation logic far easier. When I did logic at uni, I picked up the discipline of fully bracketing formula and stacked order of precedence does not fit that discipline.

HSE

Hi Hutch!

Quote from: hutch-- on September 05, 2022, 05:29:49 AM
"Y = a + b*X + c*X^2" What is the "^" operator doing ?

It's more usual notation for power. If I remember well is used in BASIC from the begining. At least GW-Basic used this notation.

Some old language use "**" for power. Both are programming notations.

In school, or writing, everybody use a superscript:  Y = a + b*X + c*X2

Quote from: hutch-- on September 05, 2022, 05:47:41 AM
stacked order of precedence does not fit that discipline.

:biggrin: No shunting-yard
Equations in Assembly: SmplMath

daydreamer

Please avoid write and compile expression x^2 in C because "^" is used for xor, if you want x*x
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

hutch--

Hi hector,

This is how my 1950s arithmetic sees the formula.

    original => Y = a + b*X + c*X2

    my brain => Y = a + (b*X) + (c * (X * X))

Thanks for the explanation.  :thumbsup: