Re: Why Java's math expression (power) is so inconvenient and error prone?
- From: Arne Vajhøj <arne@xxxxxxxxxx>
- Date: Mon, 30 Oct 2006 20:46:47 -0500
Lionel wrote:
My program need a lot of calculation of power. In many programming
languages,
2**3 = 8;
The syntax is clean and easy. But in Java,
Math.pow(2, 3) = 8; //It is so long, and complicated and error prone
Again, in many languages,
EXP(1) = 2.7 //e value
But in Java,
Math.pow(Math.E, 1) = 2.7 //You see, so complicated
Error prone? All the above answers look correct. Can you tell us how it is error prone?
I agree with that.
It looks like you have come from C and are expecting non-object-oriented code. Simple, get over it.
Actually C is very similar to Java. C does not have an
exponentation operator like Fortran and VB.
If that is still too difficult I suggestion you learn about the advantages of an Object-Oriented programming language.
Hm.
I would not consider the Math static methods so fantastic
object oriented ...
Arne
.
- References:
- Prev by Date: Re: How to set a character of a String?
- Next by Date: Re: Rationale behind constructor call chain... ( and comparison with C++)
- Previous by thread: Re: Why Java's math expression (power) is so inconvenient and error prone?
- Next by thread: Re: Why Java's math expression (power) is so inconvenient and error prone?
- Index(es):
Relevant Pages
|