Author Topic: 'Display Digits' in math.setEvalSettings()?  (Read 2781 times)

0 Members and 1 Guest are viewing this topic.

Offline Goran

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
'Display Digits' in math.setEvalSettings()?
« on: September 08, 2013, 09:39:50 am »
Hello,

I use math.setEvalSettings({{<key>,<value>}) to  control the appearance of results calculated by the math engine.

It works fine for all keys (e.g. 'Angle Mode', 'Real or Complex Format') except for 'Display Digits':
I always get the full precission, no matter what setting value I set (e.g. 'Fixed5').

In Lua Reference Manual it says:

"Note
All results from the TI-NspireTM math server are returned as full-precision ex-
pressions. If users want to limit the display digits, they must call math.getEvalSettings()
and apply the appropriate precision before displaying the value returned by the
TI-NspireTM math server."

Why they mention math.getEvalSettings()?
Isn't it enough to set the option directly with math.setEvalSettings(<setting>)?
As I said, for all other settings it works fine.

Regards,
Goran

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: 'Display Digits' in math.setEvalSettings()?
« Reply #1 on: September 08, 2013, 12:24:45 pm »
Hi,

I'll test later to see what the cause could be. Are you using math.eval or math.evalStr? If math.eval, could you try math.evalStr?
Maybe the setting doesn't get applied when it returns a Lua number.



Offline Goran

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Re: 'Display Digits' in math.setEvalSettings()?
« Reply #2 on: September 08, 2013, 02:21:09 pm »
Hello Jim,

it seems it doesn't matter: I get the same output for both math.eval() and math.evalStr().

BTW, when dealing with EvalSettings, what I've also noticed is the following:

a)
Lua Reference Manual:
"For user convenience, setEvalSettings also accepts the ordinal number of the setting
to override and the ordinal number of the value to use instead. The ordinal numbers to
use correspond to the order of the settings and their values found at File > Settings >
Document Settings."

When I go to File>Settings>Document Setting...>Calculation Mode, I see the options ordered as
Auto/Exact/Approximate (I understand 'Exact' setting is mapped to 2).

But when I math.setEvalSettings({{'Calculation Mode',2}}), I get the approximate output,
and when I math.setEvalSettings({{'Calculation Mode',3}}), I get the exact output

It reminds me to the false expectations that (not indexed) table entries are internally sorted
the same way the items were entered, and that table[1] will return the first item entered.

b) when you go to File>Settings>Document Setting...>Display Digits,
name of options are 'Fix1','Fix2',... but the proper option names are 'Fixed1','Fixed2',..

Is somewhere given the full list of the options strings, or we have to relly on the dialog settings names?

Regards,
Goran