While working on rollback code and pack encryption, one of the biggest challenges has been getting numerical operations to behave identically across every supported platform. The goal is 100% determinism, right down to the smallest rounding difference. Getting there is harder than it sounds.
Since I needed a test application anyway, I figured I might as well make it a fully functioning scientific calculator. Bytes of Rage is the result.
Note: This module runs on an unreleased OpenBOR test build. Do not redistribute the engine copy. The features and script functions demonstrated here are still in development and may change before the official release.
Features on display include:
- Hardware graphics acceleration, with a native 1920 × 1080 interface.
- Script control of display size and fullscreen presentation, demonstrated through the resolution selector.
- Full keyboard and mouse support, including text entry, keyboard shortcuts, clickable controls, and mouse-wheel navigation.
- Deterministic conversions between supported numeric types and strings.
- Conversion validation, allowing scripts to detect invalid input and decide how to handle it before attempting a conversion.
Use
Open the module and type numbers or formulas with your keyboard, or click the calculator buttons with your mouse. Press Enter or click = to evaluate the expression.If you don’t have a keyboard or mouse - uhm, too bad. This is a testing project.
Some example formulas:
| Formula | Expected result | What it demonstrates |
|---|---|---|
| 2 + 3 * 4 | 14 | Multiplication takes priority over addition. |
| (2 + 3) * 4 | 20 | Parentheses change the order of operations. |
| sqrt(144) + 3^2 | 21 | Square roots and powers. |
| 5! | 120 | Factorial. |
| 200 * 10% | 20 | Percentages. |
| sin(30) | Approximately 0.5 | Trigonometry with DEG selected. |
| sin(pi / 2) | Approximately 1 | Trigonometry with RAD selected. |
| ln(e) | Approximately 1 | Natural logarithms and the built-in constant e. |
| ans * 2 | Twice your last answer | Reusing the last successful result. |
Select DEG or RAD before evaluating trigonometric formulas. F2 switches between them. Write multiplication explicitly, such as 2*pi or 2*(3+4).
MS stores the last successful result in memory; MR inserts that value into your expression. Click a history entry, or use Up/Down or the mouse wheel, to recall an earlier calculation.
Click CLEAR or press Escape to clear the expression. F1 opens the projection-size selector, and F10 exits the module.