fix: add log with base to fuzzer

This commit is contained in:
Levy A.
2025-09-18 11:11:15 -03:00
parent 5016123214
commit 85e0f1444d
2 changed files with 9 additions and 1 deletions

View File

@@ -8089,7 +8089,9 @@ impl Value {
return Value::Float(((f + if f < 0.0 { -0.5 } else { 0.5 }) as i64) as f64); return Value::Float(((f + if f < 0.0 { -0.5 } else { 0.5 }) as i64) as f64);
} }
let f: f64 = crate::numeric::str_to_f64(format!("{f:.precision$}")).unwrap().into(); let f: f64 = crate::numeric::str_to_f64(format!("{f:.precision$}"))
.unwrap()
.into();
Value::Float(f) Value::Float(f)
} }
@@ -8355,6 +8357,11 @@ impl Value {
let log_x = libm::log(f); let log_x = libm::log(f);
let log_base = libm::log(base); let log_base = libm::log(base);
if log_base <= 0.0 {
return Value::Null;
}
let result = log_x / log_base; let result = log_x / log_base;
Value::Float(result) Value::Float(result)
} }

View File

@@ -161,6 +161,7 @@ str_enum! {
Power => "pow", Power => "pow",
Mod => "mod", Mod => "mod",
Atan2 => "atan2", Atan2 => "atan2",
Log => "log",
} }
} }