summary refs log tree commit diff stats
path: root/tests/procvar
ModeNameSize
-rw-r--r--tprocvar.nim822log stats plain blame
-rw-r--r--tprocvarmismatch.nim213log stats plain blame
till not green' href='/ahoang/Nim/commit/nimsuggest/tests/tstrutils.nim?h=devel&id=ab1787e7db2d12261cbf60f7bf5934a30371bbf0'>ab1787e7d ^
76a28d8b8 ^
08c94ef6b ^

ab1787e7d ^
08c94ef6b ^

1
2
3
4
5
6
7
8
9
           
                                          
                                 
                                                                                                                                                                                                                 

   
                                                                      

                                                      
hlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#
#
#            Nim's Runtime Library
#        (c) Copyright 2017 Nim contributors
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

## This module offers implementations of common binary operations
## like `+`, `-`, `*`, `/` and comparison operations,
## which work for mixed float/int operands.
## All operations convert the integer operand into the
## type of the float operand. For numerical expressions, the return
## type is always the type of the float involved in the expression,
## i.e., there is no auto conversion from float32 to float64.
##
## **Note:** In general, auto-converting from int to float loses
## information, which is why these operators live in a separate
## module. Use with care.
##
## Regarding binary comparison, this module only provides unequal operators.
## The equality operator `==` is omitted, because depending on the use case
## either casting to float or rounding to int might be preferred, and users
## should make an explicit choice.

func `+`*[I: SomeInteger, F: SomeFloat](i: I, f: F): F {.inline.} =
  F(i) + f
func `+`*[I: SomeInteger, F: SomeFloat](f: F, i: I): F {.inline.} =
  f + F(i)

func `-`*[I: SomeInteger, F: SomeFloat](i: I, f: F): F {.inline.} =
  F(i) - f
func `-`*[I: SomeInteger, F: SomeFloat](f: F, i: I): F {.inline.} =
  f - F(i)

func `*`*[I: SomeInteger, F: SomeFloat](i: I, f: F): F {.inline.} =
  F(i) * f
func `*`*[I: SomeInteger, F: SomeFloat](f: F, i: I): F {.inline.} =
  f * F(i)

func `/`*[I: SomeInteger, F: SomeFloat](i: I, f: F): F {.inline.} =
  F(i) / f
func `/`*[I: SomeInteger, F: SomeFloat](f: F, i: I): F {.inline.} =
  f / F(i)

func `<`*[I: SomeInteger, F: SomeFloat](i: I, f: F): bool {.inline.} =
  F(i) < f
func `<`*[I: SomeInteger, F: SomeFloat](f: F, i: I): bool {.inline.} =
  f < F(i)
func `<=`*[I: SomeInteger, F: SomeFloat](i: I, f: F): bool {.inline.} =
  F(i) <= f
func `<=`*[I: SomeInteger, F: SomeFloat](f: F, i: I): bool {.inline.} =
  f <= F(i)

# Note that we must not defined `>=` and `>`, because system.nim already has a
# template with signature (x, y: untyped): untyped, which would lead to
# ambiguous calls.