I am creating an ABC formular thing that also displays how you do the maths.
I draw the text in the graph screen, but as you all know, you have to devide -b+√D by 2*A, so you would see something like (-b+√D)/(2A). Is there a possibility to make the fraction line as big as the text above it by setting the length to the width of the text?
I'm still looking for code that I'm sure people have created that computes the width of a string in small font pixels, but for now this table of character widths should help you:
https://www.cemetech.net/forum/viewtopic.php?t=11524
I believe there are 4 ways this could go depending on a few factors...

If you want to use libs and you are on the 83/84 monochromes, you can expr(Strχ then NumToString that and then check the length of the string and work with that.

If you are on the CE, you can do something similar without the use of libs by using ToString CE by MateoConLechuga

If you want to do it in pure basic (not suggested) Since the only thing that will affect the length of your string in a quadratic equation is the order of magnitude of each number, you could always, just check the order of magnitude of each variable with a repeat loop that increments a denominator by 1,10,100,etc. until it finds one that gives an answer≤1, however this may not be very efficient at all and would not work for decimals. For decimals, you could always round the number off to a certain precision to display it (not necessairely for the actual calculations Razz) which is what I did once (until I ended up changing it) but it is a big mess and would slow it down even more.

I know nothing of ASM, but I'm pretty sure there is a command that returns the actual length of a string rather than the number of tokens. Something like this maybe? But I'm assuming you are like me and don't know ASM and would therefore need someone to help you create/assemble such a program (if it even exists haha) hopefully someone with better knowledge of this will pop in and either tell me I'm dead wrong or help you out Very Happy Also, you may want to note that there are literally thousands of quadratic solver programs, and at least some of them are bound to have solved this issue. You may want to have a look at some of those. Looking at the work of others is to me the best way one can learn ti-basic
To expand on what Kerm was saying: you could add all pixel widths of each character together to see how long your fraction line should be. And make sure you don't forget to add in the extra pixel(s) of white space for each character, as noted in the link Kerm posted.
Thank you for all your help, I think that I'm going to make it count the amount of numbers there is in a string and then do that number times 3 + the standard icons like: root and ^2.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement