Re: Print, 34000/340000 results 0? what ́s wrong? [message #38917] |
Mon, 05 April 2004 07:57 |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
Thomas Nehls wrote:
>
> Hi folks,
>
> I tried to calculate something and found out that something must be
> wrong... I also tried Float and so on...
Nothing's wrong; according to the rules for integer arithmetic,
34000/340000 is 0, so it printed out exactly the correct result. If you
divided 34000.0/340000, then it should give you a 0.1. But you said that
you tried Float, and it didn't work? Perhaps you tried one of the
following:
PRINT,FLOAT(34000/340000)
PRINT,FORMAT="(F)",34000/340000
Neither of those would give you what you want. The division occurs
first, producing a 0, which is then converted to floating point. On the
other hand:
PRINT,FLOAT(34000)/340000
should do precisely what you want.
|
|
|
Re: Print, 34000/340000 results 0? what ́s wrong? [message #38922 is a reply to message #38917] |
Mon, 05 April 2004 05:28  |
marcuirl
Messages: 14 Registered: December 2003
|
Junior Member |
|
|
Thomas Nehls <thomas.nehls@tu-berlin.de> writes:
> Hi folks,
>
> I tried to calculate something and found out that something must be
> wrong... I also tried Float and so on...
> Where is my mistake?
34000/340000.
^^^
Try that!
marcu
--
Unless otherwise noted, the statements herein reflect my
personal opinions and not those of any organisation with
which I may be affiliated.
|
|
|