Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,126 Was thanked: 507 time(s) in 338 post(s)
|
I had encountered a strange behavior while trying to implement Tupper Formula. Is this a bug or SMath shouldn't calculate modular of such a long number? Sorry for very big picture but don't know how to show it in here else. Build 0.99.7666 on Linux, same result with previous old builds by the way. Regards tupper.sm (5kb) downloaded 8 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
SMath doesn't have exact integer arithmetics. Numbers are handled as floats with finite precision. You will find that k+1=k evaluates to true. If you want to do exact integer arithmetics, Unfortunately, you can't even use CAS plugins like maxima or maple because any input is handled by SMath first before conveying it to the plugin. This includes downgrading of numeric constants to IEEE 754 floats. Maxima has a mechanism of using string input to circumvent this but this will look extremly ugly in the SMath sheet. tupper_kr.sm (5kb) downloaded 5 time(s). |
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: overlord Is this a bug or SMath shouldn't calculate modular of such a long number? "modular" ... you mean 'mod' Write ... mod(k,1.23456789) Write ... mod(k,123456789.987654321)
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,126 Was thanked: 507 time(s) in 338 post(s)
|
Originally Posted by: mkraska SMath doesn't have exact integer arithmetics. Numbers are handled as floats with finite precision.
Thanks Martin, I figured so. This is why there is a question, "bug or not". Clearly it is not a bug but how SMath works. Regards
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: overlord This is why there is a question, "bug or not". Nothing new here. I posted the attached long time ago, no answer. Too big numbers chokes Smath. Critical error.sm (3kb) downloaded 6 time(s).
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.