Re: What is a type error?
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.fortran Profile…
 Up
Re: What is a type error?         


Author: David Hopwood
Date: Jul 12, 2006 16:17

Marshall wrote:
> Joachim Durchholz wrote:
[...]
>>Preconditions/postconditions can express anything you want, and they are
>>an absolutely natural extensions of what's commonly called a type
>>(actually the more powerful type systems have quite a broad overlap with
>>assertions).
>>I'd essentially want to have an assertion language, with primitives for
>>type expressions.
>
> Now, I'm not fully up to speed on DBC. The contract specifications,
> these are specified statically, but checked dynamically, is that
> right? In other words, we can consider contracts in light of
> inheritance, but the actual verification and checking happens
> at runtime, yes?

For DBC as implemented in Eiffel, yes.
> Wouldn't it be possible to do them at compile time? (Although
> this raises decidability issues.)

It is certainly possible to prove statically that some assertions cannot fail.
Show full article (1.85Kb)
23 Comments
Re: Viewing Double Prescision reals as Integers         


Author: David Flower
Date: Jul 25, 2006 12:14

ferrad wrote:
> Say I have a common:
>
> double precision r1
> common /doubint/ r1
>
> and another common elsewhere:
>
> integer i1, i2
> common /doubint/ i1, i2
>
> Then will the two halves of the variable r1 always translate into valid
> integers in i1 and i2? Or are there 'NaN' equivalents in the integer
> world?

Normally, you can determine this from the valid values for am integer.

Foer example, a two byte INTEGER can normally have values in the
inclusive range:
-32768 to 32767 which comprises 2**16 numbers.

It follows that all bit patterns must represent valid numbers.
Show full article (0.71Kb)
2 Comments
Re: Viewing Double Prescision reals as Integers         


Author: dpb
Date: Jul 25, 2006 12:16

ferrad wrote:
> Say I have a common:
>
> double precision r1
> common /doubint/ r1
>
> and another common elsewhere:
>
> integer i1, i2
> common /doubint/ i1, i2
>
> Then will the two halves of the variable r1 always translate into valid
> integers in i1 and i2? Or are there 'NaN' equivalents in the integer
> world?

The two integers will always be valid integers, but their value will be
whatever the bit pattern represents if stored via as floating point
value.

Of course, if you try to operate arithmetically on those integers you
could easily get integer overflow or other symptoms at that point...
no comments
Re: Viewing Double Prescision reals as Integers         


Author: Rich Townsend
Date: Jul 25, 2006 12:24

David Flower wrote:
> ferrad wrote:
>> Say I have a common:
>>
>> double precision r1
>> common /doubint/ r1
>>
>> and another common elsewhere:
>>
>> integer i1, i2
>> common /doubint/ i1, i2
>>
>> Then will the two halves of the variable r1 always translate into valid
>> integers in i1 and i2? Or are there 'NaN' equivalents in the integer
>> world?
>
> Normally, you can determine this from the valid values for am integer.
>
> Foer example, a two byte INTEGER can normally have values in the
> inclusive range: ...
Show full article (1.09Kb)
1 Comment
Re: Viewing Double Prescision reals as Integers         


Author: Steven G. Kargl
Date: Jul 25, 2006 13:03

In article scrotar.nss.udel.edu>,
Rich Townsend barVOIDtol.udel.edu> writes:
> David Flower wrote:
>> ferrad wrote:
>>> Say I have a common:
>>>
>>> double precision r1
>>> common /doubint/ r1
>>>
>>> and another common elsewhere:
>>>
>>> integer i1, i2
>>> common /doubint/ i1, i2
>>>
>>> Then will the two halves of the variable r1 always translate into valid
>>> integers in i1 and i2? Or are there 'NaN' equivalents in the integer
>>> world?
>>
>> Normally, you can determine this from the valid values for am integer.
>> ...
Show full article (1.98Kb)
1 Comment
Re: Viewing Double Prescision reals as Integers         


