Skip to content

#StartFloat syntax #680

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

#StartFloat syntax #680

wants to merge 2 commits into from

Conversation

cbmarini
Copy link
Collaborator

This PR updates the #StartFloat syntax as discussed in #676. The new syntax is

#StartFloat <precision>, MZV = <weight>

where the precision can either be in bits (b) or digits (d). For example:

#StartFloat 50b, MZV = 2
#StartFloat 20d, MZV = 3

Notes:

  • To properly test whether the correct number of digits are printed, PR Fix float printing #676 should be merged first.
  • In this regard, it is also worth reviewing whether the two separate calls to SetFloatPrecision from SetupMZVTables and SetupMPFTables are both needed (both increase the precision by the MZV weight). Likely, a single call in e.g. DoStartFloat should be sufficient.

@cbmarini cbmarini requested a review from jodavies June 25, 2025 08:14
@jodavies
Copy link
Collaborator

This looks like a good change, but remember to also update the manual.

I would perhaps also merge the commits, since the CI will not pass on the first commit alone, and perhaps makes bisection a bit less smooth.

* In this regard, it is also worth reviewing whether the two separate calls to `SetFloatPrecision` from `SetupMZVTables` and `SetupMPFTables` are both needed (both increase the precision by the MZV weight). Likely, a single call in e.g. `DoStartFloat` should be sufficient.

I think this is also a good idea, but maybe is better as part of #676 which is already changing how the allocation and precision is handled.

@coveralls
Copy link

coveralls commented Jun 25, 2025

Coverage Status

coverage: 50.595% (-0.008%) from 50.603%
when pulling 1031e1d on cbmarini:StartFloat
into 21f29a8 on form-dev:master.

…), MZV = <weight>. The precision can either be in bits (b) or digits (d).

test: updated the evaluate_symbol tests for the new #StartFloat syntax.

doc: updated manual with new #StartFloat syntax.
@cbmarini
Copy link
Collaborator Author

I updated the manual and merged the commits. Do we also want to add the new preprocessor commands and statements that come with the floating point system added earlier in the respective chapters?

@jodavies
Copy link
Collaborator

Yes I think so, at least in the style of "see the Floating point chapter", similar to optimize: https://www.nikhef.nl/~form/maindir/documentation/reference/html/manual.html#x1-550003.38

@cbmarini
Copy link
Collaborator Author

Allright, I will update the manual. At the moment the manual says that the first precision argument of #StartFloat is mandatory. However, at the moment it is actually optional and if you don't specify a precision, FORM will fall back onto DEFAULTPRECISION which is set to 1000. Do we want this to be optional with indeed 1000 bits of precision as the default?

@cbmarini
Copy link
Collaborator Author

Furthermore, with the new syntax, one could also relax the order of the two arguments in #StartFloat.

…#endfloat and also for the statements evaluate, tofloat and torational.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants