• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

famoser / elliptic / 16578839410

28 Jul 2025 07:51PM UTC coverage: 96.985% (+1.4%) from 95.58%
16578839410

Pull #15

github

web-flow
Merge 4e78e6e8a into d917b1701
Pull Request #15: Improve bernstein math

274 of 279 new or added lines in 32 files covered. (98.21%)

35 existing lines in 3 files now uncovered.

1383 of 1426 relevant lines covered (96.98%)

8.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/src/Math/Calculator/Adder/UnsafeAdderTrait.php
1
<?php
2

3
namespace Famoser\Elliptic\Math\Calculator\Adder;
4

5
use Famoser\Elliptic\Primitives\Point;
6

7
/**
8
 * General edge-cases from https://www.secg.org/SEC1-Ver-1.0.pdf (2.2.1)
9
 * Then calls curve-specific formulas
10
 */
11
trait UnsafeAdderTrait
12
{
13
    public function add(Point $a, Point $b): Point
24✔
14
    {
15
        // rule 1 & 2
16
        if ($this->isInfinity($a)) {
24✔
17
            return clone $b;
24✔
18
        } elseif ($this->isInfinity($b)) {
24✔
19
            return clone $a;
24✔
20
        }
21

22
        if (gmp_cmp($a->x, $b->x) === 0) {
24✔
23
            // rule 3
24
            if (gmp_cmp($b->y, $a->y) !== 0) {
24✔
NEW
25
                return $this->getInfinity();
×
26
            }
27

28
            // rule 5
29
            return $this->double($a);
24✔
30
        }
31

32
        return $this->addRule4($a, $b);
24✔
33
    }
34

35
    public function double(Point $a): Point
24✔
36
    {
37
        return $this->doubleRule5($a);
24✔
38
    }
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc