Comments (5)
This is really super-weird. I get the exact same behaviour even I don't call the bid128_to_string
call but replace it with a much simpler snprintf
call:
char buf[MAXBIDCHAR];
uint32_t *ptr = (uint32_t *) #
snprintf(buf, MAXBIDCHAR-1, "%04X-%04X-%04X-%04X", ptr[0], ptr[1], ptr[2], ptr[3]);
Works like a charm on USB, hangs as soon as on batter power, and one of the strings generated by that code is produced.
from db48x.
It looks like the problem goes away if I do not move the __bid128
functions to the QSPI
@@ -63,7 +63,6 @@ SECTIONS
*(.rodata.bid_multipliers1_bid64)
*(.rodata.bid_multipliers2_binary128)
/* ===== Addition by c3d =================== */
- *(.text.__bid128*)
*(.fonts)
/* ======================== */
. = ALIGN(8);
So it looks like the problem derives from executing code from the QSPI.
from db48x.
Got a hang without waking off from power, right after flashing firmware.
Plugging USB back in got me out of the hang. The calculator was shut down, maybe because I had hit the off
button.
from db48x.
Doing a few more experiments, I am quite puzzled by the observed behavior. It looks like some specific functions in the Intel Binary Decimal library are causing the issue, and that can be as simple as rendering a number to text.
Here is the behaviour that I observe reliably:
-
Connected to USB power, everything runs fine. Notably, I can run
1 SIN
and see a result show up on screen. -
If I switch to battery power, then I can do operations on integer numbers, including operations that are complex and take some time, like multiplying large numbers. For exmaple, I can type
3 128 ^
and evaluate that, and I get the result. -
However, as soon as I start using fractional numbers, things go south. For example,
1.2 3.4 *
will hang -
The hang is a soft hang, which records key. For example, while hung, I can type
123
and then connect USB, and the123
will show up on screen. -
It is sufficient to have any floating-point number on the stack to see the problem. For example, if one has typed
1.2 3.4 *
, then the problem appears as soon as the calculator is on battery power. -
The number has to be a decimal128. If I type
1.2 3.4
and do not perform the computation, things are fine. In that case, the numbers are small enough to be stored as decimal32. However, multiplying them with the default34 Precision
will generate a decimal128, and that causes problem. -
It is sufficient and apparently necessary for the decimal128 to be displayed on stack. For example, if I type while on USB power
2 SIN
, then enter a sequence1 2 3 4 5 6 7 8 9 10 11 12
, and then switch to battery power, the calculator behaves well until theSIN
result shows up on screen. Then it hangs until plugged back on USB. -
It is not a matter of time of execution. I tested that with the two following programs:
« Ticks 1 10000 start next Ticks - Negate »
'Test' STO
« Ticks 1 100000 start next Ticks - Negate »
'Test2' STO
The first one executes in 76ms on USB, 199ms on battery. The second one is about 10 times longer. I can run both on battery reliably.
from db48x.
The problem persists if I replace the code to render decimal128
values with a straight call to bid128_to_string
without the wrapping code to format it. Also with a very large target buffer (256 bytes), which should be more than enough, notably because in that case there are at most about 42 characters.
// Align the value
bid128 num = value();
// Render in a separate buffer to avoid overflows
char buf[MAXBIDCHAR];
bid128_to_string(buf, &num.value);
record(decimal128, "Render raw output [%s]", buf);
#if 0
size_t sz = decimal_format(buf, sizeof(buf), r.editing());
record(decimal128, "Render formatted output [%s]", buf);
#else
size_t sz = strlen(buf);
#endif
// And return it to the caller
return r.put(buf, sz) ? sz : 0;
}
from db48x.
Related Issues (20)
- Ship the help pictures with the next release
- complex: Internal `Syntax error `when parsing parenthesized units HOT 1
- Update the SolvingMenu when variables change
- Keep power values integral in units
- tests: Occasional corruption of test output HOT 1
- solver: Make solver (im)precision more useful HOT 1
- units: Evaluate units that convert to real numbers
- menus: Add `R→D`, `D→R`, `→Polar` and `→Rectangular`
- Allow `ubase` to work on expressions
- `EvalEq` should not evaluate dates
- `IFTE` does not parse in equations HOT 1
- solver: Do not hide errors behind `Invalid function`
- units: Do not evaluate units during multiplication
- 48calc.org: Button are not correctly aligned
- Difference of two based numbers is not a based number HOT 1
- `6X-3` does not parse correctly
- help: Render shift keys correctly in the color version
- Error `Number too big` followed by updated value
- Enter and evaluating π
- Result of StandardDeviation is wrong
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 db48x.