View: bcscale

Function:
Description: Sets default scale parameter for all bc math functions.
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function bcscale (scale) {
    // http://jsphp.co/jsphp/fn/view/bcscale
    // +   original by: lmeyrick (https://sourceforge.net/projects/bcmath-js/)this.
    // -    depends on: _phpjs_shared_bc
    // *     example 1: bcscale(1);
    // *     returns 1: 3
    //  @todo: implement these testcases
    //        bcscale(0);
    //
    //        bcmath.test.result('bcscale', 1, false, bcscale('fail'));
    //        bcmath.test.result('bcscale', 2, false, bcscale(-1));
    //        bcmath.test.result('bcscale', 3, true, bcscale(5));
    //        bcmath.test.result('bcscale', 4, true, bcscale(0));
    var libbcmath = this._phpjs_shared_bc();

    scale = parseInt(scale, 10);
    if (isNaN(scale)) {
        return false;
    }
    if (scale < 0) {
        return false;
    }
    libbcmath.scale = scale;
    return true;
}
Comment on bcscale version 82
Tests
Benchmark
[top]

Comments

There are no comments yet, be the first!

Please Login or Register to post comments.