Repository navigation
Open
Description
-inf E11111111111111111111111111111111111111111111111111==========================================111=111E
-3e35 111111111111111111111111111111111111111111111111111=========================================111111111
-3e32 ==1111111111111111111111111111111111111111111111111=======================================111=111111=
-3e29 ====11111111111111111111111111111111111111111111111=====================================111=111111===
-3e26 =======11111111111111111111111111111111111111111111===================================1111111111=====
-3e23 =======11111111111111111111111111111111111111111111=================================111=111111=======
-3e20 ==========11111111111111111111111111111111111111111===============================1111111111=========
-3e17 ============111111111111111111111111111111111111111=============================1111111111===========
-3e14 =============11111111111111111111111111111111111111===========================1111111111=============
-3e11 ================1111111111111111111111111111111111111111111111111111111111111111111111===============
-2e8 ==================111111111111111111111111111111111=======================1111111111=================
-2e5 ===================11111111111111111111111111111111=====================1111111111===================
-2e2 =====================1111!!!111111111111111111111111111111111111111111111!!!1111=====================
-2e-1 ======================111!1111111111111111111111111=================1111111E11=======================
-2e-4 ======================1=131111111111111111111111111===============111111111!=========================
-2e-7 ======================1=11=111111111111111111111111=============1111111111=1=========================
-2e-10 ======================1=11==11111111111111111111111111111111111111111111===1=========================
-2e-13 ======================1=11==1===111111111111111111111111111111111111111====1=========================
-2e-16 ======================1=11==1====111111111111111111=======111=1111111=1====1=========================
-2e-19 ======================1=11==1======1111111111111111=====1111111111====1====1=========================
-2e-22 ======================1=11==1=========1111111111111===1111111111======1====1=========================
-2e-25 ======================1=11==1==========111111111111=111=1111111=======1====1=========================
-2e-28 ======================1=11==1============111111111111=111111==========1====1=========================
-2e-31 ======================1=11==1===============111111E=1111111===========1====1=========================
-1e-34 ======================1=11==1=================1111E111111=============1====1=========================
-1e-37 ======================1=11==1================1!EEEEEEEEEEEEEEEEEEEEEEEEEEEEE=========================
1e-37 ======================1=11==1================11111E11111==============1====1=========================
1e-34 ======================1=11==1==============1111111E=111111============1====1=========================
2e-31 ======================1=11==1============1111111111111111111==========1====1=========================
2e-28 ======================1=11==1===========11111111111=1111111111========1====1=========================
2e-25 ======================1=11==1=========1111111111111===1111111111======1====1=========================
2e-22 ======================1=11==1=======111111111111111=====1111111111====1====1=========================
2e-19 ======================1=11==1====111111111111111111=======1111111111==1====1=========================
2e-16 ======================1=11==1===1111111111111111111=========11111111111====1=========================
2e-13 ======================1=11==11111111111111111111111===========1111111111===1=========================
2e-10 ======================1=11=111111111111111111111111=============1111111111=1=========================
2e-7 ======================1=121111111111111111111111111===============111111111!=========================
2e-4 ======================111!1111111111111111111111111111111111111111111111111E11=======================
2e-1 =====================1111!EE!1111111111111111111111111111111111111111111!EEE1111=====================
3e2 ===================11111111111111111111111111111111=====================1111111111===================
3e5 =================1111111111111111111111111111111111=======================1111111111=================
3e8 ================11111111111111111111111111111111111=========================1111111111===============
3e11 ==============11111111111111111111111111111111111111111111111111111111111111111111111111=============
3e14 ============111111111111111111111111111111111111111=============================1111111111===========
4e17 ===========1111111111111111111111111111111111111111===============================1111111111=========
4e20 =======11111111111111111111111111111111111111111111=================================1111111111=======
4e23 ======111111111111111111111111111111111111111111111===================================1111111111=====
4e26 ====11111111111111111111111111111111111111111111111=====================================111=111111===
4e29 ==1111111111111111111111111111111111111111111111111=======================================1111111111=
5e32 111111111111111111111111111111111111111111111111111=========================================111=11111
5e35 E11111111111111111111111111111111111111111111111111==========================================111==11E
-inf -3e29 -2e20 -1e11 -1e2 -8e-8 -6e-1 -4e-2 -3e-3 1e-33 1e-24 2e-15 3e-6 4e3 5e12 8e21 1e31
| ULP-difference | z | jax:log(z) | mpmath:log(z) | numpy:log(z) |
|---|---|---|---|---|
| 4294967296 | (-inf-infj) | (inf-2.3561945j) | (inf+nanj) | (inf-2.3561945j) |
| 4294967296 | (inf-infj) | (inf-0.7853982j) | (inf+nanj) | (inf-0.7853982j) |
| 4294967296 | (-8.912321e-39-5.88902e-39j) | (-inf+nanj) | (-87.432236-2.5576816j) | (-87.432236-2.5576816j) |
| 4294967296 | (-2.9728335e+38+1.6980625e+38j) | (inf+2.622624j) | (88.72893+2.622624j) | (88.72893+2.622624j) |
| 4294967296 | (2.9724068e+38+1.6980625e+38j) | (inf+0.5190306j) | (88.72882+0.5190305j) | (88.72882+0.5190306j) |
| 1044824631 | (3.0017088e-38+5.900613e-39j) | (-86.399055+0j) | (-86.3801+0.19410025j) | (-86.3801+0.19410025j) |
| 1002459918 | (1.0053276e-36+5.900613e-39j) | (-82.88775+0j) | (-82.88773+0.005869276j) | (-82.88773+0.005869276j) |
| 959979525 | (3.3603466e-35+5.900613e-39j) | (-79.37843+0j) | (-79.37843+0.00017559536j) | (-79.37843+0.00017559536j) |
| 917542955 | (1.1211664e-33+5.900613e-39j) | (-75.87094+0j) | (-75.87094+5.2629234e-06j) | (-75.87094+5.2629234e-06j) |
| 875145169 | (3.73447e-32+5.900613e-39j) | (-72.36512+0j) | (-72.36512+1.5800403e-07j) | (-72.36512+1.5800403e-07j) |
| 832781768 | (1.2419864e-30+5.900613e-39j) | (-68.86084+0j) | (-68.86084+4.750948e-09j) | (-68.86084+4.750948e-09j) |
| 790448994 | (4.1246158e-29+5.900613e-39j) | (-65.357994+0j) | (-65.357994+1.4305848e-10j) | (-65.357994+1.4305848e-10j) |
| 748143618 | (1.36796e-27+5.900613e-39j) | (-61.856476+0j) | (-61.856476+4.3134394e-12j) | (-61.856476+4.3134394e-12j) |
| 705862850 | (4.5313372e-26+5.900613e-39j) | (-58.356194+0j) | (-58.356194+1.3021791e-13j) | (-58.356194+1.3021791e-13j) |
| 663604264 | (1.4992649e-24+5.900613e-39j) | (-54.857067+0j) | (-54.857067+3.935671e-15j) | (-54.857067+3.935671e-15j) |
| 621365744 | (4.9552058e-23+5.900613e-39j) | (-51.35902+0j) | (-51.35902+1.1907907e-16j) | (-51.35902+1.1907907e-16j) |
| 579145435 | (1.6360845e-21+5.900613e-39j) | (-47.86198+0j) | (-47.86198+3.606545e-18j) | (-47.86198+3.606545e-18j) |
| 536941705 | (5.39681e-20+5.900613e-39j) | (-44.365894+0j) | (-44.365894+1.093352e-19j) | (-44.365894+1.093352e-19j) |
| 494182778 | (1.8224923e-18+5.900613e-39j) | (-40.846325+0j) | (-40.846325+3.2376613e-21j) | (-40.846325+3.2376613e-21j) |
| 451380107 | (6.162399e-17+5.900613e-39j) | (-37.32548+0j) | (-37.32548+9.575188e-23j) | (-37.32548+9.575188e-23j) |
| ... | ... | ... | ... | ... |
Metadata
Metadata
Assignees
Labels
No labels
Activity
pearu commentedon Dec 30, 2024
With https://github.com/pearu/stablehlo/tree/pearu/log, we'll have
Details
Details
pearu commentedon Dec 30, 2024
The result of
is
that is, using jax functions directly will produce equivalent result to numpy functions.
pearu commentedon Dec 31, 2024
With the following scripts:
it was established that in the stablehlo->xla->jax path, the
complex_logalgorithm transforms such thatsum_2sum([-one, yyh, xxh, yyl, xxl], fast=fast)gives different result in the beginning and end of the path.A more stable algorithm is obtained by using
sum_2sum([-one, max(yyh, xxh), min(yyh, xxh), yyl, xxl], fast=fast)pearu commentedon Dec 31, 2024
Applying the above fix to https://github.com/pearu/stablehlo/tree/pearu/log, we'll have
Details
Details
Add StableHLO complex log to stablehlo-complex-math-expander pass (#2681