Inform 7 allows arithmetic to be carried out in respect of integer numbers only. By way of an experiment (and for the sheer joy of creating something) I have written an extension to permit fixed point maths. It is still in beta form and can be tested on the following link:
http://prolixic.inform7.googlepages.com/FloatingPointMaths.i7x
Some words of warning:
- I am a lawyer and priest by training, not a mathematician or computer programmer so some of the functions may need refining. Most of the functions are calculated using brute force and ignorance.
- Error checking routines have not yet been added so things like division by 0, overflows, underflows and square roots of negative numbers have not been trapped.
- The extension requires the use of Glulx.
- It is set up for four decimal places. This can be changed but it requires editing the extension. Only numbers in the range -214748.3648 to 214748.3647 are supported.
- Documentation has to be added.
Advertisement

Leave a comment
Comments feed for this article