From 85657006be62d8a0db0c2700da025c0802ffddab Mon Sep 17 00:00:00 2001 From: mertcandav Date: Mon, 4 Mar 2024 21:50:26 +0300 Subject: [PATCH] std::math::big: add the odd method to the Int structure --- std/math/big/int.jule | 5 +++++ std/math/big/nat.jule | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/std/math/big/int.jule b/std/math/big/int.jule index 1d4f8df88..3cde8fb34 100644 --- a/std/math/big/int.jule +++ b/std/math/big/int.jule @@ -216,6 +216,11 @@ impl Int { ret self.cmp(y) == 0 } + // Reports whether number is odd. + pub fn odd(self): bool { + ret self.nat.odd() + } + // Returns integer in i64. // Causes exception if nuber large than capacity of i64. // Exception is equals to i64.MIN constant if integer is negative, else i64.MAX. diff --git a/std/math/big/nat.jule b/std/math/big/nat.jule index cbf8c60d7..166f58cea 100644 --- a/std/math/big/nat.jule +++ b/std/math/big/nat.jule @@ -317,6 +317,11 @@ impl Nat { ret bits_cmp(self.bits, y.bits) == 0 } + // Reports whether number is odd. + pub fn odd(self): bool { + ret is_odd(self.bits) + } + // Returns integer in u64. // Causes exception if nuber large than capacity of u64. // Exception is always equals to u64.MAX constant.