Skip to content

Instantly share code, notes, and snippets.

2023-02-21T22:44:21.0827343Z Draw 1 (x): tensor(184550662, dtype=torch.int32)
2023-02-21T22:44:21.0827853Z Draw 2 (s): 0
2023-02-21T22:44:21.0828094Z Trying example: test_remainder(
2023-02-21T22:44:21.0828325Z data=data(...),
2023-02-21T22:44:21.0828668Z ctx=BinaryParamContext(<__mod__(x, s)>),
2023-02-21T22:44:21.0828929Z )
2023-02-21T22:44:21.0829235Z Draw 1 (x): tensor(-16, dtype=torch.int32)
2023-02-21T22:44:21.0829490Z Draw 2 (s): 74
2023-02-21T22:44:21.3006068Z Fatal Python error: Floating point exception
2023-02-21T22:44:21.3006317Z
>>> from sympy.functions.elementary.trigonometric import _cospi257
>>> expr = _cospi257()
>>> expr
sqrt(sqrt(2)*sqrt(-sqrt(-2*sqrt((-sqrt(257)/8 - sqrt(-4*sqrt(257) + (-sqrt(257)/4 - 1/4 + sqrt(64 + (-sqrt(257)/2 - 1/2)**2)/2)**2 + 16 + 4*sqrt(64 + (-sqrt(257)/2 - 1/2)**2))/2 - 1/8 + sqrt(64 + (-sqrt(257)/2 - 1/2)**2)/4)**2 + 2*sqrt(-4*sqrt(257) + (-sqrt(257)/4 - 1/4 + sqrt(64 + (-sqrt(257)/2 - 1/2)**2)/2)**2 + 16 + 4*sqrt(64 + (-sqrt(257)/2 - 1/2)**2)) + 4 + 2*sqrt(-4*sqrt(257) - 4*sqrt(64 + (-sqrt(257)/2 - 1/2)**2) + 16 + (-sqrt(64 + (-sqrt(257)/2 - 1/2)**2)/2 - sqrt(257)/4 - 1/4)**2) + 2*sqrt((-1/2 + sqrt(257)/2)**2 + 64) + 4*sqrt(-4*sqrt((-1/2 + sqrt(257)/2)**2 + 64) + (-sqrt((-1/2 + sqrt(257)/2)**2 + 64)/2 - 1/4 + sqrt(257)/4)**2 + 16 + 4*sqrt(257)) + 2*sqrt(257)) - sqrt(16 + 4*sqrt((-1/2 + sqrt(257)/2)**2 + 64) + 4*sqrt(257) + (-1/4 + sqrt(257)/4 + sqrt((-1/2 + sqrt(257)/2)**2 + 64)/2)**2) - 2*sqrt(-2*sqrt(257) - 2*sqrt(16 + 4*sqrt((-1/2 + sqrt(257)/2)**2 + 64) + 4*sqrt(257) + (-1/4 + sqrt(257)/4 + sqrt
@asmeurer
asmeurer / Array API Tests Example JSON Report
Last active September 7, 2022 19:15
Array API Tests Example JSON Report
Example JSON reports for the array API tests (see https://github.com/data-apis/array-api-tests/pull/131).
from typing import List, TypeVar
from docutils import nodes
from docutils.nodes import Element
from sphinx import addnodes
from sphinx.application import Sphinx
from sphinx.environment.adapters.toctree import TocTree
import sphinx.environment.collectors.toctree as toctree_collector
from sphinx.transforms import SphinxContentsFilter
@asmeurer
asmeurer / WGAC AA pygments styles
Last active June 3, 2022 02:55
WGAC AA pygments styles
# Making WCAG AA compliant pygments themes with better color contrast
The WCAG AA standard requires colors to have at least 4.5 contrast ratio
against their background. Most pygments styles do not follow this, but with
some (usually small) modifications, they can.
This process is a little hacky, but it works. It would be better to convert
this whole process into a single Python script/library, but I got the themes I
care about. If anyone else wants to do that, please do so. Here are the steps
I used
conda-forge/noarch::absl-py-0.15.0-pyhd8ed1ab_0
conda-forge/noarch::alabaster-0.7.12-py_0
conda-forge/osx-64::appnope-0.1.2-py39h6e9494a_1
conda-forge/noarch::attrs-21.2.0-pyhd8ed1ab_0
conda-forge/osx-64::awkward1-0.4.5-py39he45765d_0
conda-forge/noarch::babel-2.9.1-pyh44b312d_0
conda-forge/noarch::backcall-0.2.0-pyh9f0ad1d_0
conda-forge/noarch::backports-1.0-py_2
conda-forge/noarch::backports.functools_lru_cache-1.6.4-pyhd8ed1ab_0
conda-forge/noarch::beautifulsoup4-4.10.0-pyha770c72_0
conda-forge/noarch::absl-py-0.15.0-pyhd8ed1ab_0
conda-forge/noarch::alabaster-0.7.12-py_0
conda-forge/osx-64::appnope-0.1.2-py39h6e9494a_1
conda-forge/noarch::attrs-21.2.0-pyhd8ed1ab_0
conda-forge/osx-64::awkward1-0.4.5-py39he45765d_0
conda-forge/noarch::babel-2.9.1-pyh44b312d_0
conda-forge/noarch::backcall-0.2.0-pyh9f0ad1d_0
conda-forge/noarch::backports-1.0-py_2
conda-forge/noarch::backports.functools_lru_cache-1.6.4-pyhd8ed1ab_0
conda-forge/noarch::beautifulsoup4-4.10.0-pyha770c72_0
Running from numpy source directory.
Cythonizing sources
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_philox.pyx
Processing numpy/random/_bounded_integers.pyx.in
Processing numpy/random/_sfc64.pyx
Processing numpy/random/_mt19937.pyx
Processing numpy/random/bit_generator.pyx
Processing numpy/random/mtrand.pyx
Processing numpy/random/_generator.pyx
Running from numpy source directory.
Cythonizing sources
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_philox.pyx
Processing numpy/random/_bounded_integers.pyx.in
Processing numpy/random/_sfc64.pyx
Processing numpy/random/_mt19937.pyx
Processing numpy/random/bit_generator.pyx
Processing numpy/random/mtrand.pyx
Processing numpy/random/_generator.pyx
Running from numpy source directory.
Cythonizing sources
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_philox.pyx
Processing numpy/random/_bounded_integers.pyx.in
Processing numpy/random/_sfc64.pyx
Processing numpy/random/_mt19937.pyx
Processing numpy/random/bit_generator.pyx
Processing numpy/random/mtrand.pyx
Processing numpy/random/_generator.pyx