sitegui / editorHP

Editor de texto para a HP50g
http://sitegui.com.br/editorHP
GNU General Public License v3.0
14 stars 2 forks source link

Equations with integrals are not shown correctly #38

Open ffpp2003 opened 2 months ago

ffpp2003 commented 2 months ago

Equations with integrals are not shown correctly. They all appear as [Erro na equação]

vcolella commented 2 months ago

How are you writing the equation ?

The example '∫(0, X, EXP(t), t)' works fine: image

ffpp2003 commented 2 months ago

On the emulator definitely works: image

But on the actual hardware it doesn't: image

Here are all the equations in that title:

'∫(-∞, ∞, f(τ)*µ(t-τ), τ) = ∫(-∞, t, f(τ), τ)'
'∞'
'∫(-∞, ∞, f(τ)*µ(t-τ), τ)'
'∫(0, X, EXP(t), t)'
'∫(0, X, EXP(t), t)'

btw, I'm using a local version of the repo that has pr 37 merged to fix the infinite syntax error. The same thing happens on the version available at sitegui.com.br/editorHP. I attached the output file. Resumenes.zip

The calculator is on rom 2.15

vcolella commented 2 months ago

Interesting, I don't have my 50G with me right now but will test as soon as I can. In the mean time, have you tried opening the file with another calculator ?

Corte0 commented 2 months ago

works fine on my 50G, rom 2.15 hp

ffpp2003 commented 2 months ago

Well, re flashed rom 2.15 with the 2mb fix and now everything works fine. But, when I enabled the "51 Fraction mark: ," flag it started doing the "erro na equãçao" again.

vcolella commented 1 month ago

when I enabled the "51 Fraction mark: ," flag it started doing the "erro na equãçao" again.

Nice catch 👍 Looks like by default the compiler uses . as fraction mark, considering the header %%HP: T(3)A(R)F(.);.

So your equation is saved as a string like : "'∫(-∞, ∞, f(τ)*µ(t-τ), τ) = ∫(-∞, t, f(τ), τ)'"

In order to recover the equation for displaying, this string is evaluated with STR→. When you change the calculator's fraction mark to , the expected argument separator becomes ;.

Since the equation is hardcoded with ,, STR→ fails and throws an error, bringing us to the "Erro na equação" message.

I think the quickest solution might be to implement a fraction mark option in the editor's GUI to appropriately save the equation's string.

vcolella commented 1 month ago

I did some more testing and it seems that simply change the comma separators for semicolon works just fine no matter how FLAG 51 is set. I'll try to implement this in a PR.