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

language: support scientific notation for literals #1476

Merged
merged 2 commits into from
Aug 21, 2020
Merged

Conversation

fbs
Copy link
Contributor

@fbs fbs commented Aug 19, 2020

As bpf doesn't support floats this is quite simple and e.g. 1e-10
isn't supported.

bpftrace -e 'i:ms:100 { print(1e6); exit(); }'
1000000
Checklist
  • Language changes are updated in docs/reference_guide.md (not sure where to put this)
  • User-visible and non-trivial changes updated in CHANGELOG.md
  • The new behaviour is covered by tests

@fbs
Copy link
Contributor Author

fbs commented Aug 19, 2020

Reminder to update all the tools too (elapsed / 1000000)

@fbs fbs force-pushed the scientific branch 2 times, most recently from 7204c42 to 2829eb8 Compare August 20, 2020 12:25
map @{ident}|@
var ${ident}
int [0-9]+|0[xX][0-9a-fA-F]+
exponent [0-9]+e[0-9]+
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed the alingment in one go, this is the only added line

src/utils.cpp Outdated Show resolved Hide resolved
As bpf doesn't support floats this is quite simple and e.g. `1e-10`
isn't supported.

```
bpftrace -e 'i:ms:100 { print(1e6); exit(); }'
1000000
```
@fbs fbs merged commit 2476917 into bpftrace:master Aug 21, 2020
@danobi danobi mentioned this pull request Jan 6, 2021
3 tasks
@fbs fbs deleted the scientific branch March 6, 2021 22:03
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