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

Please make explicit mysterious "I considered various ways" code comments to \texdimenwithunit #21

Closed
jfbu opened this issue Nov 10, 2021 · 0 comments · Fixed by #23
Closed
Labels
enhancement New feature or request
Milestone

Comments

@jfbu
Copy link
Owner

jfbu commented Nov 10, 2021

In the branch of \texdimenwithunit{<dim1>}{<dim2>} handling the dim2=f sp, f<65536 case, there is tantalizing code comment:

% Computing C = ceil(r * 65536/f) in \numexpr is the delicate
% part, as r can be as large as f-1 hence 65535 and r*65536 would
% overflow. We could compute R=round(r*65536/f) ("scaling operation")
% then C=R+1 if R*f-65536*r<0, else C=R.
%
% The problem is then: how to get the sign of R*f-65536*r without
% overflow? I considered various ways.

Now my nephew who is good at maths says she sees various methods but as she was educated in LaTeX she can not help with the Plain e-TeX in the code!

Experience with the "up" and "down" macros has shown that it may be more efficient to do one or two more \numexpr than opt for the (admittedly clever and admired) detour hijacking TeX's built-in dimension input process. So please spell out what you have in mind and improve your software if possible. Thanks.

@jfbu jfbu added the question Further information is requested label Nov 10, 2021
@jfbu jfbu added this to the some future version milestone Nov 10, 2021
@jfbu jfbu added enhancement New feature or request and removed question Further information is requested labels Nov 10, 2021
@jfbu jfbu modified the milestones: some future version, 1.1 Nov 10, 2021
@jfbu jfbu closed this as completed in #23 Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant