Hi everybody!

I’m programming a scientific RPN-calculator for an ATTINY85 and a QYF-TM1638-board (8 digit LED display with 16 buttons).

So far the prototype works surprisingly good and is rich of features.

Now I ran out of memory (code size > 8k):

The attached code produces 7642 bytes and I want to add at least trigonometric functions (need approximately 1500 bytes) and if possible hyperbolic functions, some screensaver/sleep functions and other mathematical functions (ie. convert polar to rectangular coordinates and vice versa).

I spent many hours in avoiding libraries and followed many “code resizing hints”. But I’m not familiar what really costs bytes. So far I see only few possibilities to save code and can not evaluate if it is worth to go this ways:

- Reprogram EEPROM.h (did not find hints how to code this)
- Using few flag variables (instead of boolean-bytes) and manipulate their bits (&|~).
- Reducing the number of used mathematical functions (i.e. exp(0.5*log(x)) instead of sqrt(x))
- Using own written taylor series instead of mathematical functions

I would really appreciate any idea or hint to save bytes.

As the code is “slow-moving” on the ATTINY I would appreciate hints for speeding up too.

Thanks in advance for any help and regards

deetee

sarc.ino (23.2 KB)