MCPcopy Create free account
hub / github.com/hashintel/hash / operations

Function operations

libs/@local/codec/src/numeric/real.rs:534–553  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

532
533 #[test]
534 fn operations() {
535 let value1 = Real::from_natural(10, 0);
536 let value2 = Real::from_natural(5, 0);
537
538 // Addition
539 let sum = value1.clone() + value2.clone();
540 assert_eq!(sum.to_i32(), Some(15));
541
542 // Subtraction
543 let diff = value1.clone() - value2.clone();
544 assert_eq!(diff.to_i32(), Some(5));
545
546 // Multiplication
547 let product = value1.clone() * value2.clone();
548 assert_eq!(product.to_i32(), Some(50));
549
550 // Division
551 let quotient = value1 / value2;
552 assert_eq!(quotient.to_i32(), Some(2));
553 }
554
555 #[test]
556 fn ordering() {

Callers

nothing calls this directly

Calls 2

from_naturalFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected