Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Conversion between int and float

Conversion between int and float 23 Oct 2001 12:34 #6010

From the standard, it seems that there expressions like 3 + 1.2 or 5.4 > 0
are not allowed because these operators expect both operands to be of the
same (base) type. So, I guess there should be means to convert between int
and float values, but these seem to have been forgotten in the standard.

I would propose to add the functions ceil, floor, and round to the set of
predefined functions, which provide the corresponding conversion. Also, it
might be a good idea to have a function that turns an int into the float
with the same value, e.g., 50 -> 50.0 . I can't think of a good name for it,
though.

Regards

Olle




Telelogic Tau 4.2 speeds up your wireless development!
Read more about it at www.telelogic.com/tau42

Olle Palmgren
Director of Engineering, PD Test
Telelogic, St Persgatan 13, SE-753 20, Uppsala, Sweden
Phone: +46 18 66 18 59
Fax: +46 18 66 18 70
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.telelogic.com

Telelogic - Putting you ahead in software development!

The administrator has disabled public write access.

Conversion between int and float 23 Oct 2001 15:19 #6015

In einer eMail vom 10/23/01 2:41:12 PM W. Europe Daylight Time schreibt
This email address is being protected from spambots. You need JavaScript enabled to view it.:

Hi Olle,


>
> From the standard, it seems that there expressions like 3 + 1.2 or 5.4 > 0
> are not allowed because these operators expect both operands to be of the
> same (base) type. So, I guess there should be means to convert between int
> and float values, but these seem to have been forgotten in the standard.
>
> I would propose to add the functions ceil, floor, and round to the set of
> predefined functions, which provide the corresponding conversion. Also, it
> might be a good idea to have a function that turns an int into the float
> with the same value, e.g., 50 -> 50.0 . I can't think of a good name for it,
> though.
>

How about int2float and float2int?

Cheers,

Claude.


> Regards
>
> Olle
>
>
>
>
The administrator has disabled public write access.

Conversion between int and float 23 Oct 2001 16:14 #6016

int2float and float2int are already standardised in TS 101 875 (additional
predefined functions for TTCN-3).

Regards
Anthony




Original Message
From: Claude Desroches [This email address is being protected from spambots. You need JavaScript enabled to view it.]
Sent: 23 October 2001 17:20
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Conversion between int and float


In einer eMail vom 10/23/01 2:41:12 PM W. Europe Daylight Time schreibt
This email address is being protected from spambots. You need JavaScript enabled to view it.:

Hi Olle,





From the standard, it seems that there expressions like 3 + 1.2 or 5.4 > 0
are not allowed because these operators expect both operands to be of the
same (base) type. So, I guess there should be means to convert between int
and float values, but these seem to have been forgotten in the standard.

I would propose to add the functions ceil, floor, and round to the set of
predefined functions, which provide the corresponding conversion. Also, it
might be a good idea to have a function that turns an int into the float
with the same value, e.g., 50 -> 50.0 . I can't think of a good name for it,

though.




How about int2float and float2int?

Cheers,

Claude.




Regards

Olle
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin