3 ms·
The concrete routine that is dispatched to is based on the type of the input number. So `sqrt(2.0)` will, in the end, call the assembly-instruction (depending
by kristofferc 8y ago
The concrete routine that is dispatched to is based on the type of the input number.
So `sqrt(2.0)` will, in the end, call the assembly-instruction (depending on your specific CPU) `vsqrtss` since the input type is a 64-bit float,
`sqrt(Float32(2.0))` will end up calling `vsqrtsd`, `sqrt(big"2.0")` will call the sqrt
from the arbitrary precision library (MPFR) since we now have a "BigFloat" number etc.
Directly from a Julia REPL session:
julia> sqrt(2.0)
1.4142135623730951
julia> sqrt(Float32(2.0))
1.4142135f0
julia> sqrt(big"2.0")
1.414213562373095048801688724209698078569671875376948073176679737990732478462102
julia> setprecision(512) # Bump the precision
512
julia> sqrt(big"2.0")
1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993586
- ColinWright 8y agoYes, but I'm talking about getting exact BigInt ceil square roots of BigInt inputs. I've not found anything about whether that is supported natively or in a library.