Author: Rich Townsend
Date: Jul 25, 2006 13:07

Steven G. Kargl wrote:
> In article scrotar.nss.udel.edu>,
> Rich Townsend barVOIDtol.udel.edu> writes:
>> David Flower wrote:
>>> ferrad wrote:
>>>> Say I have a common:
>>>>
>>>> double precision r1
>>>> common /doubint/ r1
>>>>
>>>> and another common elsewhere:
>>>>
>>>> integer i1, i2
>>>> common /doubint/ i1, i2
>>>>
>>>> Then will the two halves of the variable r1 always translate into valid
>>>> integers in i1 and i2? Or are there 'NaN' equivalents in the integer
>>>> world?
>>> Normally, you can determine this from the valid values for am integer.
>>> ...
Show full article (2.09Kb)
no comments
Re: Viewing Double Precision reals as Integers         


Author: ferrad
Date: Jul 25, 2006 13:37

dpb wrote:
> ferrad wrote:
>> Say I have a common:
>>
>> double precision r1
>> common /doubint/ r1
>>
>> and another common elsewhere:
>>
>> integer i1, i2
>> common /doubint/ i1, i2
>>
>> Then will the two halves of the variable r1 always translate into valid
>> integers in i1 and i2? Or are there 'NaN' equivalents in the integer
>> world?
>
> The two integers will always be valid integers, but their value will be
> whatever the bit pattern represents if stored via as floating point
> value.
> ...
Show full article (1.79Kb)
1 Comment
Re: Viewing Double Prescision reals as Integers         


Author: Jim
Date: Jul 25, 2006 13:38

"ferrad" hotmail.com> wrote in message
news:1153851375.239353.139070@m73g2000cwd.googlegroups.com...
> Say I have a common:
>
> double precision r1
> common /doubint/ r1
>
> and another common elsewhere:
>
> integer i1, i2
> common /doubint/ i1, i2
>
> Then will the two halves of the variable r1 always translate into valid
> integers in i1 and i2? Or are there 'NaN' equivalents in the integer
> world?
>
I suppose one could; however, the result may be less than useful.
Show full article (0.90Kb)
no comments
Re: Viewing Double Precision reals as Integers         


Author: Paul Van Delst
Date: Jul 25, 2006 13:50

ferrad wrote:
> All I want to do with them is store them away in an integer array,
> retrieve them later back into i1, i2, and carry on using them in r1
> again later. So as long as any value of r1 will translate into a
> unique i1, i2 which I can copy between integer variables, and then
> retrieve back into r1 later, then I am happy. I think from these posts
> you say this is possible.

I'll ask the question: Why do you want to do this?

Your answer may enable someone to come up with a better way to do whatever it is you want
to do.

But, why not use EQUIVALENCE?

E.g.:

program blah
implicit none
integer :: i3(2)
real(kind(1.0d0)) :: r1

equivalence(r1,i3(1))
Show full article (1.29Kb)
no comments
Re: Viewing Double Precision reals as Integers         


Author: Steven G. Kargl
Date: Jul 25, 2006 14:11

In article news.nems.noaa.gov>,
Paul Van Delst noaa.gov> writes:
> ferrad wrote:
>
>> All I want to do with them is store them away in an integer array,
>> retrieve them later back into i1, i2, and carry on using them in r1
>> again later. So as long as any value of r1 will translate into a
>> unique i1, i2 which I can copy between integer variables, and then
>> retrieve back into r1 later, then I am happy. I think from these posts
>> you say this is possible.
>
> I'll ask the question: Why do you want to do this?
>
> Your answer may enable someone to come up with a better way to do
> whatever it is you want to do.
>
> But, why not use EQUIVALENCE?

Because it leads to nonconforming code as in the code below.
Show full article (1.27Kb)
1 Comment

RELATED THREADS
SubjectArticles qty Group
aggiornamento errore [Numero errore: 0x8007007B]microsoft.public.it.windowsupdate ·
1 2 3