Normal Topic More decimal places? (Read 1591 times)
Bill in NY
Member
*
Offline



Posts: 3
Joined: Jan 6th, 2015
More decimal places?
Jan 7th, 2015 at 10:46am
Print Post Print Post  
All,

      I've searched the forum and can't find the answer to this issue:
I need to store numbers to 12 decimal points (1 x 10^-12).  The number decimal options only allow to 8 decimal points.  Is there a way to expand that to 12?
     Also, is there a method in SBASIC to allow me to change modes (update, search, input)?  I see a method to query the current mode, but not change it.

Bill in Central NY
  
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: More decimal places?
Reply #1 - Jan 8th, 2015 at 4:22pm
Print Post Print Post  
First of all, I am curious about what industry, science, etc. needs accuracy to 12 decimal places?

Suggestion..Can you use two elements?  Use a text element to enter and display the 12 decimals, and then use @Number to display it in a Number element.  When doing any calculations, use @Number with each of the text elements and round it to 12 decimals to get your results.

Hmmm, but then I guess if the result has 12 decimals, how could you that?  Maybe convert the result to text before it is displayed?  Then put that result in the Text element with the @Number version in the Number element?

So, to total the numbers in elements 1 and 2 we do this:
TextAnswer =  ToText( Round(ToNumber(Text1) + ToNumber(Text2),12))
NumberAnswer = ToNumber(TextAnswer)

(Obviously would need the correct Sbasic syntax).
But all of this also depends on the internal number of decimals the program can handle.  Displaying is only part of the possible problem.  Can the Sesame math processor handle the extra accuracy?
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2483
Joined: Aug 20th, 2003
Re: More decimal places?
Reply #2 - Jan 8th, 2015 at 6:54pm
Print Post Print Post  
Doubles in Sbasic are limited to 8 decimal places as well. So you would need to store both the decimal and integer portions of the whole value in separate number fields and do the math on them individually.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Bill in NY
Member
*
Offline



Posts: 3
Joined: Jan 6th, 2015
Re: More decimal places?
Reply #3 - Jan 12th, 2015 at 11:22am
Print Post Print Post  
Bob_Hansen wrote on Jan 8th, 2015 at 4:22pm:
First of all, I am curious about what industry, science, etc. needs accuracy to 12 decimal places?


Bob,

      It's actually very mundane:  The application is an electronic parts database.  Capacitors are measured less than one...1 nanoFarad =1x10^-9, or 2.2picoFarad =2.2 x 1-^-12.  When sorting, I prefer to sort in actual numeric order, so .0001 comes before .00001.  The sort will also include items much greater than 1, such as resistors that can be 100s of millions. 

     Scientific notation won't work as it sorts on the prefix first.

     If there's no way to expand the number of decimals, can anyone think of a decent workaround?

     Also, I never heard anything about the other request:  can MODE be set programmatically?  I'd prefer to abandon the entire Sesame UI and replace it with a series of buttons.  To do this, I'd have to have a way to switch between Add_New, Search, and Update modes without using Sesame's UI.  Any ideas?

Bill in CNY
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: More decimal places?
Reply #4 - Jan 12th, 2015 at 3:06pm
Print Post Print Post  
The problem here isn't in binary storage, where Sesame uses IEEE double format and can hold 15-17 places with accuracy and many more with limited accuracy. The min / max for a positive double is:

2.2250738585072014e-308
and
1.7976931348623157e+308

The problem is in input and output representation. All programs that present or allow input of numbers must cut-off the precision at some point. The Windows default maximum is 9 digits of precision, Q&A (while storing numbers as strings and thereby having virtually no limit on represented precision) limits the precision in math to 12 digits. Sesame2 has 8 digits of precision both for presentation and input. Sesame3 has 16. As far as I know (and I work down the hall from support), your request is the first we have received for more than 8 in the 10 years we've been available.

Are you simply presenting and sorting using these numbers, or are they also used in calculations?

As to automating away the Sesame menus, there are many examples of doing so, including the "first look" application included with Sesame. Most use SelectTreeItem function to force Sesame between modes.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bill in NY
Member
*
Offline



Posts: 3
Joined: Jan 6th, 2015
Re: More decimal places?
Reply #5 - Jan 14th, 2015 at 9:53pm
Print Post Print Post  
Ray,

     Good suggestion.  I made two fields, one for prefix, one for multiplier (-3 for 10-3, -12 for 10-12, etc).  To sort as I need, I must sort on both fields, but it beats not being able to sort at all!


    And "Cow", these numbers are not used in any computation.  They exist solely for sorting purposes.
    Also, I tried using Selecttreeitem once and had marginal success.  THEN I found the list of precise command titles in the "2_1_ButtonMenus.pdf" document.  Using them, I made buttons for nearly every function I wanted.  If the logistics person of Lantica is listening, putting that command list in the Programmer's Guide would be very helpful.
     Thank you for the advice.  It will prove very valuable.

     I'm sure there'll be more to follow.

Bill in CNY
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: More decimal places?
Reply #6 - Jan 15th, 2015 at 3:11pm
Print Post Print Post  
Bill in NY wrote on Jan 14th, 2015 at 9:53pm:
If the logistics person of Lantica is listening, putting that command list in the Programmer's Guide would be very helpful.


In the Programming Editor, right-click.
Select List Browser.
Click the Switch button until you see the list of Menu Tree Items.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: More decimal places?
Reply #7 - Jan 15th, 2015 at 3:22pm
Print Post Print Post  
Bill in NY wrote on Jan 14th, 2015 at 9:53pm:
  If the logistics person of Lantica is listening...

Bill in CNY


Bill,

I can tell you from experience they are listening.

The group of people you are communicating with about SESAME, care more about their products and customers then any group of people I have ever met. You could not have chosen a better product to use, Besides Sesame being so powerful with so many great features and easy to use, you get a development/CS team that are always working to make it better and always putting "US" the customer first.

Welcome to the forum. Keep us posted on your progress.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged