Re: detect emulator

2008-05-28 Thread Miguel Oyarzun
Try something like this...

 Err err;
 UInt32 value;
 Boolean emulator;

 err = FtrGet('pose', 0, value);
 if (err) {
  emulator = false;
 } else {
  emulator = true;
 }








-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/


Re: Display a float on screen

2008-05-28 Thread Miguel Oyarzun
Yup, look at the day-old thread titled [Q] Why is this difficult??? for
yet-another-post of the FloatToString function.  There is also this link
http://www.duckpond.mv.com/Ftp/Pilot/fp.c to another solution.

Dave Lippincott [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 You will have to write your own routine.  However, tons of code examples
 have been posted to this forum.  Search the archives. (I think there was
 code posted just yesterday)







-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/


Re: [Q] Why is this difficult???

2008-05-28 Thread Miguel Oyarzun
Here's yet-another-version of the FloatToString function posted to this
group.  It's not perfect (e.g. it does not handle large floats gracefully),
but it's a start.  I don't know who's the original author, but many thanks
to him/her.  I've added a fix (kludge?) to handle the case where rounding
propagates into the integral portion of the result.  I also modified it so
that it returns a pointer to the internal buffer that holds the result,
rather than copying the result into a buffer provided as an arg.  If you
find a better solution, please let us all know...

Miguel Oyarzun

P.S. If you want more of the history ot this function, search the group
archive for FloatToString...

P.P.S. Insert standard disclaimer about how this code is provided as is,
with no claims of correctness implied, and how if you use it and your
unmanned spaced vehicle fails to go into orbit because of it, it's not my
problem, etc, etc, etc...


char *FloatToString (double value, int round)
{
  static char sResult[50];
  static char sDecimal[50];
  char *sTemp = sResult;
  long iValue;
  double dDecimal;
  long iDecValue;
  long iTemp;
  int i;

  iValue = value;
  if( value  0 )
  {
dDecimal = -(value - iValue);

// Make sure that negative #s where -1  n  0
// get handled correctly.
if( 0 == iValue )
  StrCopy( sTemp++, - );
  }
  else
dDecimal = value - iValue;

  if (dDecimal  0.1) dDecimal = 0;

  // Round decimal portion
  for (i = 1; i = round; i++)
   dDecimal = dDecimal * 10;

  iDecValue = dDecimal;
  if (dDecimal - iDecValue = 0.5) iDecValue++;

  // Handle possible carry into integer portion
  iTemp = iDecValue;
  for (i = 1; i = round; i++)
   iTemp = iTemp / 10;
  if (iTemp == 1)
  {
   iValue += (iValue = 0) ? (1) : (-1);
   for (i = 1, iTemp = 1; i = round; i++)
iTemp = iTemp * 10;
   iDecValue = iDecValue - iTemp;
  }

  // Convert integer portion to string
  StrIToA( sTemp, iValue);
  if (StrLen(sTemp)  1) StrCopy(sTemp, 0);
  StrCat(sResult, .);

  // Add decimal portion
  StrIToA (sDecimal, iDecValue);

  // Add leading zeros if neccessary
  if (StrLen (sDecimal)  round)
  for (i = 1; i = round - StrLen(sDecimal); i++)
  StrCat (sResult, 0);
  StrCat (sResult, sDecimal);

 return sResult;
}

Jay [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]

 Of course this is the result from a computation and I would like to be
able
 to print the results  in a textfield.

 Jay


 Jay [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 
  Is it me? I am simply trying to print out in a textfield the number
 0.03421
  and I can't seem to do it.
  Can someone help?
 
  Jay
 
 
 
 









-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/


Re: Display a float on screen

2000-10-26 Thread Miguel Oyarzun

Yup, look at the day-old thread titled "[Q] Why is this difficult???" for
yet-another-post of the FloatToString function.  There is also this link
http://www.duckpond.mv.com/Ftp/Pilot/fp.c to another solution.

"Dave Lippincott" [EMAIL PROTECTED] wrote in message
news:28175@palm-dev-forum...

 You will have to write your own routine.  However, tons of code examples
 have been posted to this forum.  Search the archives. (I think there was
 code posted just yesterday)





-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/



Re: [Q] Why is this difficult???

2000-10-25 Thread Miguel Oyarzun

Here's yet-another-version of the FloatToString function posted to this
group.  It's not perfect (e.g. it does not handle large floats gracefully),
but it's a start.  I don't know who's the original author, but many thanks
to him/her.  I've added a fix (kludge?) to handle the case where rounding
propagates into the integral portion of the result.  I also modified it so
that it returns a pointer to the internal buffer that holds the result,
rather than copying the result into a buffer provided as an arg.  If you
find a better solution, please let us all know...

Miguel Oyarzun

P.S. If you want more of the history ot this function, search the group
archive for FloatToString...

P.P.S. Insert standard disclaimer about how this code is provided as is,
with no claims of correctness implied, and how if you use it and your
unmanned spaced vehicle fails to go into orbit because of it, it's not my
problem, etc, etc, etc...


char *FloatToString (double value, int round)
{
  static char sResult[50];
  static char sDecimal[50];
  char *sTemp = sResult;
  long iValue;
  double dDecimal;
  long iDecValue;
  long iTemp;
  int i;

  iValue = value;
  if( value  0 )
  {
dDecimal = -(value - iValue);

// Make sure that negative #s where -1  n  0
// get handled correctly.
if( 0 == iValue )
  StrCopy( sTemp++, "-" );
  }
  else
dDecimal = value - iValue;

  if (dDecimal  0.1) dDecimal = 0;

  // Round decimal portion
  for (i = 1; i = round; i++)
   dDecimal = dDecimal * 10;

  iDecValue = dDecimal;
  if (dDecimal - iDecValue = 0.5) iDecValue++;

  // Handle possible carry into integer portion
  iTemp = iDecValue;
  for (i = 1; i = round; i++)
   iTemp = iTemp / 10;
  if (iTemp == 1)
  {
   iValue += (iValue = 0) ? (1) : (-1);
   for (i = 1, iTemp = 1; i = round; i++)
iTemp = iTemp * 10;
   iDecValue = iDecValue - iTemp;
  }

  // Convert integer portion to string
  StrIToA( sTemp, iValue);
  if (StrLen(sTemp)  1) StrCopy(sTemp, "0");
  StrCat(sResult, ".");

  // Add decimal portion
  StrIToA (sDecimal, iDecValue);

  // Add leading zeros if neccessary
  if (StrLen (sDecimal)  round)
  for (i = 1; i = round - StrLen(sDecimal); i++)
  StrCat (sResult, "0");
  StrCat (sResult, sDecimal);

 return sResult;
}

"Jay" [EMAIL PROTECTED] wrote in message news:27995@palm-dev-forum...

 Of course this is the result from a computation and I would like to be
able
 to print the results  in a textfield.

 Jay


 "Jay" [EMAIL PROTECTED] wrote in message news:27991@palm-dev-forum...
 
  Is it me? I am simply trying to print out in a textfield the number
 0.03421
  and I can't seem to do it.
  Can someone help?
 
  Jay
 
 
 
 







-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/