Giter Club home page Giter Club logo

bcalc's Introduction

About Me

I'm a *nix enthusiast who programs for fun though I'm probably the laziest guy you'll ever meet.
I love music and anime, and have insanely large collections for each.
I also like to play around in Blender a bit, as you can tell from my banner.
Handles: Phate6660, Valley6660, phate, valley

The SVG is too big to display all the info, to see more click on the image:
Metrics

To view more things (such as where to find me, links to all my projects, etc) visit my website.

Why I'm on Here

I'm on here because there are no better alternatives (currently -- for me).
codeberg forces licensing approved by a sham organization and another one that is shady at best.
sourcehut is actually very amazing, I have used (and paid for) it in the past.
The problem is that I would feel bad not paying for it, and I kinda have no income right now.
sourceforge yeah, not a chance sorry.

And another thing, when I share code, it's because I'd love for others to use it.
As bad as this sounds, GitHub is "where it's at" when it comes to code sharing.
I've had people blatantly refuse to use my software,
along with some very angry (and honestly out there) rants about not using GitHub.
So even if I did use something else, it would have to be something that people would actually use.

bcalc's People

Contributors

phate6660 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

adnan360

bcalc's Issues

PEMDAS issues

First of all thanks for implementing PEMDAS. ๐Ÿ† It was great to see you implement it that fast.

I did some testing:

$ ./bcalc '(2+2)*2'
2
$ ./bcalc '2*(2+2)'
26
$ ./bcalc '2^(2+2)'
26
$ ./bcalc '(2+2)^2'
3
$ ./bcalc '(2)^2'
1
$ ./bcalc '2+2+2^2'
8

All of these are wrong. Am I doing anything wrong?

Option for disabling number formatting

Right now it formats the output by default, something like 2,000,000,000. But I was hoping if an arg could be added to disable this and just output the result as is.

It is kind of related to #8 . But wanted to keep it separate.

Just wanted to think for some use cases. So thought it would be great to have it. No hurry for these.

Implement tests

We usually have to test ourselves when we have new features to see if that broke any old features. What if we had tests to do that automatically for us?

Found out that bats is a good testing system for bash. I have some tests written for it in a branch here.

I'll push a PR shortly for your consideration, but I was thinking if bats is even too much for this project. I mean, if it can be done with pure bash only that would be awesome in a way.

Update shebang line to include env

I've implemented bcalc into my config and it's working great for me. Recently I started to support FreeBSD as an alternate platform. Then I noticed something.

The current shebang line used in bcalc and test is:

#!/bin/bash

This is fine on GNU+Linux systems. But BSD systems such as FreeBSD and others store the bash binary in /usr/local/bin/bash, so it fails there saying /bin/bash: bad interpreter: No such file or directory. One way to fix this is to direct to bash through env, like this:

#!/usr/bin/env bash

Here is an article about why env should be included in shebang. There are discussions around the web whether this is needed. But general idea is that this is suggested if the script is intended to be portable. So I think this change should make it usable in more platforms.

Option for custom number formatting

I was thinking about the default comma formatting. Right now it does this:

$ ./bcalc '2*1000000000'
2,000,000,000

But there are other countries with other number formatting traditions. For example I found this article showing some of them. It would be great if this formatting can be specified.

I'm not sure what would be the best way to do it. I was hoping if it was possible to specify the format with an arg like ###,###,###.##. Another way would probably be to mention the country codes.

Debug instructions are not working for me

Congratulations on crossing off so many TODOs!

I've checked the readme and it has some commands on debugging:

$ ./bcalc [100]-[50]
final_array = [ 1 0 0 ] - [ 5 0 ]
number_array = 100 50
operation_array = -
calculation = 100-50
50

But when I execute the same, it gives me:

$ ./bcalc [100]-[50]
50

Maybe there are some parameters missing?

Show error message when more than 2 numbers are entered

Thanks for creating the project.

First, I tried:

$ ./bcalc '1+1'
2
$ ./bcalc '(1+1)*2'
12
$ ./bcalc '2*(1+1)'
13

The last 2 are wrong. Then I found Support operating on more than two numbers on the TODO list. I think it's better to show an error message that more than 2 numbers are not supported, rather than showing wrong results. Some users could be really confused, like me! :)

Include instructions on how to use it on README

It's up to you, but I think adding basic instructions on the README.md on how to use it would be nice. Plus some examples, some limitations (e.g. #1) in the readme would make it more user friendly and show what it's capable of before downloading it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.