English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Releases

 
 
Thread Tools
Old 28 October 2014, 23:38   #21
cla
dev
 
cla's Avatar
 
Join Date: Aug 2014
Location: Copenhagen
Age: 48
Posts: 65
Send a message via ICQ to cla
Quote:
The vbcc m881, m040 and m060 fp math libs should have asinh, acosh and cbrt functions. It's mentioned on the page at the link although many functions, especially new ones, need more testing. Did you have trouble using these functions?
Its been over 6 month since I started programming amath. At that time I had some troubles with -lm (in gcc) and also getting correct output from printf("%g"). I tried to link some of the vbcc libraries but I had problems solving the symbolic links from object files. I think it was due to another naming scheme.

Quote:
Which version of GCC are your using? If the IEEE libraries are not opened then I wonder how (or if) the FPU is initialized?
This one: https://github.com/cahirwpz/m68k-amigaos-toolchain

A crossbuild of vbcc is actually include in the toolchain. And probably you are right about auto opening the math libs. I would prefer not to maintain a static math library and I am very willing to find another solution. Reference in code looks like this (rfunc.h):

Code:
#ifdef NATIVEMATH
#include <math.h>
#endif

extern int finite(double x);

extern double floor(double x);
extern double ceil(double x);
extern double exp(double x);
extern double sqrt(double x);
extern double cbrt(double x);
extern double log(double x);
extern double log10(double x);

extern double cos(double x);
extern double sin(double x);
extern double tan(double x);
extern double acos(double x);
extern double asin(double x);
extern double atan(double x);
extern double cosh(double x);
extern double sinh(double x);
extern double tanh(double x);
extern double acosh(double x);
extern double asinh(double x);
extern double atanh(double x);

extern double pow(double x, double y);
extern double fmod(double x, double y);
extern double atan2(double y, double x);
extern double hypot(double x, double y);
extern double log1p(double x);
extern double expm1(double x);
extern double scalbn (double x, int n);

Last edited by cla; 28 October 2014 at 23:56.
cla is offline  
Old 28 October 2014, 23:56   #22
cla
dev
 
cla's Avatar
 
Join Date: Aug 2014
Location: Copenhagen
Age: 48
Posts: 65
Send a message via ICQ to cla
I use Kubuntu 14.04 LTS as building host. Frode Solheim provides binary files for Linux:
http://fs-uae.net/2014/01/23/gcc-com...r-amigaosm68k/
cla is offline  
Old 29 October 2014, 06:00   #23
matthey
Banned
 
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
Quote:
Originally Posted by cla View Post
This one: https://github.com/cahirwpz/m68k-amigaos-toolchain

A crossbuild of vbcc is actually include in the toolchain. And probably you are right about auto opening the math libs. I would prefer not to maintain a static math library and I am very willing to find another solution. Reference in code looks like this (rfunc.h):
That is GCC 2.95.3 which generates very good 68k Amiga code. The integer code generation is top notch (possibly the best of any Amiga compiler) but the math support is ancient and the 68040+ FPU code is incomplete. GCC 3.4.x isn't much better for floating point support and it's a little bit worse at integer generation. Maybe GCC 4.x (cross compiler only) has better c99 math support which would be easier for you. There is no Amiga hunk output (or Amiga specific support) but some programmers have successfully created Amiga hunk executables with GCC 4.x (probably with an ELF2HUNK converter?). That may be the only option to get Amiga C++ and c99 fp math functions. Vbcc should have all the c99 math functions you listed for direct 68k FPU code generation only but of course no C++. Maybe 68k and Amiga developer support and tools will improve if we get enough new 68k Amiga fpga hardware.
matthey is offline  
Old 29 October 2014, 12:01   #24
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by cla View Post
Maybe it could be an idea to compile fdlibm with vbcc and link it with some GCC output ? I don't know if its possible (resolving symbolic references etc).
Linking of vbccm68k and gcc-m68k object files is theoretically possible. AFAIK the ABI is identical (I seem to remember it was ok with gcc 2.95.x). Maybe newer gcc ports no longer follow the AmigaOS ABI, but return pointers in a0 or double in d0/d1, as defined by the M68k System V.4 ABI, but I didn't check that. d0/d1, a0/a1 and fp0/fp1 are scratch registers in both. Arguments are passed on the stack. Gcc precedes function names by an underscore in a.out format, like Amiga compilers do in hunk format.
Only problem is the different naming scheme of support functions (like 64-bit arithmetics or soft float). You would have to write stub-functions to make that link.
phx is offline  
Old 09 November 2014, 10:13   #25
cla
dev
 
cla's Avatar
 
Join Date: Aug 2014
Location: Copenhagen
Age: 48
Posts: 65
Send a message via ICQ to cla
The Amiga platform (pre 4.0) is obviously suffering from lack of support. My original goal was to make an application which people would be able to build themselves and I thought GCC could be a solution. But since the last public available m68k version of GCC is 2.95.3 which (for good reasons) does not support c99 math I don't see how it is possible. The only solution to the c99 problem would be either some kind of hack or to buy a commercial product like StormC4, and then people wont be able to build the application themselves anyway.

For this reason future version of amath will not include source code (no one will be able to build it) and I will purely focus on the end-user experience. I will still be releasing the source as an independent package but it will only be for "educational" purposes.

And after all everything I supply is free of charge.

Last edited by cla; 09 November 2014 at 10:19.
cla is offline  
Old 23 March 2015, 11:32   #26
cla
dev
 
cla's Avatar
 
Join Date: Aug 2014
Location: Copenhagen
Age: 48
Posts: 65
Send a message via ICQ to cla
Updated to 1.5.6

Most bugs seems to be gone.
cla is offline  
Old 18 April 2015, 03:54   #27
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
Quote:
Originally Posted by cla View Post
But since the last public available m68k version of GCC is 2.95.3 which (for good reasons) does not support c99 math I don't see how it is possible. The only solution to the c99 problem would be either some kind of hack or to buy a commercial product like StormC4, and then people wont be able to build the application themselves anyway.
A better solution than C99 math is to use a library which is portable, offers more precision and more functions than C99. One example is Mapm, which does arbitrary precision floating point math. It's quite slow, however. Another is Cephes, which has a large number of functions, and offers numerous fixed precision sizes, up to 384 bit. This is much faster than Mapm for, say, 100 decimal digits of precision (Cephes uses base 2, Mapm uses base 100). Cephes is also extremely easy to use (Mapm is more involved). Beware of it's sloooooooow factorial function, though. The gamma function is much faster (I use a table).

Both of these are extremely portable, and compile properly with SASC 6.58. Cephes is quite old, though, and has some pre-C89 crud in it (old style function prototypes which SASC doesn't like). It's also very easy to use only a subset of the Cephes files, and not compile the complete libraries.

I'm currently using Cephes' 384 bit floats with Lua 5.3.0, and it works great.

Cephes: https://github.com/jeremybarnes/cephes

Another alternative is to simply implement the math functions that are in C99 but that are missing in C89 yourself. For example, log2(x) is as easy as doing log(x) / log(2), where you can make log(2) a constant (you do log for any base by doing log(x) / log(base)).

Another example is acosh. You can do that by doing log(x + (x ^ 2 - 1) ^ 0.5).

Most of these will be very easy, and can be easily found by googling. Try googling 'mathworks asinh' to get the formula for asinh.

For a calculator there is absolutely no need to be stuck with C99 if you don't truly need it

Last edited by Thorham; 18 April 2015 at 04:07.
Thorham is offline  
Old 18 April 2015, 10:52   #28
cla
dev
 
cla's Avatar
 
Join Date: Aug 2014
Location: Copenhagen
Age: 48
Posts: 65
Send a message via ICQ to cla
Hi Thorham,

I took a look a at github. Cephes seems quiet interesting. Lua I don't know much about - actually I only know it from the plugin system in World of Warcraft

About the level in amath:

It is intended to be an entry level math program targeted at primary school and high school students/pupils. I try to keep the syntax as close to the one used in mathematics.

Amath is not targeted at professionals and never will be. Advanced statistical and mathematical software solutions like SPSS, MatLab and Marple fulfill the needs of those people. And lets face it, most common people don't understand math anyway and will be perfectly happy using a pocket calculator with buttons.

The next releases will focus on portability and I will definitely take a closer look at Cephes.

Thanx.
cla is offline  
Old 18 April 2015, 23:37   #29
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
Quote:
Originally Posted by cla View Post
Lua I don't know much about - actually I only know it from the plugin system in World of Warcraft
It's a powerful embeddable script language. Easy to extend, highly portable (latest version compiles with SASC) and fast. Comes with a stand alone interpreter (works just like a calculator).

Quote:
Originally Posted by cla View Post
It is intended to be an entry level math program targeted at primary school and high school students/pupils. I try to keep the syntax as close to the one used in mathematics.
Then you may want to take a look at SpeedCrunch for the peecee (great calculator, but not complicated and bloated with features you don't want). Would be nice if AmigaOs has something that could match it. Lua+Cephes can match it, but there are some minor issues with that.
Thorham is offline  
Old 20 April 2015, 20:30   #30
cla
dev
 
cla's Avatar
 
Join Date: Aug 2014
Location: Copenhagen
Age: 48
Posts: 65
Send a message via ICQ to cla
Quote:
Originally Posted by Thorham View Post
It's a powerful embeddable script language. Easy to extend, highly portable (latest version compiles with SASC) and fast. Comes with a stand alone interpreter (works just like a calculator).
I don't doubt it. Powerful languages often have a multitude of purposes.

Quote:
Then you may want to take a look at SpeedCrunch for the peecee (great calculator, but not complicated and bloated with features you don't want). Would be nice if AmigaOs has something that could match it. Lua+Cephes can match it, but there are some minor issues with that.
I think its probably over my head with the GUI being build in Qt. It does look very good though.
cla is offline  
Old 20 April 2015, 20:33   #31
cla
dev
 
cla's Avatar
 
Join Date: Aug 2014
Location: Copenhagen
Age: 48
Posts: 65
Send a message via ICQ to cla
Quote:
Originally Posted by phx View Post
Linking of vbccm68k and gcc-m68k object files is theoretically possible. AFAIK the ABI is identical (I seem to remember it was ok with gcc 2.95.x). Maybe newer gcc ports no longer follow the AmigaOS ABI, but return pointers in a0 or double in d0/d1, as defined by the M68k System V.4 ABI, but I didn't check that. d0/d1, a0/a1 and fp0/fp1 are scratch registers in both. Arguments are passed on the stack. Gcc precedes function names by an underscore in a.out format, like Amiga compilers do in hunk format.
Only problem is the different naming scheme of support functions (like 64-bit arithmetics or soft float). You would have to write stub-functions to make that link.
Im still struggling a bit with all this (de)mangling and linking stuff. Having a Delphi and .NET background I am surprised how difficult it is to get it to work.
cla is offline  
Old 20 April 2015, 20:37   #32
cla
dev
 
cla's Avatar
 
Join Date: Aug 2014
Location: Copenhagen
Age: 48
Posts: 65
Send a message via ICQ to cla
Quote:
Originally Posted by matthey View Post
That is GCC 2.95.3 which generates very good 68k Amiga code. The integer code generation is top notch (possibly the best of any Amiga compiler) but the math support is ancient and the 68040+ FPU code is incomplete. GCC 3.4.x isn't much better for floating point support and it's a little bit worse at integer generation. Maybe GCC 4.x (cross compiler only) has better c99 math support which would be easier for you. There is no Amiga hunk output (or Amiga specific support) but some programmers have successfully created Amiga hunk executables with GCC 4.x (probably with an ELF2HUNK converter?). That may be the only option to get Amiga C++ and c99 fp math functions. Vbcc should have all the c99 math functions you listed for direct 68k FPU code generation only but of course no C++. Maybe 68k and Amiga developer support and tools will improve if we get enough new 68k Amiga fpga hardware.
I think the netsuft toolchain now support cross-compiling with GCC4 to 68k hunks:
http://git.netsurf-browser.org/toolchains.git/

I haven't been able to get it work though. I think building on Debian is supported by the build scripts.
cla is offline  
Old 20 April 2015, 22:05   #33
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
Quote:
Originally Posted by cla View Post
I think its probably over my head with the GUI being build in Qt. It does look very good though.
I actually meant the functionality and interactivity. I find I can often get some good ideas for functions and options by looking at peecee programs. Peecee programs are often ahead of equivalent Amiga programs, but functions can often be copied. The way it looks doesn't matter (who cares if a powerful calculator looks boring).
Thorham is offline  
Old 23 December 2017, 20:26   #34
cla
dev
 
cla's Avatar
 
Join Date: Aug 2014
Location: Copenhagen
Age: 48
Posts: 65
Send a message via ICQ to cla
Package updated to 1.8.3. Now runs on several systems and have its own page:
https://amath.innolan.net
cla is offline  
Old 30 December 2017, 13:58   #35
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
Have you considered using ARexx and the rexxmathlib.library? They offer bignum support, high precision and transcendental functions and are part of every AmigaOS installation. http://wiki.amigaos.net/wiki/AmigaOS...rary_Functions
idrougge is offline  
Old 30 December 2017, 15:00   #36
cla
dev
 
cla's Avatar
 
Join Date: Aug 2014
Location: Copenhagen
Age: 48
Posts: 65
Send a message via ICQ to cla
Quote:
Originally Posted by idrougge View Post
Have you considered using ARexx and the rexxmathlib.library? They offer bignum support, high precision and transcendental functions and are part of every AmigaOS installation. http://wiki.amigaos.net/wiki/AmigaOS...rary_Functions
I haven't considered those libraries but it seems like a good idea. Earlier I was considering bypassing gcc and use the mathieeedoubbasbase library directly. Regardless the current solution is too sensitive to CPU architecture and is definitely not viable.

Also, the 1.8.3 release for AmigaOS 68k is apparently defunct. Just realized it yesterday. If anyone is reading this, use 1.8.0 instead.

Sorry about the troubles is might have caused you.
cla is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
BPM calculator for Octamed? lordofchaos request.Apps 4 29 May 2013 19:46
Speccy on Ti-89 calculator Fred the Fop Retrogaming General Discussion 3 27 January 2007 02:30
Vintage 1970's Commodore Calculator Steve Retrogaming General Discussion 7 05 February 2003 10:30

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 15:13.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09333 seconds with 15 queries