Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNEGATE doesn't in v2.2 #13

Closed
RigTig opened this issue Feb 12, 2017 · 8 comments
Closed

DNEGATE doesn't in v2.2 #13

RigTig opened this issue Feb 12, 2017 · 8 comments
Assignees
Labels

Comments

@RigTig
Copy link
Collaborator

RigTig commented Feb 12, 2017

\ I am having great fun using eForth
\ thank you for a great piece of work
\ In v2.2
3 0 dnegate .s \ results in
FFFD 0 <sp ok
\ when it should be FFFD FFFF <sp ok

\ regards, RigTig

@TG9541 TG9541 self-assigned this Feb 12, 2017
@TG9541
Copy link
Owner

TG9541 commented Feb 12, 2017

Hi RigTig,
I can conform he problem. It has nothing to do with my meddling with Dr. C.H. Tings code: it's already present in STM8EF V2.1. So far I didn't use double arithmetics much, and it's a good thing that you're testing it.

TG9541 added a commit that referenced this issue Feb 12, 2017
@TG9541
Copy link
Owner

TG9541 commented Feb 12, 2017

Hi RigTig,
it's fixed in the develop branch.
In case it's needed in the master branch before release of STM8EF V2.2.7 please use the following definition as a work-around:

: DNEGATE NOT >R NOT 1 UM+ R> + ;

Thanks again for reporting this issue :-)

Regards & Greetings from Germany,
Thomas

@TG9541 TG9541 closed this as completed Feb 12, 2017
@RigTig
Copy link
Collaborator Author

RigTig commented Feb 14, 2017 via email

@TG9541
Copy link
Owner

TG9541 commented Feb 19, 2017

Hej RigTig,

I tested the code you posted: it works great, but 256 0 isqrt . returns 15, clearly a rounding error. Adding the line 1 0 ud+ to isqrt fixes this :-)

Would it be OK to add the code to a lib section in the STM8EF repo under a (permissive) OS license?

@TG9541 TG9541 reopened this Feb 19, 2017
@RigTig
Copy link
Collaborator Author

RigTig commented Feb 20, 2017 via email

@TG9541 TG9541 removed the question label Feb 20, 2017
@TG9541
Copy link
Owner

TG9541 commented Feb 20, 2017

Thanks :-)
I had never thought that one would actually consider moving the limits of what a tiny micro can do that far! This project sounds like a fun - I'm looking forward to more feedback!

@TG9541 TG9541 closed this as completed Feb 20, 2017
@RigTig
Copy link
Collaborator Author

RigTig commented Feb 20, 2017

Tested the isqrt and confirmed the bug. A little bit of exploring found the culprit: d> was actually d>=. So here is a new d> that seems to be ok now, and you'd never guess that isqrt actually gives 16 as the answer for 256 0 isqrt .

: d> ( d d -- f )
d- 2dup or 0= ( d f ) rot rot
0< swap drop or not
;
Thanks Thomas, and please keep up the good work.
Regards, RigTig

@TG9541
Copy link
Owner

TG9541 commented Feb 20, 2017

@RigTig

Great, thanks! I had chiefly looked in the same direction but I falsely assumed that d>= was intentional :-)

As the GitHub issues appear to work great as a discussion platform!

Here is something that might be relevant for your G-code project and also for lib/math:

trigonometry & fractional arithmetics:

I've got no experience with fractional arithmetics (only fixed point), I guess that I should start experimenting a bit. CORDIC used to be widely used (there is even a MCS51 µC, the XC886, with CORDIC hardware for field oriented motor control).

Another that needs solving is a "uploader" program, ideally one that does includes, and that attempts to be smart (i.e. one that tests whether a library has already been loaded). AmForth has an interesting solution, but I'm skeptical about doing constant replacement in the uploader.

@TG9541 TG9541 added the bug label Jun 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants