All Projects → stevengj → ChangePrecision.jl

stevengj / ChangePrecision.jl

Licence: other
macro to change the default floating-point precision in Julia code

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to ChangePrecision.jl

DecFP.jl
Julia IEEE decimal floating-point via the Intel decimal-float library
Stars: ✭ 49 (+75%)
Mutual labels:  math, floating-point
DoubleFloats.jl
math with more good bits
Stars: ✭ 102 (+264.29%)
Mutual labels:  math, floating-point
Computer-Vision
implemented some computer vision problems
Stars: ✭ 25 (-10.71%)
Mutual labels:  math
desktop
Extendable calculator for the 21st Century ⚡
Stars: ✭ 85 (+203.57%)
Mutual labels:  math
yt-channels-DS-AI-ML-CS
A comprehensive list of 180+ YouTube Channels for Data Science, Data Engineering, Machine Learning, Deep learning, Computer Science, programming, software engineering, etc.
Stars: ✭ 1,038 (+3607.14%)
Mutual labels:  math
cray
A real-time interactive progressive path tracer on the GPU.
Stars: ✭ 35 (+25%)
Mutual labels:  math
WordMat
WordMat is an add-in to MicroSoft Word enabling math functionality
Stars: ✭ 25 (-10.71%)
Mutual labels:  math
launchpad
Resources to get started in Quantum Computing!
Stars: ✭ 21 (-25%)
Mutual labels:  math
GNFS
A complete, proof-of-concept, C# implementation of the General Number Field Sieve algorithm for factoring very large semi-prime numbers. The focus was on readability and understandability of the code, not performance.
Stars: ✭ 39 (+39.29%)
Mutual labels:  math
calculus-notes
微积分学笔记,包含极限论、微分、积分、级数理论.
Stars: ✭ 67 (+139.29%)
Mutual labels:  math
quickcalc
Simple Menu Bar Application For Mac
Stars: ✭ 37 (+32.14%)
Mutual labels:  math
pi
A little project for celebrating PI day
Stars: ✭ 16 (-42.86%)
Mutual labels:  math
purescript-quantities
Physical quantities and units
Stars: ✭ 44 (+57.14%)
Mutual labels:  math
mathlion
Mathlion is an advanced math plugin for Kibana's Timelion
Stars: ✭ 77 (+175%)
Mutual labels:  math
Quaternion.js
A JavaScript Quaternion library
Stars: ✭ 86 (+207.14%)
Mutual labels:  math
MROGeometry
♊️ Mirror of http://purl.mro.name/ios/MROGeometry | √ C and Objective C math and geometry helpers
Stars: ✭ 58 (+107.14%)
Mutual labels:  math
dogma
Things and stuffs.
Stars: ✭ 22 (-21.43%)
Mutual labels:  math
bcmath-extended
Extends php BCMath lib for missing functions like floor, ceil, round, abs, min, max, rand for big numbers. Also wraps existing BCMath functions.
Stars: ✭ 59 (+110.71%)
Mutual labels:  math
vecti
A tiny TypeScript library for 2D vector math.
Stars: ✭ 14 (-50%)
Mutual labels:  math
SdfFontDesigner
Offline font tuning/bitmap generation via shaders
Stars: ✭ 56 (+100%)
Mutual labels:  math

ChangePrecision

Build Status Build status

This package makes it easy to change the "default" precision of a large body of Julia code, simply by prefixing it with the @changeprecision T expression macro, for example:

@changeprecision Float32 begin
    x = 7.3
    y = 1/3
    z = rand() .+ ones(3,4)
end

In particular, floating-point literals like 7.3 are reinterpreted as the requested type Float32, operations like / that convert integer arguments to Float64 instead convert to Float32, and random-number or matrix constructors like rand and ones default to Float32 instead of Float64. Several other cases are handled as well: arithmetic with irrational constants like pi, linear-algebra functions (like inv) on integer matrices, etcetera.

The @changeprecision transformations are applied recursively to any include(filename) call, so that you can simply do @changeprecision Float32 include("mycode.jl") to run a whole script mycode.jl in Float32 default precision.

Code that explicitly specifies a type, e.g. rand(Float64), is unaffected by @changeprecision.

Note that only expressions that explicitly appear in the expression (or code inserted by include) are converted by @changeprecision. Code hidden inside external functions that are called is not affected.

This package is for quick experiments, not production code

This package was designed for quick hacks, where you want to experiment with the effect of a change in precision on a bunch of code. For production code and long-term software development in Julia, you are strongly urged to write precision-independent code — that is, your functions should determine their working precision from the precision of their arguments, so that by simply passing data in a different precision they compute in that precision.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].