Version 1.2 of ais/ai-00094.txt

Unformatted version of ais/ai-00094.txt version 1.2
Other versions for file ais/ai-00094.txt

!standard RM-A.5.1 (42)          99-07-08 AI95-00094/01
!class confirmation 95-09-29
!status WG9 approved (8-0-0) 97-07-04
!status ARG approved (7-0-0) 97-04-11
!status work item 95-09-29
!status received 95-09-29
!priority Low
!difficulty Easy
!subject Exponentiation: 0.0 ** 0.0 raises Argument_Error.
!summary
0.0 ** 0.0 raises the exception Numerics.Argument_Error.
!question
A.5.1(42) says:
42 Exponentiation by a zero exponent yields the value one.
... Exponentiation of the value zero yields the value zero.
So what does 0.0 ** 0.0 do?
!response
A.5.1(19,23) say:
19 The exception Numerics.Argument_Error is raised, signaling a parameter value outside the domain of the corresponding mathematical function, in the following cases:
... 23 by the exponentiation operator, when the value of the left
operand is negative or when both operands have the value zero;
Thus, A.5.1(42) is not self-contradictory; 0.0 ** 0.0 raises Argument_Error.
!ACATS test
ACATS test CXA5A10 checks that Argument_Error is raised for 0.0 ** 0.0.
!appendix

!section RM-A.5.1(42)
!subject Incosistent definition of exponentiation
!reference RM95-a.5.1 (42)
!from Rich Connelly 95-9-13
!reference as: 95-5290.a Rich Connelly (410) 765-4425 connelly@eclus.bwi.wec.com 95-9-13>>
!discussion

A co-worker noticed an inconsistent defintion of exponentiation
in the Ada95 RM, Section A.5.1, paragraph 42 (Elementary_Functions).

The first statement in the paragraph states

    "Exponentiation by a zero exponent yields the value one."

The last statement in the paragraph states

    "Exponentiation of the value zero yields the value zero."

This requires the compiler to return both 0 and 1 for the expression 0 ** 0.

The Ada83 RM defines any argument raised to the exponent 0 yields the value one.
Also, the Ada95 RM states that any argument raised to the exponent 0 yields the
value one in the section discussing the exponentiation operator.

I would like to suggest that the wording in this paragraph be changed such
that 0 ** 0 = 1.  This will make the Ada95 RM agree with Ada83.

--Rich

****************************************************************

!section RM-A.5.1(42)
!subject Inconsistent definition of exponentiation
!reference RM95-A.5.1 (42)
!reference 95-5290.a Rich Connelly 95-9-13
!reference RM95-A.5.1 (23)
!from Keith Thompson 95-09-13
!reference as: 95-5294.a Keith Thompson 95-9-14>>
!discussion

Paragraph 23 of the same subsection says that 0.0**0.0 raises
Argument_Error.

****************************************************************

!section RM-A.5.1(42)
!subject Inconsistent definition of exponentiation
!reference RM95-A.5.1(42)
!reference 95-5290.a Rich Connelly 95-9-13
!from Ken Dritz 95-9-14
!reference as: 95-5296.a Ken Dritz  95-9-14>>
!discussion

The cited paragraph does not apply when both arguments of the exponentiation
operator of Generic_Elementary_Functions are zero, and there is therefore no
inconsistency.  See paragraphs 37 and 23 of the same clause.

****************************************************************

Questions? Ask the ACAA Technical Agent