floating point representation

N

noreply

Guest
Dear all,
I have the following problem with the floating point representation.
(of course, i viewed the previous posts on the related subject and got
lot of info).
In my skill program, i manipulate the numbers(arithmetic calculations)
and pass it on as a parameter to the instance(in my case, the width of
the mosfet was the parameter).unfortunately most of the time, the
number turns out to be a floating point and i get the width of the
transistor to be like "0.8333333333333334" and this is really weird
when i pass it as a parameter to the mosfet.
I would prefer it to be looking like "0.83"(i prefer two digits after
the decimal point).How to go about this?
thanks and regards,
lokesh rajendran.
 
On Jun 29, 12:18 pm, I-F AB <cop0...@gmail.com> wrote:
Hi,
At the moment I can only recall:
atof( sprintf(nil "%5.2f" ggg) )
Which basically means 'convert to string format of certain decimal
places & convert string back to floating-point number.
I'm sure there's a more efficient way but can't remember it at the
moment.

Best regards,
I-FAB
Cool I-fab,
Its working....
If at all, you get the more efficient way,please do post.
Thanks and regards,
Lokesh rajendran
 
Hi,
At the moment I can only recall:
atof( sprintf(nil "%5.2f" ggg) )
Which basically means 'convert to string format of certain decimal
places & convert string back to floating-point number.
I'm sure there's a more efficient way but can't remember it at the
moment.

Best regards,
I-FAB
 

Welcome to EDABoard.com

Sponsor

Back
Top