Looking for floating point libraries
Looking for floating point libraries
As title.
I already know of:
- Wozniak & Rankin's one from Dr. Dobbs in 1976 (4-byte binary, difficult copyright licensing/issues)
- Microsoft's one in their BASIC (no license)
- Acorn's in their BASIC (no license)
- the Atari MATHPACK clone from Altirra (GPL; 6-byte BCD)
- the C64-compatible routines from the X16 kernal replacement (mostly copied from Microsoft, AFAICT)
- Louis Chorich's Atari floating point library (commercial, 6-byte, presumably BCD but the docs don't say)
- Apple's SANE (source lost)
- Some Random Internet Guy's library (no license, 5-byte BCD, no negative numbers)
Anyone know of more?
I already know of:
- Wozniak & Rankin's one from Dr. Dobbs in 1976 (4-byte binary, difficult copyright licensing/issues)
- Microsoft's one in their BASIC (no license)
- Acorn's in their BASIC (no license)
- the Atari MATHPACK clone from Altirra (GPL; 6-byte BCD)
- the C64-compatible routines from the X16 kernal replacement (mostly copied from Microsoft, AFAICT)
- Louis Chorich's Atari floating point library (commercial, 6-byte, presumably BCD but the docs don't say)
- Apple's SANE (source lost)
- Some Random Internet Guy's library (no license, 5-byte BCD, no negative numbers)
Anyone know of more?
Re: Looking for floating point libraries
I wrote some floating point routines earlier this year, I'm not sure if they count as a library though. I think I posted it on Stardot as it was using the BBC BASIC assembler, and had routines to load values from BASIC variables. I only implemented the basics though (addition, subtraction, multiplication). I made a two byte version and a three byte version. The API was load-store register-based, a bit like ARM I guess.
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: Looking for floating point libraries
viewtopic.php?p=45404#p45404
... leading to
https://web.archive.org/web/20170923012 ... 80/fpu.txt
https://web.archive.org/web/20210418053 ... calc65.htm
... leading to
https://web.archive.org/web/20170923012 ... 80/fpu.txt
https://web.archive.org/web/20210418053 ... calc65.htm
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!
Mike B. (about me) (learning how to github)
Mike B. (about me) (learning how to github)
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Looking for floating point libraries
For the 65C816: http://forum.6502.org/viewtopic.php?f=2&t=4133
x86? We ain't got no x86. We don't NEED no stinking x86!
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Looking for floating point libraries
barrym95838 wrote:
http://65xx.unet.bz/fpu.txt opens for me.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: Looking for floating point libraries
Here's another one, written this decade: https://hackaday.io/project/181098-home ... r-for-6502 32-bit BCD, no license (but unusually, the author can be contacted without the use of a spirit medium!).
Re: Looking for floating point libraries
https://web.archive.org/web/20200128060 ... calc65.htm: 64-bit BCD, full set of trigonometric functions... no license and 'all rights reserved'.
Re: Looking for floating point libraries
Hi!
The Altirra ROM replacement is not under the GPL, but under the MIT license, much more permissive.
The VBCC 6502 compiler uses those, and includes a library with all the split objects.
The Mad Pascal compiler (at https://github.com/tebe6502/Mad-Pascal ) includes:
- 32-bit FLOAT: https://github.com/tebe6502/Mad-Pascal/ ... single.asm
- 16-bit FLOAT: https://github.com/tebe6502/Mad-Pascal/ ... dd_sub.asm and other files.
Have Fun!
hjalfi wrote:
As title.
I already know of:
- Wozniak & Rankin's one from Dr. Dobbs in 1976 (4-byte binary, difficult copyright licensing/issues)
- Microsoft's one in their BASIC (no license)
- Acorn's in their BASIC (no license)
- the Atari MATHPACK clone from Altirra (GPL; 6-byte BCD)
I already know of:
- Wozniak & Rankin's one from Dr. Dobbs in 1976 (4-byte binary, difficult copyright licensing/issues)
- Microsoft's one in their BASIC (no license)
- Acorn's in their BASIC (no license)
- the Atari MATHPACK clone from Altirra (GPL; 6-byte BCD)
hjalfi wrote:
- the C64-compatible routines from the X16 kernal replacement (mostly copied from Microsoft, AFAICT)
- Louis Chorich's Atari floating point library (commercial, 6-byte, presumably BCD but the docs don't say)
- Apple's SANE (source lost)
- Louis Chorich's Atari floating point library (commercial, 6-byte, presumably BCD but the docs don't say)
- Apple's SANE (source lost)
Quote:
- Some Random Internet Guy's library (no license, 5-byte BCD, no negative numbers)
Anyone know of more?
Anyone know of more?
- 32-bit FLOAT: https://github.com/tebe6502/Mad-Pascal/ ... single.asm
- 16-bit FLOAT: https://github.com/tebe6502/Mad-Pascal/ ... dd_sub.asm and other files.
Have Fun!
Re: Looking for floating point libraries
dmsc wrote:
The Altirra ROM replacement is not under the GPL, but under the MIT license, much more permissive.
dmsc wrote:
The Mad Pascal compiler (at https://github.com/tebe6502/Mad-Pascal ) includes:
- 32-bit FLOAT: https://github.com/tebe6502/Mad-Pascal/ ... single.asm
- 16-bit FLOAT: https://github.com/tebe6502/Mad-Pascal/ ... dd_sub.asm and other files.
- 32-bit FLOAT: https://github.com/tebe6502/Mad-Pascal/ ... single.asm
- 16-bit FLOAT: https://github.com/tebe6502/Mad-Pascal/ ... dd_sub.asm and other files.
Re: Looking for floating point libraries
Here's a standards-compliant implementation. Only compiles on llvm-mos as far as I know.
https://github.com/rweather/berkeley-softfloat-3-6502
https://github.com/rweather/berkeley-softfloat-3-6502
Re: Looking for floating point libraries
I know you want something with a permissive license.
I am not a patent lawyer and I do not play one on television; if you were to paraphrase code from one processor architecture to a different one, is the result considered to be infringing? If not, that may be a relatively easy way to get there. I have always presumed that to be safe; it is not unlike coding from an algorithm in a book or journal.
Floating point code has been published for the Motorola 8-bit processors. Same for 8080/Z80. Source code for 8087 emulation from the Borland compilers (80x86) is also out there.
Are you picky between BCD versus binary?
A long time ago, I set out to write IEEE 754 compliant floating point for the 6800. I have single precision generally working but have yet to work out how to implement the guard, round and sticky bits. Because the AVR instruction set looked so easy to program, I also built a version for that. Future steps:
* Figure out the guard, round and sticky bits
* Improve the speed
* Implement 6-byte, double and extended precision
* Port to other processors
I am not a patent lawyer and I do not play one on television; if you were to paraphrase code from one processor architecture to a different one, is the result considered to be infringing? If not, that may be a relatively easy way to get there. I have always presumed that to be safe; it is not unlike coding from an algorithm in a book or journal.
Floating point code has been published for the Motorola 8-bit processors. Same for 8080/Z80. Source code for 8087 emulation from the Borland compilers (80x86) is also out there.
Are you picky between BCD versus binary?
A long time ago, I set out to write IEEE 754 compliant floating point for the 6800. I have single precision generally working but have yet to work out how to implement the guard, round and sticky bits. Because the AVR instruction set looked so easy to program, I also built a version for that. Future steps:
* Figure out the guard, round and sticky bits
* Improve the speed
* Implement 6-byte, double and extended precision
* Port to other processors
Re: Looking for floating point libraries
johnwbyrd wrote:
Here's a standards-compliant implementation. Only compiles on llvm-mos as far as I know.
https://github.com/rweather/berkeley-softfloat-3-6502
https://github.com/rweather/berkeley-softfloat-3-6502
The idea if implementing floating point in a language that doesn't intrinsically support it [1] isn't new either - in the early 80's BCPL didn't support floating point either, but there were libraries - one I used was the package for the BBC Micros implementation of BCPL which supported various formats and previsions. FP numbers were held in vectors (arrays) and you called functions to do the FP operations.
https://www.computinghistory.org.uk/det ... s-Package/
-Gordon
[1] Yes, C supports floating point but cc65 doesn't, so it would have to be implemented by external means.
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: Looking for floating point libraries
BillG wrote:
I have single precision generally working but have yet to work out how to implement the guard, round and sticky bits.
Re: Looking for floating point libraries
I wrote some 32 bit single precision FP routines for VM02. Not much error handling. Search for FLOATING_POINT:
https://github.com/dschmenk/VM02/blob/master/src/ops.s
https://github.com/dschmenk/VM02/blob/master/src/ops.s
Re: Looking for floating point libraries
Chromatix wrote:
BillG wrote:
I have single precision generally working but have yet to work out how to implement the guard, round and sticky bits.