×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
On Tue, 3 Apr 2007, Douglas Palme wrote:
I have a need to convert a floating point to an integer and have run into a
problem.
The float is declared as an 8f
I thought I could use something like the following:
Eval myint = %int(float)
But it ends up with a zero value..even though the float shows something like
2.234586785678E-28
This makes sense since 2.234586785678 times 10 to the -28 power is a very
small number indeed. Rounding to the closest integer gives you zero. But
I'm guessing that you want to use the significant portion of the floating
point number and treat that as if it were an integer. There's a problem
with that, and that is that floating point numbers are not exact, so how
do you convert it to an exact integer? You can't, not without some
rounding. Probably the best you can do is multiply by 10 to the 28 power
to get 2.234586785678 and then multiply by some power of ten again to get
number of significant digits you want.
James Rich
It's not the software that's free; it's you.
- billyskank on Groklaw
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.