Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exe with floats compiled for kickstart 1.3 is using an inexistant library #36

Closed
Samuel-DEVULDER opened this issue Oct 27, 2020 · 4 comments

Comments

@Samuel-DEVULDER
Copy link

Samuel-DEVULDER commented Oct 27, 2020

Hello.

When I compile this piece of code

#include <math.h>

int main(int ac, char **argv) {
	float f = 1, g=2;
	float h = f*g;
}

with m68k-amigaos-gcc -O0 -mcrt=nix13 tst_float_ks13.c -o tst_float_ks13, I get an exe which, when launched under kickstart 1.3 complains about mathieeesingbas.library failed to load

The issue is that mathieeesingbas.library does not exist for kickstart 1.3. It only exists since amigaos V36 (eg around kick 2.04).

A possible work around would be that in the supporting math lib functions internally opens mathieeetransbas.library which exists in kickstart 1.3, then call: DOUBLE IEEEDPFieee( FLOAT single ) to convert IEEE single-precision number to IEEE double-precision number. Then perform the basic arithmetic operations on doubles, and convert back the result to float using FLOAT IEEEDPTieee( DOUBLE parm ). Of course this would use much more cycles than needed with an proper mathieeesingbas.library, but that one does not exist. On the balance, this solution preserves the IEEE compatibility of memory representation of floats.

Another possibility is to drop IEEE compatibility and use motorola's ffp format provided by mathffp.library present in amigaos 1.3 rom IIRC, so neither extra libraries on disk nor extra memory are required while keeping a pretty good execution speed.

Of course the best approach would probably be to let the programmer choose between these two options via a dedicated -mffp or -mieee switch.

@bebbo
Copy link
Owner

bebbo commented Dec 23, 2020

If a library is missing, copy it to your system.
mathieeesingbas.zip

@Samuel-DEVULDER
Copy link
Author

Samuel-DEVULDER commented Dec 23, 2020

Where does it comes from ? I don't have it in my KS1.3 disks. C:VERSION displays a suspicous 1.0 version from 2015 whereas KS1.3 math libraries are 34.x from 1988:

CLI> version file mathieeesingbas.library  full
mathieeesingbas.library 1.0 (19/07/15)
CLI> version file mathieedoubbas.library full
mathieeedoubbas.library 34.46
(28 May 1988)

@bebbo
Copy link
Owner

bebbo commented Dec 24, 2020

does it work or does it work?

@Samuel-DEVULDER
Copy link
Author

Samuel-DEVULDER commented Dec 24, 2020

does it work or does it work?

It works indeed !!! (no real choice here :P )

I tested under kickstack 1.3.3 (UAE), and there is no more complaint when running the test-program.
Sans titre

(merry xmas by the way)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants