Hy,

I need to do simple multiply,

for example 58 multiply by a double 1,4536366 .

The result is different respect to what I've with windows calculator.

Using BigDecimal the program becames too slow so I need to know when I

could use just double to make a multiply, or a add , or a subtract, or

a divide.

Thanks

Antonio

www.etantonio.it/en

In article

< XXXX@XXXXX.COM >,

[...]

Why don't you write a short example showing the result you get and the

result you expected:

< http://www.yqcomputer.com/ ;

Here's a helpful article on the topic:

< http://www.yqcomputer.com/ ;

--

John B. Matthews

trashgod at gmail dot com

< http://www.yqcomputer.com/ ;

< XXXX@XXXXX.COM >,

[...]

Why don't you write a short example showing the result you get and the

result you expected:

< http://www.yqcomputer.com/ ;

Here's a helpful article on the topic:

< http://www.yqcomputer.com/ ;

--

John B. Matthews

trashgod at gmail dot com

< http://www.yqcomputer.com/ ;

...

What is the purpose of the multiply? The choice of BigDecimal vs. double

depends on big picture issues.

For example, in some contexts exactness, or failing that controlled

rounding, is particularly important for numbers that have exact decimal

representations. Think about accounting. That is where BigDecimal is

really needed.

Double is a binary fraction system, so decimal fractions have no special

status. 1.4536366 can only be approximated in double, not represented

exactly. However, numbers can be approximated to over 15 decimal digits,

good enough for a lot of engineering and scientific calculations. It is

a very compact representation, supported in hardware on many processors,

making it extremely efficient.

Patricia

...

...

It is certainly not "in error" because it is acting in accordance with

its published behavior: "Extended Precision, a feature of Calculator,

means that all operations are accurate to at least 32 digits. Calculator

also stores rational numbers as fractions to retain accuracy. For

example, 1/3 is stored as 1/3, rather than .333." (Windows XP Calculator

Help - calculations - extended precision).

It is no more in error than is BigDecimal for producing a different

answer from IEEE 754 64 bit binary. Both are supposed, according to

their specifications, to produce the infinitely precise result for that

case, and both do so.

Computer arithmetic often involves trade-offs between various desirable

properties, such as range, accuracy for particular cases, automatic

scaling, performance, and compactness. Two programs with different

criteria, and different specifications, can produce different results

for the same calculation without either of them being "in error".

Patricia

On Thu, 19 Feb 2009 03:14:44 -0800 (PST), etantonio

< XXXX@XXXXX.COM > wrote, quoted or indirectly quoted someone

who said :

If you want a precise answer use int or long.

If the answer is too fat to fit in a long use BigInteger or BigDecimal

If the answer is a measurement of a physical quantity, use a double or

float depending on the accuracy required. It equivalent to scientific

notation, allowing very large or very small numbers with only about 15

significant digits.

See http://www.yqcomputer.com/

various types.

in your particular case 58 * 1,4536366 = 843,109,228

The biggest possible int is 2,147,483,647, so you can handle this with

ordinary ints.

--

Roedy Green Canadian Mind Products

http://www.yqcomputer.com/

One path leads to despair and utter hopelessness. The other,

to total extinction. Let us pray we have the wisdom to choose correctly.

~ Woody Allen .

< XXXX@XXXXX.COM > wrote, quoted or indirectly quoted someone

who said :

If you want a precise answer use int or long.

If the answer is too fat to fit in a long use BigInteger or BigDecimal

If the answer is a measurement of a physical quantity, use a double or

float depending on the accuracy required. It equivalent to scientific

notation, allowing very large or very small numbers with only about 15

significant digits.

See http://www.yqcomputer.com/

various types.

in your particular case 58 * 1,4536366 = 843,109,228

The biggest possible int is 2,147,483,647, so you can handle this with

ordinary ints.

--

Roedy Green Canadian Mind Products

http://www.yqcomputer.com/

One path leads to despair and utter hopelessness. The other,

to total extinction. Let us pray we have the wisdom to choose correctly.

~ Woody Allen .

etantonio wrote, quoted or indirectly quoted someone

Given the ".it" suffix on the email address, it is likely that the OP was

using the comma as the radix point, making the answer slightly larger than 84.

It is highly unlikely that the answer would have diverged from that given by

the Windows calculator otherwise.

--

Lew

Given the ".it" suffix on the email address, it is likely that the OP was

using the comma as the radix point, making the answer slightly larger than 84.

It is highly unlikely that the answer would have diverged from that given by

the Windows calculator otherwise.

--

Lew

Actually Java only complies to its own standards, and not IEEE

754/854.

Read: www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf

Also the JVM is free to implement floating point differently on

different platforms using hardware that may not be available on all

cpus to optimize floating point operations. The only way to get

completely consistent results on ALL platforms is to use the strictfp

modifier on the class or method.

1. When's the next release of SQL?

2. Hilary, whens your book due out?

4. Handspring Treo 600 - when's it coming out?

5. When's the next Solaris version coming?

7. So, when's the next PowerBook refresh happening?

9. When's the new stuff coming out?

11. Issues with Expression Web - When's the update?

12. Mechwarrior - when's the next one?

13. So when's the new Atari 800 Win 4.0 release?

14. next month Handspring Treo 600 - when's it coming out?

15. So..when's the next version of IE due?

8 post • Page:**1** of **1**