Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
133 user(s) are online (80 user(s) are browsing Forums)

Members: 0
Guests: 133

more...

Headlines

 
  Register To Post  

how replace fast mathffp.library and mathtrans.library on os4 ?
Home away from home
Home away from home


See User information
Porting now some os3 library which use those 2 math libraries quite heavy, and os4 sdk just says to me:

Quote:

mathffp.library and mathtrans.library are not supported on AmigaOS4


Question is: how deal with it without much blood (i.e. some fast rewriting, etc). There is bunch of functions which is used from, like SPFlt, SPSub, SPFix, SPMul, SPDiv and SPSincos, so i need some replacement functions which will just works as expected without rewriting of code fully.

Maybe there is already some macroses/replacement-functions done for that ?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: how replace fast mathffp.library and mathtrans.library on os4 ?
Home away from home
Home away from home


See User information
@kas1e

Those libraries were designed to be used by C library implmentations rather than called directly, you can just rewrite the code using standard C calls and maths operators , it will be simpler, more efficient, easier to maintain, and work on all plaforms.






Go to top
Re: how replace fast mathffp.library and mathtrans.library on os4 ?
Not too shy to talk
Not too shy to talk


See User information
float SPFlt(int inum)
{
return (
inum);
}


int SPFix(float fnum)
{
return (
fnum);
}


float SPSub(float fnum1float fnum2)
{
return (
fnum1 fnum2);
}


float SPMul(float fnum1float fnum2)
{
return (
fnum1 fnum 2);
}


float SPDiv(float fnum1float fnum2)
{
return (
fnum1 fnum2);
}


float SPSincos(float *pfnum2float fnum1)
{
*
pfnum2 cos(fnum1);
return (
sin(fnum1));
}


(just derived from the autodocs; not tested!)

Go to top
Re: how replace fast mathffp.library and mathtrans.library on os4 ?
Home away from home
Home away from home


See User information
@Andy
Yep, i hope it will be rewritten later, but for now just need to make everything works

@Thomas
Thanks ! All works ok for os4 version, and i want also make the same code works for os3 one with their old 2.x gcc, but have on linking undefs to sin() and cos(). If i add -lm on linking, it want then those mathtras and co. If i add just include of math.h it didn't helps. I find that #include <math-68881.h> helps and no undefs on linking, but then final graph a bit messed.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: how replace fast mathffp.library and mathtrans.library on os4 ?
Home away from home
Home away from home


See User information
@kas1e

I presume your linking the 68k version against libnix and IIRC that uses mathtrans.library for the sin an cos etc, so if you use those stubs for libnix code you'll get circular dependencies.




Go to top
Re: how replace fast mathffp.library and mathtrans.library on os4 ?
Home away from home
Home away from home


See User information
@Andy
Quote:

I presume your linking the 68k version against libnix and IIRC that uses mathtrans.library for the sin an cos etc, so if you use those stubs for libnix code you'll get circular dependencies.


I compile all without libnix, but to make sin/cos links on 68k, i should add -lm, and that one use libnix so i am in loop as you say.

Seems just need some proper 68k sin/con realization, even if it will be assembler one it's ok, i can just build objects from and link to 68k version. Will do some google now for ready to use code

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: how replace fast mathffp.library and mathtrans.library on os4 ?
Home away from home
Home away from home


See User information
@all
Seems i was too fast, and its the same for os3/os4 (i.e. m688881.h can be ok for os3/gcc2.x then). It looks like general problem with replaced funcs. Check attached image, that how it looks like with original sasc module, and with gcc (os3 or os4 version does not matter) module.

Resized Image

If anyone want to help and rewrite that module (a very small one, and use those math funcs just in few places) i will then just add it to repo with note at top who fix that. Source there (one small and well commented file): http://kas1e.mikendezign.com/misc/dopus5/modules/

All those math functions uses only in diskinfo_show_graph() in the source.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: how replace fast mathffp.library and mathtrans.library on os4 ?
Just can't stay away
Just can't stay away


See User information
According to the NDK3.9 mathffp autodoc SPDiv function should be:
float SPDiv(float fnum1float fnum2

return (
fnum2 fnum1); 
}


Quoting from autodoc:
mathffp.library/SPDiv                                   mathffp.library/SPDiv

NAME
    SPDiv 
-- Divide two floating point numbers.

SYNOPSIS
    fnum3 
SPDiv(fnum1fnum2)
    
D0          D1     D0

    float SPDiv
(float fnum1float fnum2);

FUNCTION
    
Accepts two floating point numbers and returns the arithmetic
    division of said numbers
.

INPUTS
    fnum1     
floating point number.
    
fnum2    floating point number.

RESULT

    fnum3     
floating point number (fnum3 fnum2/fnum1).

BUGS
    None
.

Go to top
Re: how replace fast mathffp.library and mathtrans.library on os4 ?
Home away from home
Home away from home


See User information
@salas00
Thanks a lot ! It almost fix the problems , at least now graph renders correctly, just by some reasons colors swapped. I.e. "used" now shows as "unused" and "unused" shows as "used" on graph. I.e:

Resized Image

But as you can see its anyway better even in compare with original sasc-os3 version which on os4 just show all wrong (maybe because of those mathlibs usage, dunno).

Anyway, with those replacement its almost fine now, just strange why colors swapped. Maybe something about differences with singed/unsigned default values for sasc/gcc. Or endianes somehow make differences there

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: how replace fast mathffp.library and mathtrans.library on os4 ?
Just can't stay away
Just can't stay away


See User information
@kas1e

It might be that the SPSub is wrong as well (similar to how SPDiv was) and should be:
float SPSub(float fnum1float fnum2

return (
fnum2 fnum1); 
}


The autodoc documentation in this case does not clearly state which number should be subtracted from the other.

Go to top
Re: how replace fast mathffp.library and mathtrans.library on os4 ?
Home away from home
Home away from home


See User information
@salas00
Quote:

It might be that the SPSub is wrong as well (similar to how SPDiv was)
The autodoc documentation in this case does not clearly state which number should be subtracted from the other.


It helps, thanks, relief :)
Resized Image

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project