integer to longreal 
Author Message
 integer to longreal

Does anyone out there know how to convert an integer to a longreal
(in modula2 ofcourse).

Thanks,



Sat, 03 Apr 1993 04:42:34 GMT  
 integer to longreal
On Mon, 15 Oct 90 20:42:34 GMT Durand Barry P said:

Quote:
>Does anyone out there know how to convert an integer to a longreal
>(in modula2 ofcourse).

>Thanks,

Well depends, which Modula 2 are you using?  Try looking at the
VAL procedure.

In TopSpeed it would be something like this:
      i: INTEGER;
      x: LONGREAL;
      ....
      x:= VAL(LONGREAL, i);

Of course some other version may (prob'ly will) do it differently.
You might also check the FLOAT procedure (in the "standard" (3th ed)
it's for converting CARDINAL to REAL).

Greg



Sat, 03 Apr 1993 22:25:21 GMT  
 integer to longreal
Greg,

Thanks for the information on the integer to longreal conversion in
modula2.  Not sure if it worked yet (am getting this info for a friend)
but I will tell you if it did.

Thanks,

Barry




Sun, 04 Apr 1993 04:41:50 GMT  
 integer to longreal
Hello Durand..

 DB> Newsgroups: comp.lang.modula2
 DB>
 DB> Does anyone out there know how to convert an integer to a longreal
 DB> in modula2 (obviously).
 DB>

It's very simple:

VAR i:INTEGER;
    l:LONGREAL;
...
    i:=10;    (* e.g. *)
    l:=LONGREAL(i);
    ^^^^^^^^^^^^^^^
...........

Tschss,
   Markus Maeder

--  
uucp: uunet!m2xenix!puddle!2!302!807.2!Markus.Maeder



Wed, 07 Apr 1993 23:49:54 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Using REAL/INTEGER or LONGREAL/LONGINT

2. Re (2): Using REAL/INTEGER or LONGREAL/LONGINT

3. INTEGER to LONGREAL

4. "D" in LONGREAL Constants

5. LONGREAL to string

6. Converting LONGREAL to string

7. LONGREAL Accuracy

8. LONGREAL constants

9. Near Final PEP 237 - Unifying Long Integers and Integers

10. Revised PEP 237 - Unifying Long Integers and Integers

11. integer/integer division

12. Q: How to typecast integer to array of integers

 

 
Powered by phpBB® Forum Software