Hi, I'm new in this kind of conversions, i need write code in java to convert a csv file in 8xl (List) and 8xm(Matrix), could you please help with some reference about this, I'm very confused Sad
I split this topic for you.

Where are you confused? How much have you coded so far? Are you getting any errors? We'll need more information going forward to understand where you need help - and how to help.
wizzynoise wrote:
Hi, I'm new in this kind of conversions, i need write code in java to convert a csv file in 8xl (List) and 8xm(Matrix), could you please help with some reference about this, I'm very confused Sad


You want to start here: http://www.ticalc.org/archives/files/fileinfo/247/24750.html

It's a bit dense and quite comprehensive so you'll have to read it very carefully.

You can also take a look at this toolkit used to package games with many subprograms. The packer portion is written in Java and can help lead you along to the solution you are looking for.
Thank you very much, I'm reading the sdk83guide.pdf in and found both type of files have floating-point number format as follow:
T EXP Mantissa
80 82 23 45 00 00 00 00 00 = -234.5

I don't understand this format, i read about IEE standar but i don't found a similar format, exits 16,32,128bits, etc. , I think that I should convert every entry (csv file) in this format and then create the output file, but I'm not sure how generate the file.
wizzynoise wrote:
Thank you very much, I'm reading the sdk83guide.pdf in and found both type of files have floating-point number format as follow:
T EXP Mantissa
80 82 23 45 00 00 00 00 00 = -234.5

I don't understand this format, i read about IEE standar but i don't found a similar format, exits 16,32,128bits, etc. , I think that I should convert every entry (csv file) in this format and then create the output file, but I'm not sure how generate the file.


For further understanding of TI's floating point format, you may want to read this: http://tutorials.eeems.ca/ASMin28Days/lesson/day18.html

It might help to read this article while you're at it, since much of the mantissa is stored that way: http://en.wikipedia.org/wiki/Binary-coded_decimal

And now to answer your actual concerns... sorta. Those would've been answered had you actually read the resources I linked to you. Something tells me you didn't even bother, otherwise you'd know the file format of a calculator variable as stored on PC, and you'd be asking me more pointed questions about the Java source I linked.

If you're stumped on Java file I/O, you'll want to Google the File/FileOutputStream classes, tho I've used FileWriter to no ill effect. FileReader for reading in the CSV file.
Thank you Iambian, I have formatted a real number, i'm tried to create a list with all number with the follow format:
My doubt is if i need create a array of byte first with the number of elements on the list and then for every number , this will be my L1?
my other concert for example how can get the LSB & MSB for the number of elements, for example 999 i'm try to ge with:
int val = 999;
byte[] newer = new byte[2];
newer[0] = (byte)(val & 0xFF); //MSB Result -45
newer[1] = (byte)((val >> Cool & 0xFF); //LSB Result 0
System.out.println(newer[0]);
System.out.println(newer[1]);
but I expect 09 99 , what I'm doing wrong?
wizzynoise wrote:
Thank you Iambian, I have formatted a real number, i'm tried to create a list with all number with the follow format:
My doubt is if i need create a array of byte first with the number of elements on the list and then for every number , this will be my L1?
my other concert for example how can get the LSB & MSB for the number of elements, for example 999 i'm try to ge with:
int val = 999;
byte[] newer = new byte[2];
newer[0] = (byte)(val & 0xFF); //MSB Result -45
newer[1] = (byte)((val >> Cool & 0xFF); //LSB Result 0
System.out.println(newer[0]);
System.out.println(newer[1]);
but I expect 09 99 , what I'm doing wrong?


The code is not correct. You're not doing any sort of BCD conversions, and if you searched for that you may have gotten some hints. What you're actually doing is prying apart the int as-is.

999 == 0x3E7

That's the value that you're trying to store. The comments in the code are also so completely wrong, it's not funny. You're storing LSB-first, and the results you claim you're getting are not what you're getting, so whatever you're doing to read the values is wrong as well.

Also, if you're trying to go for TI's floating point format, you have to keep track of two other bytes, one being sign/type and the other being exponent. I can see you probably haven't gotten that far yet but don't forget them.

What you'll want to do is extract each digit from your int at a time and combine them into your mantissa. Here's something to help you get started with that:

Code:
// Algo: (number % 10^(digit))/(10^(digit-1))
// Note: Relies on integer division behavior of dropping results < 0
// number = 0 to Integer.MAX_VALUE
// digit  = 1 to 9
// returns an integer value from 0 to 9

static int extractDigit(int number,int digit)
{
  int result = number % pten(digit);
  if (digit > 1) result = result / pten(digit-1);
  return result;
}

static int pten(int exponent)
{
  int var = 10;
  for(int i=1;i<exponent;i++) var = var*10;
  return var;
}

Note: This code is untested. I think this works. Not sure.

Also, please use the [ CODE ] tag to enclose any code. It makes it much easier to read, both by formatting it in an easier-to-read manner, and by removing any possibility of your code turning into an emoticon.
  
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