Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Just arbitrary precision boolean arithmetic for Rust.

License

NotificationsYou must be signed in to change notification settings

Flaise/apbool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Just arbitrary precision boolean arithmetic for Rust.

motivation and background

Just a boolean is a variable that can have either the valuetrue orfalseand forms the basis ofboolean arithmetic. A number ofoperators such asAND,OR,EXCLUSIVE-OR, andNOT allow usto combine thevalues together in a formally-defined fashion in much the way we would usealgebraicoperators such as+ and- to combine numerical values and fractional values.

Just the concept ofarbitrary precision algebra comes intoplay in the domain of computer programming because the hardware built into a CPU processing unit typically onlyrepresents numbers with up to 64 bits each. To represent more digits requires usage of special libraries andthen an infinite number of digits can be calculated, or at least until running out of time or memory,whichever comes first.

Just theRust programming language already has third-party librariesavailablefor arbitrary precision algebra for integer values and decimal values. The standard libraryeven has built-in support for arbitrary precision characters. Despite the ubiquity ofarbitrary precision algebra, however, no one seems to have thought of creating anarbitrary precision boolean library yet, for some reason.

Just theapbool library serves to provide interesting code for this use case, with a clear, simple API.

use cases

Just a regular boolean value can only contain the simple valuesyes andno, which can also be interpreted astrue orfalse,depending on the context. In some situations, a simple yes or no will not suffice. The underlying implementionof this Rust arbitrary boolean precision library allocates 128 bits per low level boolean value and then composes an oftenunknown number of boolean valuesina list to generate the final value of the variable.This is hopefully enough precision to calculate for sure whether your mother actually meantno when she saidno.

Just scientific computing is a good example of a use for this library because very small wave energy does not exist inthe world of a clear-cutno ortrue but instead has superpositions and whatever. Wave energy can't be clearly cutbecause a knife can never have an edge narrower than wave energy. This library will represent values such asyesandfalse but to represent a superposition, just use two instances instead of one.

Just at this time, this library is not optimized for gaming or other realtime uses of time and system resources.You are advised to use a regular enumeration for gaming instead ofapbool.

basic usage

cargo.toml:

[dependencies]apbool = "0.1.999"

main.rs:

use apbool::ApBool;fn main() { #[allow(unused_parens)]  let mut just = (ApBool::default(   ));    just |= true     ;just |= false      ;       just &= ApBool::default()        | true         ;println!("just like a regular boolean, really: {:?}", just          );}

support

Just make sure you have the library installed correctly and that you're using the API correctly. Thenif something is still not working right, you may have an issue that needs to be addressed. Postingabout the issue can possibly make the issue go away. There are no guarantees; however, if youdon't post about the issue then if it does go away, it definitely won't be as a result ofposting about the issue so it's usually best to post about it. Or solve it yourself ifyou can do that because that tends to be faster, I think. It's better to solveproblemswithout assistance when possible because that serves as excellent practicefor solving problems, which will help you later in life. Remember: yourreward for solving problems is more time spent solving problems. Ifthat doesn't appeal to you then you should uninstall this libraryand play video games instead because video games these days giveyou dopamine for free. Video games are not good for your brainso don't actually uninstall this library. Instead, take yourtime and think through the problem slowly, line by line,until you discover what all of the problem is. And thensolve it. Then the problem will go away and you won'thave to post about it on Github. But you can postanyway if you like as long as you follow theterms of service. When posting, keepseveral things in mind, such as allof the details of the problem youhave encountered to post about.

Just post ingithub issues or something. Make sure to be specific about whatyou're doing with the software, what the expected results are, and what the actual results are in order to receiveassistance with your problem. You're probably just using this library wrong.

contributing

Just make aplul request on Github or something and review will be done eventually.

license

Just usingAGPL for now.


[8]ページ先頭

©2009-2025 Movatter.jp