Comments (1)
Thanks for your feedback, mathias. I'm planning to include double-precision 64-bit IEEE 754 floating point numbers. This opens many questions of how and when to convert between fp and integers (probably always explicitly).
To implement a new type like TAG_FLOAT, you need to:
- add a TAG_FLOAT constant in minilisp.h (they are currently power-of-two-ints, but this can be changed except for TAG_MARK which has to be a bit)
- add alloc_float(double f) function in alloc.h / alloc.c (you can copy stuff from alloc_int)
- add a state PST_FLOAT in reader.h and switch from PST_NUM or PST_ATOM to PST_FLOAT in reader.c when a '.' is encountered
- implement PST_FLOAT parser in reader.c (which calls alloc_float with the parsed number)
- implement PST_FLOAT printing in writer.c
- probably implement load_float in compiler_new.c analog to load_int (maybe triggering a refactor to make load_int/_cell/_float more compact). alternatively first always use boxed floats to make things simpler. then you would only need to expand load_int to coerce a float cell to an integer.
- introduce BUILTIN_FADD / _FSUB / _FMUL / FDIV cases in compiler_new.c and jit*.c and register those constants in compiler_new.h enum builtin_t
I think that should be about it! :)
About division by zero: I'll look into this, it is platform specific, and there are 4 more exceptions on floating point hardware.
Cheers
Lukas
from interim.
Related Issues (16)
- Glichtin' HOT 2
- Completion of error handling HOT 4
- Wrong stack alignment when calling out to libraries HOT 5
- rpi2-build.sh missing libuspi compilation step HOT 2
- Missing proper support for configurable keymaps HOT 1
- Mailing list is inaccessible HOT 3
- Sledge graphical mode on OS X segfaults HOT 7
- Cannot boot properly into self-built Raspberry image HOT 5
- Picture in README is almost entirely black HOT 2
- SDL1 port no longer compiles on Open Pandora HOT 3
- SDL1 port segfaults on the Open Pandora (ARMv7 TI Cortex-A8) HOT 4
- Graphical Mode is not launching HOT 1
- w3m tiling wm HOT 2
- Segmentation fault running hosted on arch linux
- rpi2-build.sh fails to run
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from interim.