I know this is not PASCAL specific but has anyone ever found out...... - Programmers Heaven

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

#### Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# I know this is not PASCAL specific but has anyone ever found out......

Posts: 748Member
[b][red]This message was edited by DrMarten at 2005-3-17 18:34:38[/red][/b][hr]
I know this is not PASCAL specific but has anyone ever found out the algorithims that a processor uses for higher functions like COSINE etc when all a processor can really do is ADD ( at machine code level )?

SUBTRACTION is the ADDITON of a NEGated number like
> 5-2 is +5+-2 ( in the binary form )

So most coders know MULTIPLY is ( ADDITION repeated ) and
DIVISION is ( the ADDITION of NEGated numbers repeated and counted ).

I am just curious as I am am thinking of writing a program that does some number crunching etc.

Is there a book on this MACHINE CODE subject area, anyone know?

• Posts: 6,349Member
: [b][red]This message was edited by DrMarten at 2005-3-17 18:34:38[/red][/b][hr]
: I know this is not PASCAL specific but has anyone ever found out the algorithims that a processor uses for higher functions like COSINE etc when all a processor can really do is ADD ( at machine code level )?
:
: SUBTRACTION is the ADDITON of a NEGated number like
: > 5-2 is +5+-2 ( in the binary form )
:
: So most coders know MULTIPLY is ( ADDITION repeated ) and
: DIVISION is ( the ADDITION of NEGated numbers repeated and counted ).
:
: I am just curious as I am am thinking of writing a program that does some number crunching etc.
:
: Is there a book on this MACHINE CODE subject area, anyone know?
:
:
:
I think that things like sine and cosine are burned into the FPFU of the processor and are actually done using the microprogramming. I have found the assembly code for the tan, which is FPTAN. It is possible to get an estimate of the sine using polynomials, which should be covered in any good mathematics book.
• Posts: 748Member

Okay thanks, I am still curious though as someone has obviously "worked out" how to do these things with just the on-offs of the binary switches or transistor gates ( if you like ).

Some ASSEMBLERS only let you do ADD,SUBTRACT,MUL,DIV etc with all the comparison functions like BGT ( Branch if Greater Than ) and the ROTATE functions etc.

So does anyone know TRIG functions etc as algorithim's in ASSEMBLY language then?

• Posts: 6,349Member
:
: Okay thanks, I am still curious though as someone has obviously "worked out" how to do these things with just the on-offs of the binary switches or transistor gates ( if you like ).
:
: Some ASSEMBLERS only let you do ADD,SUBTRACT,MUL,DIV etc with all the comparison functions like BGT ( Branch if Greater Than ) and the ROTATE functions etc.
:
: So does anyone know TRIG functions etc as algorithim's in ASSEMBLY language then?
:
:
I would suggest that you ask this in the assembly board or perform a google search. As I've posted earlier, it is possible to approximate trig functions using polynomials.
• Posts: 156Member
: :
: : Okay thanks, I am still curious though as someone has obviously "worked out" how to do these things with just the on-offs of the binary switches or transistor gates ( if you like ).
: :
: : Some ASSEMBLERS only let you do ADD,SUBTRACT,MUL,DIV etc with all the comparison functions like BGT ( Branch if Greater Than ) and the ROTATE functions etc.
: :
: : So does anyone know TRIG functions etc as algorithim's in ASSEMBLY language then?
: :
: :
: I would suggest that you ask this in the assembly board or perform a google search. As I've posted earlier, it is possible to approximate trig functions using polynomials.
:
For calculating such functions computer uses Taylor series. This is an unlimited serie. With this method you can calculate such functions as acurate as you want if you sum up the Taylor polinom.