We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 223b445 commit 07c5833Copy full SHA for 07c5833
lib/LaTeXML/Package/pgfmath.code.tex.ltxml
@@ -613,7 +613,12 @@ BEGIN {
613
factorial => sub { pgfmathfactorial($_[0]); },
614
floor => sub { floor($_[0]); },
615
frac => sub { $_[0] < 0 ? ceil($_[0]) - $_[0] : $_[0] - floor($_[0]); },
616
- # gcd => sub { },
+ gcd => sub {
617
+ # PGF computes the gcd of the underlying TeX integers!
618
+ my ($a, $b) = (abs($_[0]) * 65536, abs($_[1]) * 65536);
619
+ ($a, $b) = ($b, $a) if $b > $a;
620
+ while ($b > 0) { ($a, $b) = ($b, $a % $b); }
621
+ int($a / 65536); },
622
# height => sub { },
623
hex => sub { sprintf("%x", $_[0]); },
624
Hex => sub { sprintf("%X", $_[0]); },
0 commit comments