Tech Support > Microsoft Windows > Development Resources > Seed7 Release 2007-03-05
Seed7 Release 2007-03-05
Posted by thomas.mertes@gmx.at on March 5th, 2007


Hello,

I have released a new version of Seed7: seed7_05_20070305.tgz

In the Seed7 programming language new statements and operators
can be declared easily. Types are first class objects and therefore
templates/generics need no special syntax. Object orientation is
used when it brings advantages and not in places when other
solutions are more obvious.

Seed7 is covered by the GPL (and LGPL for the Seed7 runtime library).

Changelog:
- The support for float was changed to use IEEE 754 NaN and Infinity
instead of exceptions.
- The exception checking program chkexc.sd7 was improved and the
chkflt.sd7 program was added.
- All exponentiation operators were improved to evaluate 0 ** 0 to 1.
- The associativity of the ** operator was changed to work right to
left.
- A declaration for an = and <> operator was added for interface
types.
- Basic support for exceptions in compiled programs was added.
- Parts of the manual describing float operations and exponentiation
were improved.
- The performance of the flt_ipow action was improved.
- The compiler was improved to produce better code for the primitive
actions arr_sort, arr_times, cls_eq, cls_ne, flt_isnan, flt_log10,
int_fact, rfl_append, rfl_cpy, rfl_for, rfl_mklist, rfl_ne, rfl_tail
and
str_str.

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Project page: http://sourceforge.net/projects/seed7

Posted by Kevin André on March 7th, 2007


thomas.mertes@gmx.at wrote:

(...)

That's not correct. 0 ** 0 is undefined. x ** 0 = (x ** 1) / x and you
can't do that when x is zero.


--
Kevin André


Posted by thomas.mertes@gmx.at on March 8th, 2007


On 7 Mrz., 09:40, Kevin André <kevin.andre.dont.l...@spam.telenet.be>
wrote:

In mathematics there is a convention to define x ** 0 as 1.
This comes very handy. For example:
10 ** 2 = 100
10 ** 1 = 10
10 ** 0 = 1
10 ** -1 = 0.1
10 ** -2 = 0.01
This is also used in exponential notation for numbers like
1.7e0 which is short for 1.7 * 10 ** 0 and means just 1.7 .

0 ** 0 is something different.
0 ** x is 0 for x > 0 but 0 ** x is Infinity for x < 0.
0 ** 0 is a point of discontinuity.
At wikipedia there is information about that topic:
http://en.wikipedia.org/wiki/Exponen...the_zero_power
This wikipedia article states that C, Java, Python,
Ruby, Haskell, ML, Scheme and MATLAB define 0 ** 0 as 1.
My own research showed that Fortran, Ada and C++ also
define 0 ** 0 as 1. Seed7 does now the same as all
these programming languages:
Define A ** 0 to be always 1.

But Seed7 is an extensible programming language.
You can define a subtype which returns NaN for 0.0 ** 0.0:

const type: myFloat is subtype float;

const func myFloat: (in myFloat: base) ** (in myFloat: exp) is func
result
var myFloat: result is 0.0;
begin
if base = 0.0 and exp = 0.0 then
result := NaN;
else
result := base ** exp;
end if;
end func;

Greetings Thomas Mertes

Homepage: http://seed7.sourceforge.net
Project page: http://sourceforge.net/projects/seed7


Posted by Dave Vandervies on March 8th, 2007


In article <4UuHh.45844$lu3.399467@phobos.telenet-ops.be>,
Kevin =?ISO-8859-1?Q?Andr=E9?= <kevin.andre.dont.like@spam.telenet.be> wrote:
If you're going to make corrections, you should at least get them right.

Any mathematician will tell you that 0**0 is defined to be 1 by
convention. This makes a lot of special cases less special (x**0 comes
up a lot more often than 0**x) and also makes x**x as a real-valued
function on the reals continuous at the endpoint at x=0, which tends to
be convenient.


dave

--
Dave Vandervies dj3vande@csclub.uwaterloo.ca
it in this particular case. --Mark McIntyre and Richard Heathfield in CLC

Posted by Kevin André on March 9th, 2007


thomas.mertes@gmx.at wrote:

The article you refer do states that "In many settings, 0 ** 0 is
defined to be 1." But it also says "In other settings, especially
calculus and complex analysis, 0 ** 0 is treated as an indeterminate
form and left undefined."

So you could define 0 ** 0 to be 1, but then you get this:

0 ** 2 = 0
0 ** 1 = 0
0 ** 0 = 1
0 ** -1 = 0
0 ** -2 = 0

It would look better if you would have another zero in that list
instead of the 1, but that wouldn't be 'correct' either. I remember
from the calculus lessons we were told that 0 ** 0 is undefined just
like 0 to the power of plus or minus infinity.


--
Kevin André


Posted by thomas.mertes@gmx.at on March 9th, 2007


On 9 Mrz., 09:46, Kevin André <kevin.andre.dont.l...@spam.telenet.be>
wrote:
There is just one thing you forgot.
The expression x ** -y is defined as 1 / (x ** y) .
Therefore your table must be:

0 ** 2 = 0
0 ** 1 = 0
0 ** 0 = 1
0 ** -1 = Infinity
0 ** -2 = Infinity

Now the definition of 0 ** 0 as 1 does not stand out any more.
It is a compromise but there are good arguments for doing it
this way. As I mentioned before, other programming languages
like Fortran, C, C++, Ada, Java, Python, Ruby, Haskell, ML,
Scheme and MATLAB took the same approach.

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Project page: http://sourceforge.net/projects/seed7



Similar Posts