Number-to-ByteVector-conversion #44

Merged
affine merged 7 commits from Number-to-ByteVector-conversion into main 2025-12-04 12:09:45 -08:00
Showing only changes of commit 6f16c2e084 - Show all commits

View file

@ -16,7 +16,7 @@
*/
use organelle::{Fraction, Number, Numeric};
use organelle::{Float, Fraction, Number, Numeric};
use crate::hmap::QuickMap;
use crate::stackstack::StackStack;
@ -414,7 +414,9 @@ impl VM {
i::BVTON => access!(&instr.1[0], {
if let Datum::ByteVector(sbv) = **access!(&instr.1[0]) {
Datum::Number(Number::Fra(Fraction(f64::from_ne_bytes(sbv) as isize, 1))).into()
let sf64 = f64::from_ne_bytes(sbv.try_into().unwrap());
Ok::<Datum::Number, Float>(Datum::Number(Number::Flt(Float(sf64))));
//Datum::Number(Number::Fra(Fraction(sf64 as isize, 1))).into()
} else {
e!("illegal argument to BVTON instruction");
}