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

Bindings for define statements using scientific notation #2881

Open
MeechaelA opened this issue Aug 9, 2024 · 2 comments
Open

Bindings for define statements using scientific notation #2881

MeechaelA opened this issue Aug 9, 2024 · 2 comments

Comments

@MeechaelA
Copy link

MeechaelA commented Aug 9, 2024

Input C/C++ Header

/* Arcseconds to radians */
/* Radians to arcseconds */
#define DR2AS (206264.8062470963551564734)

/* Arcseconds to radians */
#define DAS2R (4.848136811095359935899141e-6)

/* Seconds of time to radians */
#define DS2R (7.272205216643039903848712e-5)

/* Arcseconds in a full circle */
#define TURNAS (1296000.0)

Bindgen Invocation

    let bindings = bindgen::Builder::default()
                                .generate_inline_functions(true)
                                .generate_cstr(true)
                                .use_core()
                                .no_convert_floats()
                                .header("extern/src/sofa.h")
                                .header("extern/src/sofam.h")
                                .blocklist_var("FP_NAN")
                                .blocklist_var("FP_INFINITE")
                                .blocklist_var("FP_ZERO")
                                .blocklist_var("FP_SUBNORMAL")
                                .blocklist_var("FP_NORMAL")
                                .generate()
                                .expect("Unable to generate bindings");

Actual Results

pub const DR2AS: f64 = 206264.80624709636;
pub const TURNAS: f64 = 1296000.0;

Expected Results

It appears that variables that use scientific notation in define statements are ignored. I can codify these in my own code, although, it would be nice to rely on the bindings.rs file. Are there any methods that enable this? Or is this truly an issue?

@GKFX
Copy link
Contributor

GKFX commented Aug 9, 2024

This may be something that gets resolved by the new macro parser in #2369.

@pvdrz
Copy link
Contributor

pvdrz commented Aug 9, 2024

Indeed

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

No branches or pull requests

3 participants