Re: math

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

Nevermind, i had dropped in an optimisation, and and for testing, i was 
passing integers, which it promptly optimised out of the string math code. 
Why must i periodically be taught to not code while sleep deprived?

Kat

On 15 Jun 2002, at 13:46, Kat wrote:

> 
> On 14 Jun 2002, at 14:11, Carl W. wrote:
> 
> <snip>
> 
> > 3.5121409 * 3.16362908763458525001406154038726382279
> > = 11.111111111111111111111111111111111111111111111
> >      (The decimal part has 45 ones _but_no_more_)
> 
> I get 
> 15568664495588241728380923821516765837422221.5686644955882417283
> 80923821516765837422221111
> 
> i am not sure that is correct, but for testing, i used 
> 
> while 1 do
> original = rand(sqrt(1073741823))
> puts(1,sprintf("%d",original*original)&"\n")
> num_1 = sprintf("%d",original)
> num_2 = num_1
> puts(1,"num1= "&num_1&"\nnum2= "&num_2&"\n\n")
> 
> starttime = time()
> junk = seq_multiply(num_1,num_2)
> endtime = time()
> 
> junk = stripleading(junk)
> puts(1,"Time= "&sprintf("%d",endtime-starttime)&"\n"&junk&"\n\npress any 
> key\n")
> 
> 
> writefile = open("D:\\Euphoria\\bignum1\\bignum result.txt","w")
> puts(writefile,"num1= "&num_1&"\nnum2= 
> "&num_2&"\n\n"&sprintf("%d",original*original)&"\n"&junk&"\nTime= 
> "&sprintf("%d",endtime-starttime))
> close(writefile)
> 
> if not equal(sprintf("%d",original*original),junk) then abort(0) end if
> 
> end while
> 
> 
> and i get back the original square every time. Naturally, the largest number i
> can test this way is 32767, or i overrange the Eu integer type.
> 
> Kat
> 
> 
> 
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu