-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StackOverflowError from @fastmath #24
Comments
Thanks for filing this issue. I can reproduce this on the release binary of 0.5.0 for macOS Sierra. The problem seems to be that promotion doesn't always return the same type if there are quantities involved (because it can't, there's no safe type to promote to from quantities with units I don't think it would be that hard to work around by just specializing some methods for
I consider this a bug in Unitful---promotion should at least make the "numeric part" of the types the same, in my view. |
Having implemented some important changes to promotion, I now have |
This sounds great. Is there any way these promotions could be also added to SIUnits so it's compatible? I'd hate to have to drop SIUnits completely, but it is looking more and more like a "legacy" library. |
Fixed on master. Regarding SIUnits, I think it already has the correct behavior for promotion needed to get fastmath working (promoting numbers and quantities will turn the number into a unitless quantity, and the numeric backing types are promoted). Most of what I've done in this package could probably be ported over without much trouble. I don't have time to do that myself, but please feel free to try it out based on my code and submit a PR there if needed. It's mostly just small tweaks to what is found in fastmath.jl in base. |
*note that you may need to delete |
Was going to give this a try on master but got a precompilation error: ERROR: LoadError: LoadError: UndefVarError: DimensionedUnits not defined
in include_from_node1(::String) at .\loading.jl:532
in include(::String) at .\sysimg.jl:14
in defaults() at C:\Users\Chris\.julia\v0.6\Unitful\src\User.jl:261
in include_from_node1(::String) at .\loading.jl:532
in include(::String) at .\sysimg.jl:14
in macro expansion; at .\none:2 [inlined]
in anonymous at .\<missing>:?
in eval(::Module, ::Any) at .\boot.jl:238
in process_options(::Base.JLOptions) at .\client.jl:245
in _start() at .\client.jl:332
while loading C:\Users\Chris\.julia\v0.6\Unitful\deps\Defaults.jl, in expression starting on line 141
while loading C:\Users\Chris\.julia\v0.6\Unitful\src\Unitful.jl, in expression starting on line 878 |
Did you try deleting |
Works beautifully. Thanks |
Unitful.jl is incompatible with
@fastmath
. Here's a small example showing how to get the StackOverflowError (requires that you have optimized Julia to your system, like re-built the system image, and I can only get this error on Linux but not Windows)SIUnits has the same error at Keno/SIUnits.jl#94
The text was updated successfully, but these errors were encountered: