Re: math

new topic     » goto parent     » topic index » view thread      » older message » newer message

Kat wrote:

> Does anyone have a list of basic math questions and answers, using big
> numbers, like:
>
>  12345678901234567890.123456
> +9991230000000000.56666666666688889999999
> = the answer

the answer = 12355670131234567890.69012266666688889999999

> x - y = z

3.1415926535897932384626433832795 - -2.7182818284590452353602874713527
= 5.8598744820488384738229308546322

3.1415926535897932384626433832795 - 2.7182818284590452353602874713527
= 0.4233108251307480031023559119268

-3.1415926535897932384626433832795 - 2.7182818284590452353602874713527
= -5.8598744820488384738229308546322

-3.1415926535897932384626433832795 - -2.7182818284590452353602874713527
= -0.4233108251307480031023559119268

You can also use the double negatives as addition tests.

> x * y = z

3.5121409 * 3.16362908763458525001406154038726382279
= 11.111111111111111111111111111111111111111111111
     (The decimal part has 45 ones _but_no_more_)

> x / y = z

The division ones are likely to be the killers if your code has any problems
in it:
355355355355 / 113113122717.85053892523746376986
= 3.1415926535897932384626433832794792408640017539...
  (this isn't the exact value of Pi in case you're wondering)

This is a good one:
10 / 81 = 0.12345679012345679012345679012346....

This has powers of two every 4 digits:
10000 / 4999 = 2.000400080016003200640128025605121024204840968193...
  By adding zeroes to 10000... and adding nines to 4999... you can
  increase the number of digits each power of two fits into.

If you can do factorial by multiplying repeatedly;
1*2*3*....*48*49*50 / 3.1415926535897932384626433832795
= 2617410836119049074025095693555308.086784253501579842420985109612694...

To test your divisors, you can always remultiply by them afterwards and see
how big the error is.

Hope this aimless rambling helped in some way, :)
Carl

PS I used something called 'bc' to get some of the answers here. It's
available on most Unixes like BSD and Linux.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu