rhaiscript / rhai

Rhai - An embedded scripting language for Rust.
https://crates.io/crates/rhai
Apache License 2.0
3.77k stars 178 forks source link

min(f64, f64) function not found #877

Closed xkentr closed 3 months ago

xkentr commented 4 months ago

I ran into trouble with a simple script that computes the min of 2 numbers. The highly simplified version of the issue fails on the playground as well.

let a = 0.1;
let b = 0.2;
let c = min(a, b);

This fails with the error:

Waiting for Web Worker to finish loading...
Running script at 2024-05-20T20:59:02.545Z

EXCEPTION: Function not found: min (f64, f64) (line 3, position 9)
Finished at 2024-05-20T20:59:02.550Z

The same thing does not happen with integer values. The code in logic.rs seems to suggest that f64 comparisons are only created when f32_float is enabled?

schungx commented 4 months ago

Hhhmm... I thought I added back the missing function... Probably not.

I'll check it out.

schungx commented 4 months ago

Yes, it turns out it is an omission by mistake. The version where both operands are floats is missing.

I'll add them back.

schungx commented 3 months ago

The missing functions should exist in the new version. Closing this for now.