Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Python-Blosc2 documentation
Logo
Python-Blosc2 documentation
  • Getting Started
    • Overview
    • Installation
  • Tutorials
    • NDArray: A NDim, Compressed Data Container
    • Expressions containing NDArray objects
    • User Defined Functions
    • Lazy array kernels with Menudet
    • Optimizing data reductions with NDArrays
    • Advanced Lazy Expressions and Persistent Reductions
    • Using Proxies for Efficient Handling of Remote Multidimensional Data
    • Compressing data with the SChunk class
    • Slicing, extending and serializing with SChunks
    • User-defined codecs and filters
    • Prefilters, postfilters and fillers
    • Working with Containers
    • Working with ObjectArray
    • Working with BatchArray
    • CTable Tutorial
    • Indexing Arrays
    • Indexing CTables
  • Guides
    • Performance & Benchmarks
    • Optimization tips
    • Menudet: portable computation
    • Migrating to Menudet
    • Working with Remote Data
    • Working with Remote Arrays
    • Working with Remote Tables
    • Sharing Containers Across Processes
    • Using Blosc2 with pandas
    • b2view: Browse TreeStore Bundles in the Terminal
    • Parquet to Blosc2 Walkthrough
  • API Reference
    • Blosc2 Classes
      • NDArray
      • C2Array
      • LazyArray
      • BatchArray
      • ListArray
      • ObjectArray
      • Proxy
      • RemoteObject
      • RemoteArray
      • RemoteStore
      • RemoteRepository
      • RemoteFile
      • RemoteCTable
      • ProxySource
      • ProxyNDSource
      • ByteRangeNDSource
      • FsspecNDSource
      • ZarrNDSource
      • HDF5NDSource
      • B2ZNDSource
      • SimpleProxy
      • Traffic
      • EmbedStore
      • DictStore
      • TreeStore
      • CTable
      • Column
      • NestedColumn
      • Schema Specs
      • Index
      • SChunk
      • Array
      • NDField
      • Ref
    • Operations with arrays
      • Universal Functions (ufuncs)
      • Reduction Functions
      • Linear Algebra
      • Random Functions
      • Additional Functions and Type Utilities
      • Indexing and Manipulation Functions and Utilities
    • Miscellaneous
    • Compression Utilities
      • blosc2.compress
      • blosc2.compress2
      • blosc2.decompress
      • blosc2.decompress2
      • blosc2.pack
      • blosc2.pack_array
      • blosc2.pack_array2
      • blosc2.pack_tensor
      • blosc2.unpack
      • blosc2.unpack_array
      • blosc2.unpack_array2
      • blosc2.unpack_tensor
      • blosc2.clib_info
      • blosc2.compressor_list
      • blosc2.detect_number_of_cores
      • blosc2.free_resources
      • blosc2.get_clib
      • blosc2.nthreads
      • blosc2.print_versions
      • blosc2.register_codec
      • blosc2.register_filter
      • blosc2.set_blocksize
      • blosc2.set_nthreads
      • blosc2.set_prefetch
      • blosc2.set_releasegil
      • blosc2.set_compressor
      • blosc2.get_compressor
      • blosc2.get_blocksize
      • blosc2.get_cbuffer_sizes
      • blosc2.cparams_dflts
      • blosc2.dparams_dflts
      • blosc2.storage_dflts
      • blosc2.Codec
      • blosc2.Filter
      • blosc2.SpecialValue
      • blosc2.SplitMode
      • blosc2.Tuner
      • blosc2.compute_chunks_blocks
      • blosc2.get_slice_nchunks
      • blosc2.remove_urlpath
      • blosc2.blosclib_version
      • blosc2.DEFINED_CODECS_STOP
      • blosc2.GLOBAL_REGISTERED_CODECS_STOP
      • blosc2.USER_REGISTERED_CODECS_STOP
      • blosc2.EXTENDED_HEADER_LENGTH
      • blosc2.MAX_BUFFERSIZE
      • blosc2.MAX_BLOCKSIZE
      • blosc2.MAX_OVERHEAD
      • blosc2.MAX_TYPESIZE
      • blosc2.MIN_HEADER_LENGTH
      • blosc2.prefilter_funcs
      • blosc2.postfilter_funcs
      • blosc2.ucodecs_registry
      • blosc2.ufilters_registry
      • blosc2.VERSION_DATE
      • blosc2.VERSION_STRING
      • blosc2.__version__
    • Compression, decompression and storage parameters
    • Save and load
    • Expression Utilities
    • Menudet syntax
    • Menudet API
    • Menudet numerical behavior
    • JIT execution options
  • Glossary
  • Development
    • Contributing guidelines
    • Code of Conduct
    • List of desired features for a 4.0 release
    • Remote cache design
    • Menudet numerical qualification
    • Typed expression evaluator rollout
  • Release Notes
Back to top

Menudet numerical behavior¶

Menudet uses NumPy-style typing and numerical rules, but does not promise bit-identical results with every NumPy operation or across platforms.

Types and conversions¶

  • Intermediate types follow the operands. A wider output dtype does not widen intermediate arithmetic.

  • Typed integer arithmetic wraps at its computation width. Python scalar captures and literals follow NumPy 2.x scalar-strength rules; out-of-range scalar construction is checked.

  • Floating-to-integer conversions truncate and reject nonfinite or out-of-range values.

  • Output conversion defaults to casting="unsafe". Use "same_kind" or "safe" to restrict it.

Arithmetic edge cases and crash-proof safety¶

To ensure that untrusted kernels or edge-case inputs never crash the host process with hardware signals (such as SIGFPE) or trigger compiler undefined behavior, Menudet 0.1 enforces strict arithmetic semantics across both the native interpreter and JIT backends:

  • Signed integer overflow: Guaranteed two’s complement wrapping modulo $2^W$ (e.g. $2^{32}$ for int32, $2^{64}$ for int64). Unlike standard C, signed integer overflow is fully defined, deterministic, and portable.

  • Bitwise shift safety: Left and right shift counts are masked to shift_amount & (W - 1) (e.g. & 31 for 32-bit types, & 63 for 64-bit types). Shifts never trigger CPU faults, hardware exceptions, or undefined behavior, even for negative or out-of-range shift counts.

  • Division and modulo by zero: Integer division or modulo by zero never raises a hardware exception or crashes the host process. Integer x / 0 evaluates to 0 and x % 0 evaluates to 0. Floating-point division by zero (x / 0.0) follows IEEE 754 and yields inf or nan.

  • Signed minimum division: In two’s complement, dividing the most negative number by -1 (e.g. INT_MIN / -1) wraps safely back to INT_MIN without triggering a CPU trap.

Floating-point accuracy¶

Math functions can differ between platforms and math libraries. There is no universal ULP error bound or cross-platform bitwise guarantee. Use tolerances appropriate to your data when comparing floating-point results.

Complex kernels currently use the interpreter only. Complex floor division, remainder, bitwise operations and explicit complex-to-real casts are unsupported.

Reductions¶

Block reductions operate within the logical partitions you choose, not storage chunks. Slicing and rechunking a result preserve those groups. Reduction grouping can differ from NumPy, and parallel floating-point sums can vary with thread count.

Integer block sums and products use checked 64-bit accumulators and raise on overflow. Integer block means use checked accumulation and return float64. Empty sums/products have their usual identities; empty means return NaN and empty extrema raise an error.

Floating-point errors¶

Eager kernel methods offer fp_errors="raise" and return_status=True; the default is fp_errors="ignore". NumPy-style warning callbacks are not provided. Status reporting is unavailable on WASM: check the returned supported flag rather than treating missing flags as proof that no error occurred.

See the API reference for method options and links to the full language specification.

Next
JIT execution options
Previous
Menudet API
Copyright © 2019-present, The Blosc Developers
Made with Sphinx and @pradyunsg's Furo
On this page
  • Menudet numerical behavior
    • Types and conversions
    • Arithmetic edge cases and crash-proof safety
    • Floating-point accuracy
    • Reductions
    • Floating-point errors