TIP: Click on subject to list as thread! ANSI
echo: public_domain
to: Paul Edwards
from: Frank Malcolm
date: 1996-01-05 06:23:40
subject: math functions

Hi, Paul.

PE> PE> Does anyone have the ability and tenacity to implement some
PE> PE> or all of the following functions marked "unimplemented"
PE> PE> (except the last 3, as I can do them myself?  I will post the
PE> PE> descriptions of the functions in the next message, quoting
PE> PE> from the ANSI C draft...

PE> FM> Why don't you just look at the code generated from one of your
PE> compilers
PE> FM> when you compile for 'copro present', then duplicate that?

PE> I thought that was a good idea at first, but then I realised that
PE> these things, like sin(), are library functions, and will be coded
PE> already.

Are you sure? It might be worth checking to see if inline code is
generated rather than a function call. If the numeric representation
is compatible with what the copro uses, it might just be one or two
instructions.

I've just checked Turbo Pascal, it does use library calls unfortunately.
And the whole thing is complicated by the possibility of emulation or
using the copro, which is checked at run-time. I seem to recall when I
looked at this once that it sets up every function as a call to the
emulation code, then the first time each call is done, if there's a
copro present, it patches the call with a NOP. Anyway, the code doesn't
make much sense.

PE> I could disassemble the library function of one of my
PE> compilers, or even just look at the library source code which I
PE> have for 2 of my compilers (at least), but that is basically
PE> cheating, as I could be accused of copyright violation doing
PE> something like that.  It would be OK if I looked at the library
PE> functions, then understood both the formulae and the copro
PE> instructions, and then tackled the problem a month later, using
PE> my knowledge/understanding.  It's cleaner to get someone who already
PE> has the understanding to do it from scratch though.

Sure, and it's almost certainly been done.

PE> FM> If C can't do asm instructions

PE> The language does not include support for assembler.

PE> FM> (Turbo Pascal can)

PE> However, specific compilers do, including Turbo C.

"The language" is as implemented by its compiler, IMHO. Of course then
there is ISO C, a different animal. :-)

PE> FM> you might have to make external objs with MASM or TASM.

PE> This is what I want to do.  Basically I was looking for a
PE> matha.asm.  BFN.  Paul.

Understand. If I ever come across one I'll let you know.

Regards, FIM.

 * * If it's stupid and it works - its not stupid
@EOT:

---
* Origin: Pedants Inc. (3:711/934.24)
SEEN-BY: 690/718 711/809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.