Operator overloading, general real functions#
Operator overloading: scope and restrictions#
Compatible operators
The cost of creating and destroying objects#
Some text
Raw addition of two floating point numbers#
- ctx.rawadd(res, x, y)#
where
ctxismath53,ctxboostorctxflint.Sets
resto the sum of the floating point numberxandy.An example in Python
>>> from xlcalcnet import XComplex >>> XComplex.Abs(0.5) XComplex('5.2359877559829887307E-1') >>> XComplex.Abs('0.1') XComplex('5.3518479027559984754E-1')
An example in Visual Basic
>>> from xlcalcnet import Gpc >>> Gpc.Abs(0.5) Gpc('5.2359877559829887307E-1') >>> Gpc.Abs('0.1') Gpc('5.3518479027559984754E-1')
Raw subtraction of two floating point numbers#
- ctx.rawsub(res, x, y)#
where
ctxismath53,ctxboostorctxflint.Sets
resto the difference of the floating point numbersxandy.An example in Python
>>> from xlcalcnet import XComplex >>> XComplex.Abs(0.5) XComplex('5.2359877559829887307E-1') >>> XComplex.Abs('0.1') XComplex('5.3518479027559984754E-1')
An example in Visual Basic
>>> from xlcalcnet import Gpc >>> Gpc.Abs(0.5) Gpc('5.2359877559829887307E-1') >>> Gpc.Abs('0.1') Gpc('5.3518479027559984754E-1')
Raw multiplication of two floating point numbers#
- ctx.rawmul(res, x, y)#
where
ctxismath53,ctxboostorctxflint.Sets
resto the product of the floating point numbersxandy.An example in Python
>>> from xlcalcnet import XComplex >>> XComplex.Abs(0.5) XComplex('5.2359877559829887307E-1') >>> XComplex.Abs('0.1') XComplex('5.3518479027559984754E-1')
An example in Visual Basic
>>> from xlcalcnet import Gpc >>> Gpc.Abs(0.5) Gpc('5.2359877559829887307E-1') >>> Gpc.Abs('0.1') Gpc('5.3518479027559984754E-1')
Raw division of two floating point numbers#
- ctx.rawdiv(res, x, y)#
where
ctxismath53,ctxboostorctxflint.Sets
resto the quotient of the floating point numbersxandy.An example in Python
>>> from xlcalcnet import XComplex >>> XComplex.Abs(0.5) XComplex('5.2359877559829887307E-1') >>> XComplex.Abs('0.1') XComplex('5.3518479027559984754E-1')
An example in Visual Basic
>>> from xlcalcnet import Gpc >>> Gpc.Abs(0.5) Gpc('5.2359877559829887307E-1') >>> Gpc.Abs('0.1') Gpc('5.3518479027559984754E-1')
Raw addition of a floating point number and a signed 32 bit integer#
- ctx.rawaddint32(res, x, i)#
where
ctxismath53,ctxboostorctxflint.Sets
resto the sum of the floating point numberxand the signed 32 bit integeri.An example in Python
>>> from xlcalcnet import XComplex >>> XComplex.Abs(0.5) XComplex('5.2359877559829887307E-1') >>> XComplex.Abs('0.1') XComplex('5.3518479027559984754E-1')
An example in Visual Basic
>>> from xlcalcnet import Gpc >>> Gpc.Abs(0.5) Gpc('5.2359877559829887307E-1') >>> Gpc.Abs('0.1') Gpc('5.3518479027559984754E-1')
Raw subtraction of a floating point number and a signed 32 bit integer#
- ctx.rawsubint32(res, x, i)#
- ctx.rawIntSub(res, x, i)#
where
ctxismath53,ctxboostorctxflint.Sets
resto the difference of the floating point numberxand the signed 32 bit integeri(SubInt) or to the difference of the signed 32 bit integerithe floating point numberx(IntSub).An example in Python
>>> from xlcalcnet import XComplex >>> XComplex.Abs(0.5) XComplex('5.2359877559829887307E-1') >>> XComplex.Abs('0.1') XComplex('5.3518479027559984754E-1')
An example in Visual Basic
>>> from xlcalcnet import Gpc >>> Gpc.Abs(0.5) Gpc('5.2359877559829887307E-1') >>> Gpc.Abs('0.1') Gpc('5.3518479027559984754E-1')
Raw multiplication of a floating point number and a signed 32 bit integer#
- ctx.rawmulint32(res, x, i)#
where
ctxismath53,ctxboostorctxflint.Sets
resto the product of the floating point numberxand the signed 32 bit integeri.An example in Python
>>> from xlcalcnet import XComplex >>> XComplex.Abs(0.5) XComplex('5.2359877559829887307E-1') >>> XComplex.Abs('0.1') XComplex('5.3518479027559984754E-1')
An example in Visual Basic
>>> from xlcalcnet import Gpc >>> Gpc.Abs(0.5) Gpc('5.2359877559829887307E-1') >>> Gpc.Abs('0.1') Gpc('5.3518479027559984754E-1')
Raw division of a floating point number and a signed 32 bit integer#
- ctx.rawdivint32(res, x, i)#
- ctx.rawIntDiv(res, i, x)#
where
ctxismath53,ctxboostorctxflint.Sets
resto the quotient of the floating point numberxand the signed 32 bit integeri(DivInt) or to the quotient of the signed 32 bit integerithe floating point numberx(IntDiv).An example in Python
>>> from xlcalcnet import XComplex >>> XComplex.Abs(0.5) XComplex('5.2359877559829887307E-1') >>> XComplex.Abs('0.1') XComplex('5.3518479027559984754E-1')
An example in Visual Basic
>>> from xlcalcnet import Gpc >>> Gpc.Abs(0.5) Gpc('5.2359877559829887307E-1') >>> Gpc.Abs('0.1') Gpc('5.3518479027559984754E-1')
Fused multiplication and addition: \(\mathrm{fma}(x, y, z)\)#
- ctx.fma(x, y, z)#
where
ctxismath53,ctxboostorctxflint.If successful, returns the value of x * y + z as if calculated to infinite precision and rounded once to fit the result type (or, alternatively, calculated as a single ternary floating-point operation).
See also: https://en.cppreference.com/w/cpp/numeric/math/fma
An example in Python
>>> from xlcalcnet import xreal >>> xreal.Copysign(0.5, 2) xreal('5.2359877559829887307E-1') >>> xreal.Copysign('0.51', 2) xreal('5.3518479027559984754E-1')
An example in Visual Basic
>>> from xlcalcnet import Gpr >>> Gpr.Copysign(0.5, 2) Gpr('5.2359877559829887307E-1') >>> Gpr.Copysign('0.51', 2) Gpr('5.3518479027559984754E-1') >>> qreal.Copysign('0.51', 2) Gpr('5.3518479027559984754E-1')
Maximum of two floating point numbers: \(\mathrm{fmax}(x, y)\)#
- ctx.fmax(x, e)#
where
ctxismath53,ctxboostorctxflint.Returns the maximum of two floating point numbers; \(x,y \ne\) NAN.
Returns the larger of two floating point arguments, treating NaNs as missing data (between a NaN and a numeric value, the numeric value is chosen). Only if both arguments are NaN, NaN is returned.
This function is not required to be sensitive to the sign of zero, although some implementations additionally enforce that if one argument is +0 and the other is -0, then +0 is returned.
See also: https://en.cppreference.com/w/cpp/numeric/math/fmax
An example in Python
>>> from xlcalcnet import xreal >>> xreal.Max(0.5, 2) xreal('5.2359877559829887307E-1') >>> xreal.Max('0.51', 2) xreal('5.3518479027559984754E-1')
An example in Visual Basic
>>> from xlcalcnet import Gpr >>> Gpr.Max(0.5, 2) Gpr('5.2359877559829887307E-1') >>> Gpr.Max('0.51', 2) Gpr('5.3518479027559984754E-1')
Minimum of two floating point numbers: \(\mathrm{fmin}(x, y)\)#
- ctx.fmin(x, y)#
where
ctxismath53,ctxboostorctxflint.Returns the minimum of two floating point numbers; \(x,y \ne\) NAN.
Returns the smaller of two floating point arguments, treating NaNs as missing data (between a NaN and a numeric value, the numeric value is chosen). Only if both arguments are NaN, NaN is returned.
This function is not required to be sensitive to the sign of zero, although some implementations additionally enforce that if one argument is +0 and the other is -0, then -0 is returned.
See also: https://en.cppreference.com/w/cpp/numeric/math/fmin
An example in Python
>>> from xlcalcnet import xreal >>> xreal.Min(0.5, 2) xreal('5.2359877559829887307E-1') >>> xreal.Min('0.51', 2) xreal('5.3518479027559984754E-1')
An example in Visual Basic
>>> from xlcalcnet import Gpr >>> Gpr.Min(0.5, 2) Gpr('5.2359877559829887307E-1') >>> Gpr.Min('0.51', 2) Gpr('5.3518479027559984754E-1')