You are here: Home » G » Gn » Gnu Bc

Gnu Bc

Posts tagged with Gnu Bc

GNU BC: "modulo" % with scale other than 0
If the scale is other than zero, calculations with %, such as 3%2 and 46%4, tend to output 0. How is the algorithm designed with the scale other than 0? bc scale=10 print 4%3 // output 0 ...

GNU BC: functions, if-clauses and returns
The questions are in the comments of the code: define f(x) { print x^2 } define g(x) { print x+2 } if(f(2)>g(1)) { print "it works" } 43 # Why 43 instead of the text "it works"? a=f(2) b=g(1) if(a>b) {...