/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk

« back to all changes in this revision

Viewing changes to tools.php

  • Committer: Suren A. Chilingaryan
  • Date: 2013-09-19 20:15:34 UTC
  • Revision ID: csa@dside.dyndns.org-20130919201534-qb7qooc6yt74i4wu
Increase precision of dsPrecise math operations to 24 numbers after decimal point

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
#       if ($a < 0) echo "$a,$b   $ia,$ib,    $ra,$rb   = $r\n";
46
46
 
47
47
        if ($r < 0) {
48
 
            if ($ia > $ib) return ($ia - $ib - 1) . strstr(sprintf("%.9F", ($r+1)), ".");
 
48
            if ($ia > $ib) return ($ia - $ib - 1) . strstr(sprintf("%.24F", ($r+1)), ".");
49
49
            else return 0;
50
50
        } else if ($r > 0) {
51
51
            if ($ia < $ib) return 0;
52
 
            else return ($ia - $ib) . strstr(sprintf("%.9F", $r), ".");
 
52
            else return ($ia - $ib) . strstr(sprintf("%.24F", $r), ".");
53
53
        } else {
54
54
            if ($ia > $ib) return ($ia - $ib);
55
55
            else return 0;
84
84
 
85
85
    if (($ra)||($rb)) {
86
86
        $r = $ra + $rb;
87
 
        if ($r > 1) return ($ia + $ib + 1) . strstr(sprintf("%.9F", $r), ".");
88
 
        else if ($r < 1) return ($ia + $ib) . strstr(sprintf("%.9F", $r), ".");
 
87
        if ($r > 1) return ($ia + $ib + 1) . strstr(sprintf("%.24F", $r), ".");
 
88
        else if ($r < 1) return ($ia + $ib) . strstr(sprintf("%.24F", $r), ".");
89
89
        else  return ($ia + $ib + 1);
90
90
    } else return $ia + $ib;
91
91
}