Skip to content

Conversation

@juntyr
Copy link
Contributor

@juntyr juntyr commented Jan 17, 2026

Based on numpy/numpy-user-dtypes#256

Co-authored-by: swayaminsync <hawkempire007@gmail.com>
Copy link
Member

@SwayamInSync SwayamInSync left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Structure looks good to me, added following reviews to correct some values, suggested some notes and a bit format fixing

The smallest positive normal (normalized, mantissa has a leading 1 bit) quad-precision value.
:value: :math:`2^{-16382} \cdot (1 - 2^{-112})` or approximately :math:`3.36 \cdot 10^{-4932}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:value: :math:`2^{-16382} \cdot (1 - 2^{-112})` or approximately :math:`3.36 \cdot 10^{-4932}`
:value: :math:`2^{-16382}` or approximately :math:`3.36 \cdot 10^{-4932}`

No multiplier is needed here, what you wrote earlier was the "Largest Subnormal Value" (We don't need to document that)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took this from https://sleef.org/quad.xhtml for SLEEF_QUAD_MIN

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe they made error as well, IEEE does not define it like this https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format

you can confirm this from code too,

import numpy as np
from numpy_quaddtype import QuadPrecision, QuadPrecDType

info = np.finfo(QuadPrecDType())

two = QuadPrecision(2)
smallest_normal_theoretical = two ** QuadPrecision(-16382)


print("Are they equal?", info.smallest_normal == smallest_normal_theoretical) # True

sleef_formula = (two ** QuadPrecision(-16382)) * (QuadPrecision(1) - two ** QuadPrecision(-112))
print("Are they equal?", info.smallest_normal == sleef_formula) # False

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll also recommend to run this code on Mac as well :) (I'll run later as I get access to my machine)
My current machine supports __float128 so maybe because of aliasing I am getting true results as per standard.

If they made mistake in their implementation then it'll get caught

@@ -1,8 +1,108 @@
```{include} ../README.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of information present in README is missing here, like source installation, TSan build, documentation build, etc.
So ideally we should add those

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can maybe selectively copy the sections from there to here

Co-authored-by: Swayam <hawkempire007@gmail.com>

| Function | Description |
|----------|-------------|
| `np.dot` | Dot product |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `np.dot` | Dot product |

We do not support dot function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants