Skip to content

audiograph: Graph.get converts its float to mp_float_t, so double-float builds compile - #308

Merged
bdbarnett merged 1 commit into
mainfrom
fix/audiograph-double-float
Oct 22, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
fix/audiograph-double-float

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

On a MicroPython build where mp_float_t is double, such as the webassembly port, Graph.get passes a float to mp_obj_new_float, and the build refuses the implicit promotion:

src/audiograph/Graph.c:136:29: error: implicit conversion increases floating-point precision: 'float' to 'mp_float_t' (aka 'double') [-Werror,-Wdouble-promotion]

The value is now cast to mp_float_t explicitly. It's the only such call in audiograph: the two mp_obj_get_float reads already cast down to float. With this change the webassembly interpreter builds, and import audiograph works under node. Single-float ports compile the same code as before.

…at builds compile

On a build where mp_float_t is double (the webassembly port), passing a
float to mp_obj_new_float is an implicit promotion, and the build's
-Werror=double-promotion refuses it.
@bdbarnett
bdbarnett merged commit 7e05d7d into main Oct 22, 2026
31 checks passed
@bdbarnett
bdbarnett deleted the fix/audiograph-double-float branch October 22, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant