@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public fun < R > CharSequence . windowed ( size : Int , step : Int = <NUM_LIT:1> , partialWindows : Boolean = false , transform : ( CharSequence ) -> R ) : List < R >

{ <EOL> checkWindowSizeStep ( size , step ) <EOL> val thisSize = this . length <EOL> val resultCapacity = thisSize / step + if ( thisSize % step == <NUM_LIT:0> ) <NUM_LIT:0> else <NUM_LIT:1> <EOL> val result = ArrayList < R > ( resultCapacity ) <EOL> var index = <NUM_LIT:0> <EOL> while ( index in <NUM_LIT:0> until thisSize ) { <EOL> val end = index + size <EOL> val coercedEnd = if ( end < <NUM_LIT:0> || end > thisSize ) { if ( partialWindows ) thisSize else break } else end <EOL> result . add ( transform ( subSequence ( index , coercedEnd ) ) ) <EOL> index += step <EOL> } <EOL> return result <EOL> }

/**
 * Returns a list of results of applying the given [transform] function to
 * an each char sequence representing a view over the window of the given [size]
 * sliding along this char sequence with the given [step].
 *
 * Note that the char sequence passed to the [transform] function is ephemeral and is valid only inside that function.
 * You should not store it or allow it to escape in some way, unless you made a snapshot of it.
 * Several last char sequences may have fewer characters than the given [size].
 *
 * Both [size] and [step] must be positive and can be greater than the number of elements in this char sequence.
 * @param size the number of elements to take in each window
 * @param step the number of elements to move the window forward by on an each step, by default 1
 * @param partialWindows controls whether or not to keep partial windows in the end if any,
 * by default `false` which means partial windows won't be preserved
 *
 * @sample samples.collections.Sequences.Transformations.averageWindows
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public fun CharSequence . windowedSequence ( size : Int , step : Int = <NUM_LIT:1> , partialWindows : Boolean = false ) : Sequence < String >

{ <EOL> return windowedSequence ( size , step , partialWindows ) { it . toString ( ) } <EOL> }

/**
 * Returns a sequence of snapshots of the window of the given [size]
 * sliding along this char sequence with the given [step], where each
 * snapshot is a string.
 *
 * Several last strings may have fewer characters than the given [size].
 *
 * Both [size] and [step] must be positive and can be greater than the number of elements in this char sequence.
 * @param size the number of elements to take in each window
 * @param step the number of elements to move the window forward by on an each step, by default 1
 * @param partialWindows controls whether or not to keep partial windows in the end if any,
 * by default `false` which means partial windows won't be preserved
 *
 * @sample samples.collections.Sequences.Transformations.takeWindows
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public fun < R > CharSequence . windowedSequence ( size : Int , step : Int = <NUM_LIT:1> , partialWindows : Boolean = false , transform : ( CharSequence ) -> R ) : Sequence < R >

{ <EOL> checkWindowSizeStep ( size , step ) <EOL> val windows = ( if ( partialWindows ) indices else <NUM_LIT:0> until length - size + <NUM_LIT:1> ) step step <EOL> return windows . asSequence ( ) . map { index -> <EOL> val end = index + size <EOL> val coercedEnd = if ( end < <NUM_LIT:0> || end > length ) length else end <EOL> transform ( subSequence ( index , coercedEnd ) ) <EOL> } <EOL> }

/**
 * Returns a sequence of results of applying the given [transform] function to
 * an each char sequence representing a view over the window of the given [size]
 * sliding along this char sequence with the given [step].
 *
 * Note that the char sequence passed to the [transform] function is ephemeral and is valid only inside that function.
 * You should not store it or allow it to escape in some way, unless you made a snapshot of it.
 * Several last char sequences may have fewer characters than the given [size].
 *
 * Both [size] and [step] must be positive and can be greater than the number of elements in this char sequence.
 * @param size the number of elements to take in each window
 * @param step the number of elements to move the window forward by on an each step, by default 1
 * @param partialWindows controls whether or not to keep partial windows in the end if any,
 * by default `false` which means partial windows won't be preserved
 *
 * @sample samples.collections.Sequences.Transformations.averageWindows
 */


public infix fun CharSequence . zip ( other : CharSequence ) : List < Pair < Char , Char > >

{ <EOL> return zip ( other ) { c1 , c2 -> c1 to c2 } <EOL> }

/**
 * Returns a list of pairs built from the characters of `this` and the [other] char sequences with the same index
 * The returned list has length of the shortest char sequence.
 *
 * @sample samples.text.Strings.zip
 */


public inline fun < V > CharSequence . zip ( other : CharSequence , transform : ( a : Char , b : Char ) -> V ) : List < V >

{ <EOL> val length = minOf ( this . length , other . length ) <EOL> val list = ArrayList < V > ( length ) <EOL> for ( i in <NUM_LIT:0> until length ) { <EOL> list . add ( transform ( this [ i ] , other [ i ] ) ) <EOL> } <EOL> return list <EOL> }

/**
 * Returns a list of values built from the characters of `this` and the [other] char sequences with the same index
 * using the provided [transform] function applied to each pair of characters.
 * The returned list has length of the shortest char sequence.
 *
 * @sample samples.text.Strings.zipWithTransform
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public fun CharSequence . zipWithNext ( ) : List < Pair < Char , Char > >

{ <EOL> return zipWithNext { a , b -> a to b } <EOL> }

/**
 * Returns a list of pairs of each two adjacent characters in this char sequence.
 *
 * The returned list is empty if this char sequence contains less than two characters.
 *
 * @sample samples.collections.Collections.Transformations.zipWithNext
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public inline fun < R > CharSequence . zipWithNext ( transform : ( a : Char , b : Char ) -> R ) : List < R >

{ <EOL> val size = length - <NUM_LIT:1> <EOL> if ( size < <NUM_LIT:1> ) return emptyList ( ) <EOL> val result = ArrayList < R > ( size ) <EOL> for ( index in <NUM_LIT:0> until size ) { <EOL> result . add ( transform ( this [ index ] , this [ index + <NUM_LIT:1> ] ) ) <EOL> } <EOL> return result <EOL> }

/**
 * Returns a list containing the results of applying the given [transform] function
 * to an each pair of two adjacent characters in this char sequence.
 *
 * The returned list is empty if this char sequence contains less than two characters.
 *
 * @sample samples.collections.Collections.Transformations.zipWithNextToFindDeltas
 */


public fun CharSequence . asIterable ( ) : Iterable < Char >

{ <EOL> if ( this is String && isEmpty ( ) ) return emptyList ( ) <EOL> return Iterable { this . iterator ( ) } <EOL> }

/**
 * Creates an [Iterable] instance that wraps the original char sequence returning its characters when being iterated.
 */


public fun CharSequence . asSequence ( ) : Sequence < Char >

{ <EOL> if ( this is String && isEmpty ( ) ) return emptySequence ( ) <EOL> return Sequence { this . iterator ( ) } <EOL> }

/**
 * Creates a [Sequence] instance that wraps the original char sequence returning its characters when being iterated.
 */


internal inline fun < T : Any ? > runWithTimeoutDumpingCoroutines ( methodName : String , testTimeoutMs : Long , cancelOnTimeout : Boolean , initCancellationException : ( ) -> Throwable , crossinline invocation : ( ) -> T ) : T

{ <EOL> val testStartedLatch = CountDownLatch ( <NUM_LIT:1> ) <EOL> val testResult = FutureTask { <EOL> testStartedLatch . countDown ( ) <EOL> invocation ( ) <EOL> } <EOL> val testThread = Thread ( testResult , "<STR_LIT>" ) . apply { isDaemon = true } <EOL> try { <EOL> testThread . start ( ) <EOL> testStartedLatch . await ( ) <EOL> return testResult . get ( testTimeoutMs , TimeUnit . MILLISECONDS ) <EOL> } catch ( e : TimeoutException ) { <EOL> handleTimeout ( testThread , methodName , testTimeoutMs , cancelOnTimeout , initCancellationException ( ) ) <EOL> } catch ( e : ExecutionException ) { <EOL> throw e . cause ? : e <EOL> } <EOL> }

/**
 * Run [invocation] in a separate thread with the given timeout in ms, after which the coroutines info is dumped and, if
 * [cancelOnTimeout] is set, the execution is interrupted.
 *
 * Assumes that [DebugProbes] are installed. Does not deinstall them.
 */


@ Test <EOL> fun testTransitiveKotlinStdlibDependency ( )

{ <EOL> val dependencies = pluginOrderBugProject . dependencies ( ) <EOL> assertFalse ( dependencies . output . contains ( "<STR_LIT>" ) , "<STR_LIT>" + "<STR_LIT>" ) <EOL> }

/**
 * kotlin-stdlib is an implementation dependency of :atomicfu module,
 * because compileOnly dependencies are not applicable for Native targets (#376).
 *
 * This test ensures that kotlin-stdlib of the Kotlin version used to build kotlinx-atomicfu library is not "required" in the user's project.
 * The user project should use kotlin-stdlib version that is present in it's classpath.
 */


internal fun < T > Iterable < DataFrame < T > > . concatKeepingSchema ( ) : DataFrame < T >

{ <EOL> val dataFrames = asList ( ) <EOL> when ( dataFrames . size ) { <EOL> <NUM_LIT:0> -> return emptyDataFrame ( ) <EOL> <NUM_LIT:1> -> return dataFrames [ <NUM_LIT:0> ] <EOL> } <EOL> val columnNames = dataFrames . first ( ) . columnNames ( ) <EOL> val columns = columnNames . map { name -> <EOL> val values = dataFrames . flatMap { it . getColumn ( name ) . values ( ) } <EOL> DataColumn . createValueColumn ( name , values , dataFrames . first ( ) . getColumn ( name ) . type ( ) ) <EOL> } <EOL> return dataFrameOf ( columns ) . cast ( ) <EOL> }

/**
 * same as [Iterable<DataFrame<T>>.concat()] without internal type guessing (all batches should have the same schema)
 */


internal fun DataFrame . Companion . readArrowIPCImpl ( channel : ReadableByteChannel , allocator : RootAllocator = Allocator . ROOT , nullability : NullabilityOptions = NullabilityOptions . Infer , ) : AnyFrame

{ <EOL> return readArrowImpl ( ArrowStreamReader ( channel , allocator ) , nullability ) <EOL> }

/**
 * Read [Arrow interprocess streaming format](https://arrow.apache.org/docs/java/ipc.html#writing-and-reading-streaming-format) data from existing [channel]
 */


internal fun DataFrame . Companion . readArrowFeatherImpl ( channel : SeekableByteChannel , allocator : RootAllocator = Allocator . ROOT , nullability : NullabilityOptions = NullabilityOptions . Infer , ) : AnyFrame

{ <EOL> return readArrowImpl ( ArrowFileReader ( channel , allocator ) , nullability ) <EOL> }

/**
 * Read [Arrow random access format](https://arrow.apache.org/docs/java/ipc.html#writing-and-reading-random-access-files) data from existing [channel]
 */


internal fun DataFrame . Companion . readArrowImpl ( reader : ArrowReader , nullability : NullabilityOptions = NullabilityOptions . Infer ) : AnyFrame

{ <EOL> reader . use { <EOL> val flattened = buildList { <EOL> when ( reader ) { <EOL> is ArrowFileReader -> { <EOL> reader . recordBlocks . forEach { block -> <EOL> reader . loadRecordBatch ( block ) <EOL> val root = reader . vectorSchemaRoot <EOL> val schema = root . schema <EOL> val df = schema . fields . map { f -> readField ( root , f , nullability ) } . toDataFrame ( ) <EOL> add ( df ) <EOL> } <EOL> } <EOL> else -> { <EOL> val root = reader . vectorSchemaRoot <EOL> val schema = root . schema <EOL> while ( reader . loadNextBatch ( ) ) { <EOL> val df = schema . fields . map { f -> readField ( root , f , nullability ) } . toDataFrame ( ) <EOL> add ( df ) <EOL> } <EOL> } <EOL> } <EOL> } <EOL> return flattened . concatKeepingSchema ( ) <EOL> } <EOL> }

/**
 * Read [Arrow any format](https://arrow.apache.org/docs/java/ipc.html#reading-writing-ipc-formats) data from existing [reader]
 */


private fun KotlinGradleProjectCheckerContext . compileOnlyDependencies ( target : KotlinTarget , ) : List < CompilationDependenciesPair >

{ <EOL> val apiElementsDependencies = project . configurations <EOL> . findByName ( target . apiElementsConfigurationName ) <EOL> ? . allDependencies <EOL> . orEmpty ( ) <EOL> fun Dependency . isInApiElements ( ) : Boolean = <EOL> apiElementsDependencies . any { it . contentEquals ( this ) } <EOL> val compilationsIncompatibleWithCompileOnly = target . compilations <EOL> . filter { it . isPublished ( ) } <EOL> . filter { ! isAllowedCompileOnlyDependencies ( it . target . platformType ) } <EOL> return compilationsIncompatibleWithCompileOnly . map { compilation -> <EOL> val compileOnlyDependencies = project . configurations <EOL> . findByName ( compilation . compileOnlyConfigurationName ) <EOL> ? . allDependencies <EOL> . orEmpty ( ) <EOL> val nonApiCompileOnlyDependencies = compileOnlyDependencies . filter { ! it . isInApiElements ( ) } <EOL> CompilationDependenciesPair ( compilation , nonApiCompileOnlyDependencies . map { it . stringCoordinates ( ) } , ) <EOL> } <EOL> }

/**
 * Extract all dependencies of [target], satisfying:
 * 1. they are `compileOnly`
 * 2. they are not exposed as api elements.
 *
 * Fetches Configurations leniently, just in case a plugin (e.g. AGP) isn't configured correctly.
 */


private fun KotlinCompilation < * > . isPublished ( ) : Boolean

{ <EOL> return when ( this ) { <EOL> is KotlinMetadataCompilation < * > -> true <EOL> else -> name == KotlinCompilation . MAIN_COMPILATION_NAME <EOL> } <EOL> }

/**
 * Estimate whether a [KotlinCompilation] is 'publishable' (i.e. it is a main, non-test compilation).
 */


abstract fun getSymbolsByPredicate ( predicate : LookupPredicate ) : List < FirBasedSymbol < * > >

/**
 * @return list of all declarations from compiled source module which are matched to [predicate]
 */


abstract fun getOwnersOfDeclaration ( declaration : FirDeclaration ) : List < FirBasedSymbol < * > > ?

/**
 * @return list of all parents of [declaration]
 */


abstract fun fileHasPluginAnnotations ( file : FirFile ) : Boolean

/**
 * @return `true` if file has a top-level annotation from the [FirRegisteredPluginAnnotations.annotations] list.
 * @see FirRegisteredPluginAnnotations.annotations
 */


abstract fun matches ( predicate : AbstractPredicate < * > , declaration : FirDeclaration ) : Boolean

/**
 * @return if [declaration] matches [predicate] or not
 */


fun matches ( predicate : AbstractPredicate < * > , declaration : FirBasedSymbol < * > ) : Boolean

{ <EOL> return matches ( predicate , declaration . fir ) <EOL> }


fun matches ( predicates : List < AbstractPredicate < * > > , declaration : FirDeclaration ) : Boolean

{ <EOL> return predicates . any { matches ( it , declaration ) } <EOL> }

/**
 * @return if [declaration] matches any predicate from [predicates] or not
 */


fun matches ( predicates : List < AbstractPredicate < * > > , declaration : FirBasedSymbol < * > ) : Boolean

{ <EOL> return matches ( predicates , declaration . fir ) <EOL> }


@ FirExtensionApiInternals <EOL> open fun registerAnnotatedDeclaration ( declaration : FirDeclaration , owners : PersistentList < FirDeclaration > )

/**
 * Utility method which should not be used from plugins
 */


@ InternalCoroutinesApi <EOL> public fun getCancellationException ( ) : CancellationException

/**
 * Returns [CancellationException] that signals the completion of this job. This function is
 * used by [cancellable][suspendCancellableCoroutine] suspending functions. They throw exception
 * returned by this function when they suspend in the context of this job and this job becomes _complete_.
 *
 * This function returns the original [cancel] cause of this job if that `cause` was an instance of
 * [CancellationException]. Otherwise (if this job was cancelled with a cause of a different type, or
 * was cancelled without a cause, or had completed normally), an instance of [CancellationException] is
 * returned. The [CancellationException.cause] of the resulting [CancellationException] references
 * the original cancellation cause that was passed to [cancel] function.
 *
 * This function throws [IllegalStateException] when invoked on a job that is still active.
 *
 * @suppress **This an internal API and should not be used from general code.**
 */


public fun start ( ) : Boolean

/**
 * Starts coroutine related to this job (if any) if it was not started yet.
 * The result is `true` if this invocation actually started coroutine or `false`
 * if it was already started or completed.
 */


public fun cancel ( cause : CancellationException ? = null )

/**
 * Cancels this job with an optional cancellation [cause].
 * A cause can be used to specify an error message or to provide other details on
 * the cancellation reason for debugging purposes.
 * See [Job] documentation for full explanation of cancellation machinery.
 */


@ Deprecated ( level = DeprecationLevel . HIDDEN , message = "<STR_LIT>" ) <EOL> public fun cancel ( ) : Unit

= cancel ( null )

/**
 * @suppress This method implements old version of JVM ABI. Use [cancel].
 */


@ Deprecated ( level = DeprecationLevel . HIDDEN , message = "<STR_LIT>" ) <EOL> public fun cancel ( cause : Throwable ? = null ) : Boolean

/**
 * @suppress This method has bad semantics when cause is not a [CancellationException]. Use [cancel].
 */


@ InternalCoroutinesApi <EOL> public fun attachChild ( child : ChildJob ) : ChildHandle

/**
 * Attaches child job so that this job becomes its parent and
 * returns a handle that should be used to detach it.
 *
 * A parent-child relation has the following effect:
 * - Cancellation of parent with [cancel] or its exceptional completion (failure)
 * immediately cancels all its children.
 * - Parent cannot complete until all its children are complete. Parent waits for all its children to
 * complete in _completing_ or _cancelling_ states.
 *
 * **A child must store the resulting [ChildHandle] and [dispose][DisposableHandle.dispose] the attachment
 * to its parent on its own completion.**
 *
 * Coroutine builders and job factory functions that accept `parent` [CoroutineContext] parameter
 * lookup a [Job] instance in the parent context and use this function to attach themselves as a child.
 * They also store a reference to the resulting [ChildHandle] and dispose a handle when they complete.
 *
 * @suppress This is an internal API. This method is too error prone for public API.
 */


public suspend fun join ( )

/**
 * Suspends the coroutine until this job is complete. This invocation resumes normally (without exception)
 * when the job is complete for any reason and the [Job] of the invoking coroutine is still [active][isActive].
 * This function also [starts][Job.start] the corresponding coroutine if the [Job] was still in _new_ state.
 *
 * Note that the job becomes complete only when all its children are complete.
 *
 * This suspending function is cancellable and **always** checks for a cancellation of the invoking coroutine's Job.
 * If the [Job] of the invoking coroutine is cancelled or completed when this
 * suspending function is invoked or while it is suspended, this function
 * throws [CancellationException].
 *
 * In particular, it means that a parent coroutine invoking `join` on a child coroutine throws
 * [CancellationException] if the child had failed, since a failure of a child coroutine cancels parent by default,
 * unless the child was launched from within [supervisorScope].
 *
 * This function can be used in [select] invocation with [onJoin] clause.
 * Use [isCompleted] to check for a completion of this job without waiting.
 *
 * There is [cancelAndJoin] function that combines an invocation of [cancel] and `join`.
 */


public fun invokeOnCompletion ( handler : CompletionHandler ) : DisposableHandle

/**
 * Registers handler that is **synchronously** invoked once on completion of this job.
 * When the job is already complete, then the handler is immediately invoked
 * with the job's exception or cancellation cause or `null`. Otherwise, the handler will be invoked once when this
 * job is complete.
 *
 * The meaning of `cause` that is passed to the handler:
 * - Cause is `null` when the job has completed normally.
 * - Cause is an instance of [CancellationException] when the job was cancelled _normally_.
 * **It should not be treated as an error**. In particular, it should not be reported to error logs.
 * - Otherwise, the job had _failed_.
 *
 * The resulting [DisposableHandle] can be used to [dispose][DisposableHandle.dispose] the
 * registration of this handler and release its memory if its invocation is no longer needed.
 * There is no need to dispose the handler after completion of this job. The references to
 * all the handlers are released when this job completes.
 *
 * Installed [handler] should not throw any exceptions. If it does, they will get caught,
 * wrapped into [CompletionHandlerException], and rethrown, potentially causing crash of unrelated code.
 *
 * **Note**: Implementation of `CompletionHandler` must be fast, non-blocking, and thread-safe.
 * This handler can be invoked concurrently with the surrounding code.
 * There is no guarantee on the execution context in which the [handler] is invoked.
 */


@ InternalCoroutinesApi <EOL> public fun invokeOnCompletion ( onCancelling : Boolean = false , invokeImmediately : Boolean = true , handler : CompletionHandler ) : DisposableHandle

/**
 * Kept for preserving compatibility. Shouldn't be used by anyone.
 * @suppress
 */


@ Suppress ( "<STR_LIT>" ) <EOL> @ Deprecated ( message = "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" , level = DeprecationLevel . ERROR ) <EOL> public operator fun plus ( other : Job ) : Job

= other

/**
 * @suppress **Error**: Operator '+' on two Job objects is meaningless.
 * Job is a coroutine context element and `+` is a set-sum operator for coroutine contexts.
 * The job to the right of `+` just replaces the job the left of `+`.
 */


internal fun Job . invokeOnCompletion ( onCancelling : Boolean = false , invokeImmediately : Boolean = true , handler : InternalCompletionHandler ) : DisposableHandle

= when ( this ) { <EOL> is JobSupport -> invokeOnCompletionInternal ( onCancelling , invokeImmediately , handler ) <EOL> else -> invokeOnCompletion ( onCancelling , invokeImmediately , handler :: invoke ) <EOL> }

/**
 * Registers a handler that is **synchronously** invoked once on cancellation or completion of this job.
 *
 * If the handler would have been invoked earlier if it was registered at that time, then it is invoked immediately,
 * unless [invokeImmediately] is set to `false`.
 *
 * The handler is scheduled to be invoked once the job is cancelled or is complete.
 * This behavior can be changed by setting the [onCancelling] parameter to `true`.
 * In this case, the handler is invoked as soon as the job becomes _cancelling_ instead.
 *
 * The meaning of `cause` that is passed to the handler is:
 * - It is `null` if the job has completed normally.
 * - It is an instance of [CancellationException] if the job was cancelled _normally_.
 * **It should not be treated as an error**. In particular, it should not be reported to error logs.
 * - Otherwise, the job had _failed_.
 *
 * The resulting [DisposableHandle] can be used to [dispose][DisposableHandle.dispose] of the registration of this
 * handler and release its memory if its invocation is no longer needed.
 * There is no need to dispose of the handler after completion of this job. The references to
 * all the handlers are released when this job completes.
 */


@ Suppress ( "<STR_LIT:FunctionName>" ) <EOL> public fun Job ( parent : Job ? = null ) : CompletableJob

= JobImpl ( parent )

/**
 * Creates a job object in an active state.
 * A failure of any child of this job immediately causes this job to fail, too, and cancels the rest of its children.
 *
 * To handle children failure independently of each other use [SupervisorJob].
 *
 * If [parent] job is specified, then this job becomes a child job of its parent and
 * is cancelled when its parent fails or is cancelled. All this job's children are cancelled in this case, too.
 *
 * Conceptually, the resulting job works in the same way as the job created by the `launch { body }` invocation
 * (see [launch]), but without any code in the body. It is active until cancelled or completed. Invocation of
 * [CompletableJob.complete] or [CompletableJob.completeExceptionally] corresponds to the successful or
 * failed completion of the body of the coroutine.
 *
 * @param parent an optional parent job.
 */


@ Suppress ( "<STR_LIT:FunctionName>" ) <EOL> @ Deprecated ( level = DeprecationLevel . HIDDEN , message = "<STR_LIT>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> public fun Job0 ( parent : Job ? = null ) : Job

= Job ( parent )

/** @suppress Binary compatibility only */


public fun dispose ( )

/**
 * Disposes the corresponding object, making it eligible for garbage collection.
 * Repeated invocation of this function has no effect.
 */


@ InternalCoroutinesApi <EOL> public fun parentCancelled ( parentJob : ParentJob )

/**
 * Parent is cancelling its child by invoking this method.
 * Child finds the cancellation cause using [ParentJob.getChildJobCancellationCause].
 * This method does nothing is the child is already being cancelled.
 *
 * @suppress **This is unstable API and it is subject to change.**
 */


@ InternalCoroutinesApi <EOL> public fun getChildJobCancellationCause ( ) : CancellationException

/**
 * Child job is using this method to learn its cancellation cause when the parent cancels it with [ChildJob.parentCancelled].
 * This method is invoked only if the child was not already being cancelled.
 *
 * Note that [CancellationException] is the method's return type: if child is cancelled by its parent,
 * then the original exception is **already** handled by either the parent or the original source of failure.
 *
 * @suppress **This is unstable API and it is subject to change.**
 */


@ InternalCoroutinesApi <EOL> public fun childCancelled ( cause : Throwable ) : Boolean

/**
 * Child is cancelling its parent by invoking this method.
 * This method is invoked by the child twice. The first time child report its root cause as soon as possible,
 * so that all its siblings and the parent can start cancelling their work asap. The second time
 * child invokes this method when it had aggregated and determined its final cancellation cause.
 *
 * @suppress **This is unstable API and it is subject to change.**
 */


internal fun Job . disposeOnCompletion ( handle : DisposableHandle ) : DisposableHandle

= <EOL> invokeOnCompletion ( handler = DisposeOnCompletion ( handle ) )

/**
 * Disposes a specified [handle] when this job is complete.
 *
 * This is a shortcut for the following code with slightly more efficient implementation (one fewer object created).
 * ```
 * invokeOnCompletion { handle.dispose() }
 * ```
 */


public suspend fun Job . cancelAndJoin ( )

{ <EOL> cancel ( ) <EOL> return join ( ) <EOL> }

/**
 * Cancels the job and suspends the invoking coroutine until the cancelled job is complete.
 *
 * This suspending function is cancellable and **always** checks for a cancellation of the invoking coroutine's Job.
 * If the [Job] of the invoking coroutine is cancelled or completed when this
 * suspending function is invoked or while it is suspended, this function
 * throws [CancellationException].
 *
 * In particular, it means that a parent coroutine invoking `cancelAndJoin` on a child coroutine throws
 * [CancellationException] if the child had failed, since a failure of a child coroutine cancels parent by default,
 * unless the child was launched from within [supervisorScope].
 *
 * This is a shortcut for the invocation of [cancel][Job.cancel] followed by [join][Job.join].
 */


public fun Job . cancelChildren ( cause : CancellationException ? = null )

{ <EOL> children . forEach { it . cancel ( cause ) } <EOL> }

/**
 * Cancels all [children][Job.children] jobs of this coroutine using [Job.cancel] for all of them
 * with an optional cancellation [cause].
 * Unlike [Job.cancel] on this job as a whole, the state of this job itself is not affected.
 */


@ Deprecated ( level = DeprecationLevel . HIDDEN , message = "<STR_LIT>" ) <EOL> public fun Job . cancelChildren ( ) : Unit

= cancelChildren ( null )

/**
 * @suppress This method implements old version of JVM ABI. Use [cancel].
 */


@ Deprecated ( level = DeprecationLevel . HIDDEN , message = "<STR_LIT>" ) <EOL> public fun Job . cancelChildren ( cause : Throwable ? = null )

{ <EOL> children . forEach { ( it as? JobSupport ) ? . cancelInternal ( cause . orCancellation ( this ) ) } <EOL> }

/**
 * @suppress This method has bad semantics when cause is not a [CancellationException]. Use [Job.cancelChildren].
 */


public fun CoroutineContext . cancel ( cause : CancellationException ? = null )

{ <EOL> this [ Job ] ? . cancel ( cause ) <EOL> }

/**
 * Cancels [Job] of this context with an optional cancellation cause.
 * See [Job.cancel] for details.
 */


@ Deprecated ( level = DeprecationLevel . HIDDEN , message = "<STR_LIT>" ) <EOL> public fun CoroutineContext . cancel ( ) : Unit

= cancel ( null )

/**
 * @suppress This method implements old version of JVM ABI. Use [CoroutineContext.cancel].
 */


public fun Job . ensureActive ( ) : Unit

{ <EOL> if ( ! isActive ) throw getCancellationException ( ) <EOL> }

/**
 * Ensures that current job is [active][Job.isActive].
 * If the job is no longer active, throws [CancellationException].
 * If the job was cancelled, thrown exception contains the original cancellation cause.
 *
 * This method is a drop-in replacement for the following code, but with more precise exception:
 * ```
 * if (!job.isActive) {
 * throw CancellationException()
 * }
 * ```
 */


public fun CoroutineContext . ensureActive ( )

{ <EOL> get ( Job ) ? . ensureActive ( ) <EOL> }

/**
 * Ensures that job in the current context is [active][Job.isActive].
 *
 * If the job is no longer active, throws [CancellationException].
 * If the job was cancelled, thrown exception contains the original cancellation cause.
 * This function does not do anything if there is no [Job] in the context, since such a coroutine cannot be cancelled.
 *
 * This method is a drop-in replacement for the following code, but with more precise exception:
 * ```
 * if (!isActive) {
 * throw CancellationException()
 * }
 * ```
 */


public fun Job . cancel ( message : String , cause : Throwable ? = null ) : Unit

= cancel ( CancellationException ( message , cause ) )

/**
 * Cancels current job, including all its children with a specified diagnostic error [message].
 * A [cause] can be specified to provide additional details on a cancellation reason for debugging purposes.
 */


@ Deprecated ( level = DeprecationLevel . HIDDEN , message = "<STR_LIT>" ) <EOL> public fun CoroutineContext . cancel ( cause : Throwable ? = null ) : Boolean

{ <EOL> val job = this [ Job ] as? JobSupport ? : return false <EOL> job . cancelInternal ( cause . orCancellation ( job ) ) <EOL> return true <EOL> }

/**
 * @suppress This method has bad semantics when cause is not a [CancellationException]. Use [CoroutineContext.cancel].
 */


public fun CoroutineContext . cancelChildren ( cause : CancellationException ? = null )

{ <EOL> this [ Job ] ? . children ? . forEach { it . cancel ( cause ) } <EOL> }

/**
 * Cancels all children of the [Job] in this context, without touching the state of this job itself
 * with an optional cancellation cause. See [Job.cancel].
 * It does not do anything if there is no job in the context or it has no children.
 */


@ Deprecated ( level = DeprecationLevel . HIDDEN , message = "<STR_LIT>" ) <EOL> public fun CoroutineContext . cancelChildren ( ) : Unit

= cancelChildren ( null )

/**
 * @suppress This method implements old version of JVM ABI. Use [CoroutineContext.cancelChildren].
 */


@ Deprecated ( level = DeprecationLevel . HIDDEN , message = "<STR_LIT>" ) <EOL> public fun CoroutineContext . cancelChildren ( cause : Throwable ? = null )

{ <EOL> val job = this [ Job ] ? : return <EOL> job . children . forEach { ( it as? JobSupport ) ? . cancelInternal ( cause . orCancellation ( job ) ) } <EOL> }

/**
 * @suppress This method has bad semantics when cause is not a [CancellationException]. Use [CoroutineContext.cancelChildren].
 */


/**
 * Does not do anything.
 * @suppress
 */


override fun childCancelled ( cause : Throwable ) : Boolean

= false

/**
 * Returns `false`.
 * @suppress
 */


= "<STR_LIT>"

/**
 * Returns "NonDisposableHandle" string.
 * @suppress
 */


= runTest { <EOL> expect ( <NUM_LIT:1> ) <EOL> val result = withTimeoutOrNull ( <NUM_LIT:10> . seconds ) { <EOL> expect ( <NUM_LIT:2> ) <EOL> "<STR_LIT:OK>" <EOL> } <EOL> assertEquals ( "<STR_LIT:OK>" , result ) <EOL> finish ( <NUM_LIT:3> ) <EOL> }

/**
 * Tests a case of no timeout and no suspension inside.
 */


= runTest { <EOL> expect ( <NUM_LIT:1> ) <EOL> val result = withTimeoutOrNull ( <NUM_LIT:10> . seconds ) { <EOL> expect ( <NUM_LIT:2> ) <EOL> yield ( ) <EOL> expect ( <NUM_LIT:3> ) <EOL> "<STR_LIT:OK>" <EOL> } <EOL> assertEquals ( "<STR_LIT:OK>" , result ) <EOL> finish ( <NUM_LIT:4> ) <EOL> }

/**
 * Tests a case of no timeout and one suspension inside.
 */


= runTest { <EOL> expect ( <NUM_LIT:1> ) <EOL> launch { <EOL> expect ( <NUM_LIT:4> ) <EOL> yield ( ) <EOL> expect ( <NUM_LIT:7> ) <EOL> } <EOL> expect ( <NUM_LIT:2> ) <EOL> val result = withTimeoutOrNull ( <NUM_LIT:1> . seconds ) { <EOL> expect ( <NUM_LIT:3> ) <EOL> yield ( ) <EOL> expect ( <NUM_LIT:5> ) <EOL> "<STR_LIT:OK>" <EOL> } <EOL> assertEquals ( "<STR_LIT:OK>" , result ) <EOL> expect ( <NUM_LIT:6> ) <EOL> yield ( ) <EOL> finish ( <NUM_LIT:8> ) <EOL> }

/**
 * Tests property dispatching of `withTimeoutOrNull` blocks
 */


@ Test <EOL> fun testYieldBlockingWithTimeout ( )

= runTest { <EOL> expect ( <NUM_LIT:1> ) <EOL> val result = withTimeoutOrNull ( <NUM_LIT:100> . milliseconds ) { <EOL> while ( true ) { <EOL> yield ( ) <EOL> } <EOL> } <EOL> assertNull ( result ) <EOL> finish ( <NUM_LIT:2> ) <EOL> }

/**
 * Tests that a 100% CPU-consuming loop will react on timeout if it has yields.
 */


{ <EOL> assertTrue ( "<STR_LIT>" , abs ( - <NUM_LIT> ) == <NUM_LIT> ) <EOL> assertTrue ( "<STR_LIT>" , abs ( <NUM_LIT> ) == <NUM_LIT> ) <EOL> }

/**
 * Tests kotlin.math.abs(Double)
 */


{ <EOL> val r = cos ( acos ( ADJ / HYP ) ) <EOL> val lr = r . toBits ( ) <EOL> val t = ( ADJ / HYP ) . toBits ( ) <EOL> assertTrue ( "<STR_LIT>" , lr == t || lr + <NUM_LIT:1> == t || lr - <NUM_LIT:1> == t ) <EOL> }

/**
 * Tests kotlin.math.acos(Double)
 */


{ <EOL> val r = sin ( asin ( OPP / HYP ) ) <EOL> val lr = r . toBits ( ) <EOL> val t = ( OPP / HYP ) . toBits ( ) <EOL> assertTrue ( "<STR_LIT>" , lr == t || lr + <NUM_LIT:1> == t || lr - <NUM_LIT:1> == t ) <EOL> }

/**
 * Tests kotlin.math.asin(Double)
 */


{ <EOL> val answer = tan ( atan ( <NUM_LIT:1.0> ) ) <EOL> assertTrue ( "<STR_LIT>" + answer , answer <= <NUM_LIT:1.0> && answer >= <NUM_LIT> ) <EOL> }

/**
 * Tests kotlin.math.atan(Double)
 */


{ <EOL> val answer = atan ( tan ( <NUM_LIT:1.0> ) ) <EOL> assertTrue ( "<STR_LIT>" + answer , answer <= <NUM_LIT:1.0> && answer >= <NUM_LIT> ) <EOL> }

/**
 * Tests kotlin.math.atan2(Double, Double)
 */


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ceil ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT> , ceil ( - <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> }

/**
 * Tests kotlin.math.ceil(Double)
 */


{ <EOL> for ( i in COPYSIGN_DD_CASES . indices ) { <EOL> val magnitude = COPYSIGN_DD_CASES [ i ] <EOL> val absMagnitudeBits = abs ( magnitude ) . toBits ( ) <EOL> val negMagnitudeBits = ( - abs ( magnitude ) ) . toBits ( ) <EOL> assertTrue ( "<STR_LIT>" , Double . isNaN ( Double . NaN . withSign ( magnitude ) ) ) <EOL> for ( j in COPYSIGN_DD_CASES . indices ) { <EOL> val sign = COPYSIGN_DD_CASES [ j ] <EOL> val resultBits = magnitude . withSign ( sign ) . toBits ( ) <EOL> if ( sign > <NUM_LIT:0> || ( + <NUM_LIT:0.0> ) . toBits ( ) == sign . toBits ( ) || <NUM_LIT:0.0> . toBits ( ) == sign . toBits ( ) ) { <EOL> assertEquals ( "<STR_LIT>" , absMagnitudeBits , resultBits ) <EOL> } <EOL> if ( sign < <NUM_LIT:0> || ( - <NUM_LIT:0.0> ) . toBits ( ) == sign . toBits ( ) ) { <EOL> assertEquals ( "<STR_LIT>" , negMagnitudeBits , resultBits ) <EOL> } <EOL> } <EOL> } <EOL> assertTrue ( "<STR_LIT>" , Double . isNaN ( Double . NaN . withSign ( Double . NaN ) ) ) <EOL> }

/**
 * Tests kotlin.math.withSign(Double)
 */


{ <EOL> for ( i in COPYSIGN_FF_CASES . indices ) { <EOL> val magnitude = COPYSIGN_FF_CASES [ i ] <EOL> val absMagnitudeBits = abs ( magnitude ) . toBits ( ) <EOL> val negMagnitudeBits = ( - abs ( magnitude ) ) . toBits ( ) <EOL> assertTrue ( "<STR_LIT>" , Float . isNaN ( Float . NaN . withSign ( magnitude ) ) ) <EOL> for ( j in COPYSIGN_FF_CASES . indices ) { <EOL> val sign = COPYSIGN_FF_CASES [ j ] <EOL> val resultBits = magnitude . withSign ( sign ) . toBits ( ) <EOL> if ( sign > <NUM_LIT:0> || ( + <NUM_LIT:0.0f> ) . toBits ( ) == sign . toBits ( ) || <NUM_LIT:0.0f> . toBits ( ) == sign . toBits ( ) ) { <EOL> assertEquals ( "<STR_LIT>" , absMagnitudeBits , resultBits ) <EOL> } <EOL> if ( sign < <NUM_LIT:0> || ( - <NUM_LIT:0.0f> ) . toBits ( ) == sign . toBits ( ) ) { <EOL> assertEquals ( "<STR_LIT>" , negMagnitudeBits , resultBits ) <EOL> } <EOL> } <EOL> } <EOL> assertTrue ( "<STR_LIT>" , Float . isNaN ( Float . NaN . withSign ( Float . NaN ) ) ) <EOL> }

/**
 * Tests kotlin.math.withSign(Float)
 */


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:1.0> , cos ( <NUM_LIT:0.0> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , cos ( <NUM_LIT:1.0> ) , <NUM_LIT:0.0> ) <EOL> }

/**
 * Tests kotlin.math.cos(Double)
 */


{ <EOL> assertTrue ( Double . isNaN ( cosh ( Double . NaN ) ) ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , cosh ( Double . POSITIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , cosh ( Double . NEGATIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:1.0> , cosh ( + <NUM_LIT:0.0> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:1.0> , cosh ( - <NUM_LIT:0.0> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , cosh ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , cosh ( - <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , cosh ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , cosh ( - <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , cosh ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , cosh ( Double . MAX_VALUE ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:1.0> , cosh ( Double . MIN_VALUE ) , <NUM_LIT:0.0> ) <EOL> }

/**
 * Tests kotlin.math.cosh(Double)
 */


{ <EOL> assertTrue ( "<STR_LIT>" , abs ( exp ( <NUM_LIT> ) - E * E * E * E ) < <NUM_LIT> ) <EOL> assertTrue ( "<STR_LIT>" , ln ( abs ( exp ( <NUM_LIT> ) ) - <NUM_LIT> ) < <NUM_LIT> ) <EOL> }

/**
 * Tests kotlin.math.exp(Double)
 */


{ <EOL> assertTrue ( "<STR_LIT>" , Double . isNaN ( expm1 ( Double . NaN ) ) ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , expm1 ( Double . POSITIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT:1.0> , expm1 ( Double . NEGATIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( <NUM_LIT:0.0> . toBits ( ) , expm1 ( <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( + <NUM_LIT:0.0> . toBits ( ) , expm1 ( + <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( ( - <NUM_LIT:0.0> ) . toBits ( ) , expm1 ( - <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT> , expm1 ( - <NUM_LIT> ) ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , expm1 ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , expm1 ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , expm1 ( Double . MAX_VALUE ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . MIN_VALUE , expm1 ( Double . MIN_VALUE ) , <NUM_LIT:0.0> ) <EOL> }

/**
 * Tests kotlin.math.expm1(Double)
 */


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , floor ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT:2.0> , floor ( - <NUM_LIT:2.0> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:0.0> , floor ( <NUM_LIT:0.0> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , floor ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT> , floor ( - <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , floor ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT> , floor ( - <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:0.0> , floor ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( Double . NaN . toString ( ) , floor ( Double . NaN ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( + <NUM_LIT:0.0> ) . toString ( ) , floor ( + <NUM_LIT:0.0> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( - <NUM_LIT:0.0> ) . toString ( ) , floor ( - <NUM_LIT:0.0> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( Double . POSITIVE_INFINITY . toString ( ) , floor ( Double . POSITIVE_INFINITY ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( Double . NEGATIVE_INFINITY . toString ( ) , floor ( Double . NEGATIVE_INFINITY ) . toString ( ) , "<STR_LIT>" ) <EOL> }

/**
 * Tests kotlin.math.floor(Double)
 */


{ <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , hypot ( Double . POSITIVE_INFINITY , <NUM_LIT:1.0> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , hypot ( Double . NEGATIVE_INFINITY , <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , hypot ( - <NUM_LIT> , Double . POSITIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , hypot ( <NUM_LIT> , Double . NEGATIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , hypot ( Double . POSITIVE_INFINITY , Double . NEGATIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , hypot ( Double . NEGATIVE_INFINITY , Double . POSITIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertTrue ( "<STR_LIT>" , Double . isNaN ( hypot ( Double . NaN , <NUM_LIT> ) ) ) <EOL> assertTrue ( "<STR_LIT>" , Double . isNaN ( hypot ( - <NUM_LIT> , Double . NaN ) ) ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , hypot ( <NUM_LIT> , - <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , hypot ( - <NUM_LIT> , <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , hypot ( Double . MAX_VALUE , <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , hypot ( - <NUM_LIT> , Double . MIN_VALUE ) , <NUM_LIT:0.0> ) <EOL> }

/**
 * Tests kotlin.math.hypot(Double, Double)
 */


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:0.0> , <NUM_LIT:1.0> . IEEErem ( <NUM_LIT:1.0> ) , <NUM_LIT:0.0> ) <EOL> assertTrue ( "<STR_LIT>" , <NUM_LIT> . IEEErem ( <NUM_LIT> ) >= <NUM_LIT> || <NUM_LIT> . IEEErem ( <NUM_LIT> ) >= <NUM_LIT> ) <EOL> }

/**
 * Tests kotlin.math.IEEEremainder(Double, Double)
 */


{ <EOL> var d = <NUM_LIT> <EOL> while ( d >= - <NUM_LIT:10> ) { <EOL> val answer = ln ( exp ( d ) ) <EOL> assertTrue ( "<STR_LIT>" + d + "<STR_LIT>" + answer , abs ( answer - d ) <= abs ( d * <NUM_LIT> ) ) <EOL> d -= <NUM_LIT> <EOL> } <EOL> }


{ <EOL> assertTrue ( Double . isNaN ( log10 ( Double . NaN ) ) ) <EOL> assertTrue ( Double . isNaN ( log10 ( - <NUM_LIT> ) ) ) <EOL> assertTrue ( Double . isNaN ( log10 ( - <NUM_LIT> ) ) ) <EOL> assertEquals ( Double . POSITIVE_INFINITY , log10 ( Double . POSITIVE_INFINITY ) ) <EOL> assertEquals ( Double . NEGATIVE_INFINITY , log10 ( <NUM_LIT:0.0> ) ) <EOL> assertEquals ( Double . NEGATIVE_INFINITY , log10 ( + <NUM_LIT:0.0> ) ) <EOL> assertEquals ( Double . NEGATIVE_INFINITY , log10 ( - <NUM_LIT:0.0> ) ) <EOL> assertEquals ( <NUM_LIT:3.0> , log10 ( <NUM_LIT> ) ) <EOL> assertEquals ( <NUM_LIT> , log10 ( <NUM_LIT> . pow ( <NUM_LIT> ) ) ) <EOL> assertEquals ( <NUM_LIT> , log10 ( <NUM_LIT> ) ) <EOL> assertEquals ( <NUM_LIT> , log10 ( <NUM_LIT> ) ) <EOL> assertEquals ( - <NUM_LIT> , log10 ( <NUM_LIT> ) ) <EOL> assertEquals ( <NUM_LIT> , log10 ( Double . MAX_VALUE ) ) <EOL> assertEquals ( - <NUM_LIT> , log10 ( Double . MIN_VALUE ) ) <EOL> }

/**
 * Tests kotlin.math.log10(Double)
 */


{ <EOL> assertTrue ( "<STR_LIT>" , Double . isNaN ( ln1p ( Double . NaN ) ) ) <EOL> assertTrue ( "<STR_LIT>" , Double . isNaN ( ln1p ( - <NUM_LIT> ) ) ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , ln1p ( Double . POSITIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( <NUM_LIT:0.0> . toBits ( ) , ln1p ( <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( + <NUM_LIT:0.0> . toBits ( ) , ln1p ( + <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( ( - <NUM_LIT:0.0> ) . toBits ( ) , ln1p ( - <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT> , ln1p ( - <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ln1p ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ln1p ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ln1p ( Double . MAX_VALUE ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . MIN_VALUE , ln1p ( Double . MIN_VALUE ) , <NUM_LIT:0.0> ) <EOL> }

/**
 * Tests kotlin.math.ln1p(Double)
 */


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , max ( - <NUM_LIT> , <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , max ( <NUM_LIT:2.0> , <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT:2.0> , max ( - <NUM_LIT:2.0> , - <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( ( Double . NaN ) . toString ( ) , max ( Double . NaN , <NUM_LIT> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( Double . NaN ) . toString ( ) , max ( <NUM_LIT> , Double . NaN ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( + <NUM_LIT:0.0> ) . toString ( ) , max ( + <NUM_LIT:0.0> , - <NUM_LIT:0.0> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( + <NUM_LIT:0.0> ) . toString ( ) , max ( - <NUM_LIT:0.0> , + <NUM_LIT:0.0> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( - <NUM_LIT:0.0> ) . toString ( ) , max ( - <NUM_LIT:0.0> , - <NUM_LIT:0.0> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( + <NUM_LIT:0.0> ) . toString ( ) , max ( + <NUM_LIT:0.0> , + <NUM_LIT:0.0> ) . toString ( ) , "<STR_LIT>" ) <EOL> }

/**
 * Tests kotlin.math.max(Double, Double)
 */


{ <EOL> assertTrue ( "<STR_LIT>" , max ( - <NUM_LIT> , <NUM_LIT> ) == <NUM_LIT> ) <EOL> assertTrue ( "<STR_LIT>" , max ( <NUM_LIT> , <NUM_LIT> ) == <NUM_LIT> ) <EOL> assertTrue ( "<STR_LIT>" , max ( - <NUM_LIT> , - <NUM_LIT> ) == - <NUM_LIT> ) <EOL> assertEquals ( Float . NaN . toString ( ) , max ( Float . NaN , <NUM_LIT> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( Float . NaN . toString ( ) , max ( <NUM_LIT> , Float . NaN ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( + <NUM_LIT:0.0f> ) . toString ( ) , max ( + <NUM_LIT:0.0f> , - <NUM_LIT:0.0f> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( + <NUM_LIT:0.0f> ) . toString ( ) , max ( - <NUM_LIT:0.0f> , + <NUM_LIT:0.0f> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( - <NUM_LIT:0.0f> ) . toString ( ) , max ( - <NUM_LIT:0.0f> , - <NUM_LIT:0.0f> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( + <NUM_LIT:0.0f> ) . toString ( ) , max ( + <NUM_LIT:0.0f> , + <NUM_LIT:0.0f> ) . toString ( ) , "<STR_LIT>" ) <EOL> }

/**
 * Tests kotlin.math.max(float, float)
 */


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , max ( - <NUM_LIT> , <NUM_LIT> ) ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , max ( <NUM_LIT:20> , <NUM_LIT> ) ) <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT:20> , max ( - <NUM_LIT:20> , - <NUM_LIT> ) ) <EOL> }

/**
 * Tests kotlin.math.max(int, int)
 */


/**
 * Tests kotlin.math.max(long, long)
 */


{ <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT> , min ( - <NUM_LIT> , <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:2.0> , min ( <NUM_LIT:2.0> , <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT> , min ( - <NUM_LIT:2.0> , - <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:1.0> , min ( <NUM_LIT:1.0> , <NUM_LIT:1.0> ) ) <EOL> assertEquals ( Double . NaN . toString ( ) , min ( Double . NaN , <NUM_LIT> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( Double . NaN . toString ( ) , min ( <NUM_LIT> , Double . NaN ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( - <NUM_LIT:0.0> ) . toString ( ) , min ( + <NUM_LIT:0.0> , - <NUM_LIT:0.0> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( - <NUM_LIT:0.0> ) . toString ( ) , min ( - <NUM_LIT:0.0> , + <NUM_LIT:0.0> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( - <NUM_LIT:0.0> ) . toString ( ) , min ( - <NUM_LIT:0.0> , - <NUM_LIT:0.0> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( + <NUM_LIT:0.0> ) . toString ( ) , min ( + <NUM_LIT:0.0> , + <NUM_LIT:0.0> ) . toString ( ) , "<STR_LIT>" ) <EOL> }

/**
 * Tests kotlin.math.min(Double, Double)
 */


{ <EOL> assertTrue ( "<STR_LIT>" , min ( - <NUM_LIT> , <NUM_LIT> ) == - <NUM_LIT> ) <EOL> assertTrue ( "<STR_LIT>" , min ( <NUM_LIT> , <NUM_LIT> ) == <NUM_LIT> ) <EOL> assertTrue ( "<STR_LIT>" , min ( - <NUM_LIT> , - <NUM_LIT> ) == - <NUM_LIT> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , min ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> assertEquals ( Float . NaN . toString ( ) , min ( Float . NaN , <NUM_LIT> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( Float . NaN . toString ( ) , min ( <NUM_LIT> , Float . NaN ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( - <NUM_LIT:0.0f> ) . toString ( ) , min ( + <NUM_LIT:0.0f> , - <NUM_LIT:0.0f> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( - <NUM_LIT:0.0f> ) . toString ( ) , min ( - <NUM_LIT:0.0f> , + <NUM_LIT:0.0f> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( - <NUM_LIT:0.0f> ) . toString ( ) , min ( - <NUM_LIT:0.0f> , - <NUM_LIT:0.0f> ) . toString ( ) , "<STR_LIT>" ) <EOL> assertEquals ( ( + <NUM_LIT:0.0f> ) . toString ( ) , min ( + <NUM_LIT:0.0f> , + <NUM_LIT:0.0f> ) . toString ( ) , "<STR_LIT>" ) <EOL> }

/**
 * Tests kotlin.math.min(float, float)
 */


{ <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT> , min ( - <NUM_LIT> , <NUM_LIT> ) ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:20> , min ( <NUM_LIT:20> , <NUM_LIT> ) ) <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT> , min ( - <NUM_LIT:20> , - <NUM_LIT> ) ) <EOL> }

/**
 * Tests kotlin.math.min(int, int)
 */


{ <EOL> assertTrue ( "<STR_LIT>" , <NUM_LIT:2.0> . pow ( <NUM_LIT> ) . toLong ( ) == <NUM_LIT> ) <EOL> assertTrue ( "<STR_LIT>" , <NUM_LIT:2.0> . pow ( - <NUM_LIT> ) == <NUM_LIT> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:2.0> , sqrt ( sqrt ( <NUM_LIT:2.0> ) . pow ( <NUM_LIT> ) ) , <NUM_LIT:0.0> ) <EOL> }

/**
 * @tests java.lang.Math#pow(double, double)
 */


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:3.0> , round ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertTrue ( "<STR_LIT>" , Double . isNaN ( round ( Double . NaN ) ) ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:2.0> , round ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertTrue ( "<STR_LIT>" + <NUM_LIT> + "<STR_LIT>" , round ( <NUM_LIT> ) == <NUM_LIT:2.0> ) <EOL> assertTrue ( "<STR_LIT>" + + <NUM_LIT:0.0> , round ( + <NUM_LIT:0.0> ) == + <NUM_LIT:0.0> ) <EOL> assertTrue ( "<STR_LIT>" + - <NUM_LIT:0.0> , round ( - <NUM_LIT:0.0> ) == - <NUM_LIT:0.0> ) <EOL> }

/**
 * Tests kotlin.math.round(Double)
 */


{ <EOL> assertTrue ( Double . isNaN ( sign ( Double . NaN ) ) ) <EOL> assertTrue ( Double . isNaN ( sign ( Double . NaN ) ) ) <EOL> assertEquals ( <NUM_LIT:0.0> . toBits ( ) , sign ( <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( + <NUM_LIT:0.0> . toBits ( ) , sign ( + <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( ( - <NUM_LIT:0.0> ) . toBits ( ) , sign ( - <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( <NUM_LIT:1.0> , sign ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( - <NUM_LIT:1.0> , sign ( - <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( <NUM_LIT:1.0> , sign ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( - <NUM_LIT:1.0> , sign ( - <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( <NUM_LIT:1.0> , sign ( Double . MAX_VALUE ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( <NUM_LIT:1.0> , sign ( Double . MIN_VALUE ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( - <NUM_LIT:1.0> , sign ( - Double . MAX_VALUE ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( - <NUM_LIT:1.0> , sign ( - Double . MIN_VALUE ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( <NUM_LIT:1.0> , sign ( Double . POSITIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( - <NUM_LIT:1.0> , sign ( Double . NEGATIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> }

/**
 * Tests kotlin.math.sign(Double)
 */


{ <EOL> assertTrue ( Float . isNaN ( sign ( Float . NaN ) ) ) <EOL> assertEquals ( <NUM_LIT:0.0f> . toBits ( ) , sign ( <NUM_LIT:0.0f> ) . toBits ( ) ) <EOL> assertEquals ( + <NUM_LIT:0.0f> . toBits ( ) , sign ( + <NUM_LIT:0.0f> ) . toBits ( ) ) <EOL> assertEquals ( ( - <NUM_LIT:0.0f> ) . toBits ( ) , sign ( - <NUM_LIT:0.0f> ) . toBits ( ) ) <EOL> assertEquals ( <NUM_LIT> , sign ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> assertEquals ( - <NUM_LIT> , sign ( - <NUM_LIT> ) , <NUM_LIT> ) <EOL> assertEquals ( <NUM_LIT> , sign ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> assertEquals ( - <NUM_LIT> , sign ( - <NUM_LIT> ) , <NUM_LIT> ) <EOL> assertEquals ( <NUM_LIT> , sign ( Float . MAX_VALUE ) , <NUM_LIT> ) <EOL> assertEquals ( <NUM_LIT> , sign ( Float . MIN_VALUE ) , <NUM_LIT> ) <EOL> assertEquals ( - <NUM_LIT> , sign ( - Float . MAX_VALUE ) , <NUM_LIT> ) <EOL> assertEquals ( - <NUM_LIT> , sign ( - Float . MIN_VALUE ) , <NUM_LIT> ) <EOL> assertEquals ( <NUM_LIT> , sign ( Float . POSITIVE_INFINITY ) , <NUM_LIT> ) <EOL> assertEquals ( - <NUM_LIT> , sign ( Float . NEGATIVE_INFINITY ) , <NUM_LIT> ) <EOL> }

/**
 * Tests kotlin.math.sign(float)
 */


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:0.0> , sin ( <NUM_LIT:0.0> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , sin ( <NUM_LIT:1.0> ) , <NUM_LIT:0.0> ) <EOL> }

/**
 * Tests kotlin.math.sin(Double)
 */


{ <EOL> assertTrue ( "<STR_LIT>" , Double . isNaN ( sinh ( Double . NaN ) ) ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , sinh ( Double . POSITIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . NEGATIVE_INFINITY , sinh ( Double . NEGATIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( <NUM_LIT:0.0> . toBits ( ) , sinh ( <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( + <NUM_LIT:0.0> . toBits ( ) , sinh ( + <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( ( - <NUM_LIT:0.0> ) . toBits ( ) , sinh ( - <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , sinh ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . NEGATIVE_INFINITY , sinh ( - <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , sinh ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT> , sinh ( - <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , sinh ( <NUM_LIT> ) ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , sinh ( Double . MAX_VALUE ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , sinh ( Double . MIN_VALUE ) , <NUM_LIT:0.0> ) <EOL> }

/**
 * Tests kotlin.math.sinh(Double)
 */


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , sqrt ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> }

/**
 * Tests kotlin.math.sqrt(Double)
 */


{ <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:0.0> , tan ( <NUM_LIT:0.0> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , tan ( <NUM_LIT:1.0> ) ) <EOL> }

/**
 * Tests kotlin.math.tan(Double)
 */


{ <EOL> assertTrue ( "<STR_LIT>" , Double . isNaN ( tanh ( Double . NaN ) ) ) <EOL> assertEquals ( "<STR_LIT>" , + <NUM_LIT:1.0> , tanh ( Double . POSITIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT:1.0> , tanh ( Double . NEGATIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( <NUM_LIT:0.0> . toBits ( ) , tanh ( <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( + <NUM_LIT:0.0> . toBits ( ) , tanh ( + <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( ( - <NUM_LIT:0.0> ) . toBits ( ) , tanh ( - <NUM_LIT:0.0> ) . toBits ( ) ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:1.0> , tanh ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , - <NUM_LIT:1.0> , tanh ( - <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , tanh ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , tanh ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT:1.0> , tanh ( Double . MAX_VALUE ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , tanh ( Double . MIN_VALUE ) , <NUM_LIT:0.0> ) <EOL> }

/**
 * Tests kotlin.math.tanh(Double)
 */


{ <EOL> assertTrue ( "<STR_LIT>" , Double . isNaN ( ulp ( Double . NaN ) ) ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , ulp ( Double . POSITIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . POSITIVE_INFINITY , ulp ( Double . NEGATIVE_INFINITY ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . MIN_VALUE , ulp ( <NUM_LIT:0.0> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . MIN_VALUE , ulp ( + <NUM_LIT:0.0> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . MIN_VALUE , ulp ( - <NUM_LIT:0.0> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , pow ( <NUM_LIT:2.0> , <NUM_LIT> ) , ulp ( Double . MAX_VALUE ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , pow ( <NUM_LIT:2.0> , <NUM_LIT> ) , ulp ( - Double . MAX_VALUE ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . MIN_VALUE , ulp ( Double . MIN_VALUE ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , Double . MIN_VALUE , ulp ( - Double . MIN_VALUE ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ulp ( <NUM_LIT:1.0> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ulp ( - <NUM_LIT:1.0> ) , <NUM_LIT:0.0> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ulp ( <NUM_LIT> ) , <NUM_LIT:0.0> ) <EOL> }


{ <EOL> assertTrue ( "<STR_LIT>" , Float . isNaN ( ulp ( Float . NaN ) ) ) <EOL> assertEquals ( "<STR_LIT>" , Float . POSITIVE_INFINITY , ulp ( Float . POSITIVE_INFINITY ) , <NUM_LIT> ) <EOL> assertEquals ( "<STR_LIT>" , Float . POSITIVE_INFINITY , ulp ( Float . NEGATIVE_INFINITY ) , <NUM_LIT> ) <EOL> assertEquals ( "<STR_LIT>" , Float . MIN_VALUE , ulp ( <NUM_LIT:0.0f> ) , <NUM_LIT> ) <EOL> assertEquals ( "<STR_LIT>" , Float . MIN_VALUE , ulp ( + <NUM_LIT:0.0f> ) , <NUM_LIT> ) <EOL> assertEquals ( "<STR_LIT>" , Float . MIN_VALUE , ulp ( - <NUM_LIT:0.0f> ) , <NUM_LIT> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ulp ( Float . MAX_VALUE ) , <NUM_LIT> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ulp ( - Float . MAX_VALUE ) , <NUM_LIT> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ulp ( Float . MIN_VALUE ) , <NUM_LIT> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ulp ( - Float . MIN_VALUE ) , <NUM_LIT> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ulp ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ulp ( - <NUM_LIT> ) , <NUM_LIT> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ulp ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> assertEquals ( "<STR_LIT>" , <NUM_LIT> , ulp ( <NUM_LIT> ) , <NUM_LIT> ) <EOL> }


public fun < I > Operation < I , BufferedImage > . rotate ( block : Rotate . ( ) -> Unit ) : Operation < I , BufferedImage >

{ <EOL> return PreprocessingPipeline ( this , Rotate ( ) . apply ( block ) ) <EOL> }

/** Applies [Rotate] operation to rotate the image by an arbitrary angle (specified in degrees). */


public fun < I > Operation < I , BufferedImage > . crop ( block : Cropping . ( ) -> Unit ) : Operation < I , BufferedImage >

{ <EOL> return PreprocessingPipeline ( this , Cropping ( ) . apply ( block ) ) <EOL> }

/** Applies [Cropping] operation to crop the image by the specified amount. */


public fun < I > Operation < I , BufferedImage > . resize ( block : Resize . ( ) -> Unit ) : Operation < I , BufferedImage >

{ <EOL> return PreprocessingPipeline ( this , Resize ( ) . apply ( block ) ) <EOL> }

/** Applies [Resize] operation to resize the image to a specific size. */


public fun < I > Operation < I , BufferedImage > . pad ( block : Padding . ( ) -> Unit ) : Operation < I , BufferedImage >

{ <EOL> return PreprocessingPipeline ( this , Padding ( ) . apply ( block ) ) <EOL> }

/** Applies [Padding] operation to pad the image. */


public fun < I > Operation < I , BufferedImage > . convert ( block : Convert . ( ) -> Unit ) : Operation < I , BufferedImage >

{ <EOL> return PreprocessingPipeline ( this , Convert ( ) . apply ( block ) ) <EOL> }

/** Applies [Convert] operation to convert the image to a different [ColorMode]. */


public fun < I > Operation < I , BufferedImage > . grayscale ( ) : Operation < I , BufferedImage >

{ <EOL> return PreprocessingPipeline ( this , Convert ( colorMode = ColorMode . GRAYSCALE ) ) <EOL> }

/** Applies [Convert] operation to convert the image to [ColorMode.GRAYSCALE]. */


public fun < I > Operation < I , BufferedImage > . centerCrop ( block : CenterCrop . ( ) -> Unit ) : Operation < I , BufferedImage >

{ <EOL> return PreprocessingPipeline ( this , CenterCrop ( ) . apply ( block ) ) <EOL> }

/** Applies [CenterCrop] operation to crop the image at the center. */


public fun < I > Operation < I , BufferedImage > . toFloatArray ( block : ConvertToFloatArray . ( ) -> Unit ) : Operation < I , FloatData >

{ <EOL> return PreprocessingPipeline ( this , ConvertToFloatArray ( ) . apply ( block ) ) <EOL> }

/** Applies [ConvertToFloatArray] operation to convert the image to a float array. */


public fun superType ( type : ConeKotlinType )

{ <EOL> superTypeProviders += { type } <EOL> }

/**
 * Adds [type] as supertype for constructed class
 *
 * If no supertypes are declared [kotlin.Any] supertype will be
 * added automatically
 */


public fun superType ( typeProvider : ( List < FirTypeParameterRef > ) -> ConeKotlinType )

{ <EOL> superTypeProviders += typeProvider <EOL> }

/**
 * Adds type created by [typeProvider] as supertype for constructed class
 * Use this overload when supertype uses type parameters of constructed class
 *
 * If no supertypes are declared [kotlin.Any] supertype will be
 * added automatically
 */


@ ExperimentalTopLevelDeclarationsGenerationApi <EOL> public fun FirExtension . createTopLevelClass ( classId : ClassId , key : GeneratedDeclarationKey , classKind : ClassKind = ClassKind . CLASS , config : ClassBuildingContext . ( ) -> Unit = { } ) : FirRegularClass

{ <EOL> return ClassBuildingContext ( session , key , owner = null , classId , classKind ) . apply ( config ) . build ( ) <EOL> }

/**
 * Creates top-level class with given [classId]
 * All declarations in class should be generated using methods from [FirDeclarationGenerationExtension]
 * Generation of top-level classes with [FirDeclarationsForMetadataProviderExtension] is prohibited
 *
 * If no supertypes added then [kotlin.Any] supertype will be added automatically
 *
 * Created class won't have a constructor; constructor can be added separately with [createConstructor] function
 */


public fun FirExtension . createNestedClass ( owner : FirClassSymbol < * > , name : Name , key : GeneratedDeclarationKey , classKind : ClassKind = ClassKind . CLASS , config : ClassBuildingContext . ( ) -> Unit = { } ) : FirRegularClass

{ <EOL> return ClassBuildingContext ( session , key , owner , owner . classId . createNestedClassId ( name ) , classKind ) . apply ( config ) . apply { <EOL> status { <EOL> isExpect = owner . isExpect <EOL> } <EOL> } . build ( ) <EOL> }

/**
 * Creates nested class for [owner] class with name [name]
 * If class is generated in [FirDeclarationGenerationExtension], all its declarations should be generated
 * using methods from [FirDeclarationGenerationExtension]
 * If class is generated in [FirDeclarationsForMetadataProviderExtension] all its declarations should be manually added right to
 * FIR node of created class
 *
 * If no supertypes added then [kotlin.Any] supertype will be added automatically
 *
 * Created class won't have a constructor; constructor can be added separately with [createConstructor] function
 *
 * By default, the class is only nested; to create an inner class, create nested class and add inner status via status()
 */


public fun FirExtension . createCompanionObject ( owner : FirClassSymbol < * > , key : GeneratedDeclarationKey , config : ClassBuildingContext . ( ) -> Unit = { } ) : FirRegularClass

{ <EOL> val classId = owner . classId . createNestedClassId ( SpecialNames . DEFAULT_NAME_FOR_COMPANION_OBJECT ) <EOL> return ClassBuildingContext ( session , key , owner , classId , ClassKind . OBJECT ) . apply ( config ) . apply { <EOL> modality = Modality . FINAL <EOL> status { <EOL> isCompanion = true <EOL> isExpect = owner . isExpect <EOL> } <EOL> } . build ( ) <EOL> }

/**
 * Creates companion object for [owner] class
 * If class is generated in [FirDeclarationGenerationExtension], all its declarations should be generated
 * using methods from [FirDeclarationGenerationExtension]
 * If class is generated in [FirDeclarationsForMetadataProviderExtension] all its declarations should be manually added right to
 * FIR node of created class
 *
 * If no supertypes added then [kotlin.Any] supertype will be added automatically
 *
 * Created class won't have a constructor; constructor can be added separately with [createDefaultPrivateConstructor] function
 */


override fun buildTransformedAtomicExtensionSignature ( atomicExtension : IrFunction , isArrayReceiver : Boolean ) : IrSimpleFunction

{ <EOL> val mangledName = mangleAtomicExtensionName ( atomicExtension . name . asString ( ) , isArrayReceiver ) <EOL> val atomicReceiverType = atomicExtension . extensionReceiverParameter ! ! . type <EOL> val valueType = ( atomicReceiverType as IrSimpleType ) . atomicToPrimitiveType ( ) <EOL> return pluginContext . irFactory . buildFun { <EOL> name = Name . identifier ( mangledName ) <EOL> isInline = true <EOL> visibility = atomicExtension . visibility <EOL> origin = AbstractAtomicSymbols . ATOMICFU_GENERATED_FUNCTION <EOL> } . apply { <EOL> extensionReceiverParameter = null <EOL> dispatchReceiverParameter = atomicExtension . dispatchReceiverParameter ? . deepCopyWithSymbols ( this ) <EOL> atomicExtension . typeParameters . forEach { addTypeParameter ( it . name . asString ( ) , it . representativeUpperBound ) } <EOL> addSyntheticValueParametersToTransformedAtomicExtension ( isArrayReceiver , if ( valueType == irBuiltIns . anyNType ) atomicReceiverType . arguments . first ( ) . typeOrNull ! ! else valueType ) <EOL> atomicExtension . valueParameters . forEach { addValueParameter ( it . name , it . type ) } <EOL> returnType = atomicExtension . returnType <EOL> this . parent = atomicExtension . parent <EOL> } <EOL> }

/**
 * Builds the signature of the transformed atomic extension:
 *
 * inline fun AtomicInt.foo(arg: Int) --> inline fun foo$atomicfu(refGetter: () -> KMutableProperty0<Int>, arg': Int)
 * inline fun foo$atomicfu$array(atomicArray: AtomicIntegerArray, index: Int, arg': Int)
 */


override fun IrFunction . addSyntheticValueParametersToTransformedAtomicExtension ( isArrayReceiver : Boolean , valueType : IrType )

{ <EOL> if ( ! isArrayReceiver ) { <EOL> addValueParameter ( REF_GETTER , atomicSymbols . kMutableProperty0GetterType ( valueType ) ) . apply { isCrossinline = true } <EOL> } else { <EOL> addValueParameter ( ATOMIC_ARRAY , atomicSymbols . getParameterizedAtomicArrayType ( valueType ) ) <EOL> addValueParameter ( INDEX , irBuiltIns . intType ) <EOL> } <EOL> }

/**
 * Adds synthetic value parameters to the transformed atomic extension (custom atomic extension or atomicfu inline update functions).
 */


infix fun < K , V > Map < K , Set < V > > . mergeWith ( that : Map < K , Set < V > > ) : Map < K , Set < V > >

{ <EOL> val result = mutableMapOf < K , Set < V > > ( ) <EOL> for ( ( k , setOfV ) in this ) { <EOL> result [ k ] = setOfV + that [ k ] . orEmpty ( ) <EOL> } <EOL> val uniqueEntriesFromRight = that - this . keys <EOL> result . putAll ( uniqueEntriesFromRight ) <EOL> return result <EOL> }


public expect fun ComplexDouble ( re : Double , im : Double ) : ComplexDouble

/**
 * Creates a [ComplexDouble] with the given real and imaginary values in floating-point format.
 *
 * @param re the real value of the complex number in double format.
 * @param im the imaginary value of the complex number in double format.
 */


public expect fun ComplexDouble ( re : Number , im : Number ) : ComplexDouble

/**
 * Creates a [ComplexDouble] with the given real and imaginary values in number format.
 *
 * @param re the real value of the complex number in number format.
 * @param im the imaginary value of the complex number in number format.
 */


public fun ComplexDouble ( re : Number ) : ComplexDouble

= ComplexDouble ( re . toDouble ( ) , <NUM_LIT:0.0> )

/**
 * Creates a [ComplexDouble] with a zero imaginary value.
 * @param re the real value of the complex number in number format.
 */


public fun conjugate ( ) : ComplexDouble

= ComplexDouble ( re , - im )

/**
 * Returns the complex conjugate value of the current complex number.
 *
 * @return a new ComplexFloat object representing the complex conjugate of the current complex number.
 * It has the same real part as the current number, but an opposite sign of its imaginary part.
 */


= sqrt ( re * re + im * im )

/**
 * Returns the absolute value of the complex number.
 *
 * @return the absolute value of the complex number.
 */


= atan2 ( im , re )

/**
 * Returns the angle of the complex number.
 *
 * @return the angle of the complex number as a Double.
 */


public operator fun plus ( other : Byte ) : ComplexDouble

= ComplexDouble ( re + other , im )

/**
 * Adds the other byte value to this value.
 *
 * @param other the [Byte] value to add to this one.
 * @return a new [ComplexDouble] with the result of the addition.
 */


public operator fun plus ( other : Short ) : ComplexDouble

= ComplexDouble ( re + other , im )

/**
 * Adds the other short value to this value.
 *
 * @param other the [Short] value to add to this one.
 * @return a new [ComplexDouble] with the result of the addition.
 */


public operator fun plus ( other : Int ) : ComplexDouble

= ComplexDouble ( re + other , im )

/**
 * Adds the other integer value to this value.
 *
 * @param other the [Int] value to add to this one.
 * @return a new [ComplexDouble] with the result of the addition.
 */


public operator fun plus ( other : Long ) : ComplexDouble

= ComplexDouble ( re + other , im )

/**
 * Adds the other long value to this value.
 *
 * @param other the [Long] value to add to this one.
 * @return a new [ComplexDouble] with the result of the addition.
 */


public operator fun plus ( other : Float ) : ComplexDouble

= ComplexDouble ( re + other , im )

/**
 * Adds the other float value to this value.
 *
 * @param other the [Float] value to add to this one.
 * @return a new [ComplexDouble] with the result of the addition.
 */


public operator fun plus ( other : Double ) : ComplexDouble

= ComplexDouble ( re + other , im )

/**
 * Adds the other double value to this value.
 *
 * @param other the [Double] value to add to this one.
 * @return a new [ComplexDouble] with the result of the addition.
 */


public operator fun plus ( other : ComplexFloat ) : ComplexDouble

= ComplexDouble ( re + other . re , im + other . im )

/**
 * Adds the other ComplexFloat value to this value.
 *
 * @param other the [ComplexFloat] value to add to this one.
 * @return a new [ComplexDouble] with the result of the addition.
 */


public operator fun plus ( other : ComplexDouble ) : ComplexDouble

/**
 * Adds the other ComplexDouble value to this value.
 *
 * @param other the [ComplexDouble] value to add to this one.
 * @return a new [ComplexDouble] with the result of the addition.
 */


public operator fun minus ( other : Byte ) : ComplexDouble

= ComplexDouble ( re - other , im )

/**
 * Subtracts the other byte value from this value.
 *
 * @param other the [Byte] value to be subtracted from this value.
 * @return a new [ComplexDouble] representing the result of the subtraction operation.
 */


public operator fun minus ( other : Short ) : ComplexDouble

= ComplexDouble ( re - other , im )

/**
 * Subtracts the other short value from this value.
 *
 * @param other the [Short] value to be subtracted from this value.
 * @return a new [ComplexDouble] representing the result of the subtraction operation.
 */


public operator fun minus ( other : Int ) : ComplexDouble

= ComplexDouble ( re - other , im )

/**
 * Subtracts the other integer value from this value.
 *
 * @param other the [Int] value to be subtracted from this value.
 * @return a new [ComplexDouble] representing the result of the subtraction operation.
 */


public operator fun minus ( other : Long ) : ComplexDouble

= ComplexDouble ( re - other , im )

/**
 * Subtracts the other long value from this value.
 *
 * @param other the [Long] value to be subtracted from this value.
 * @return a new [ComplexDouble] representing the result of the subtraction operation.
 */


public operator fun minus ( other : Float ) : ComplexDouble

= ComplexDouble ( re - other , im )

/**
 * Subtracts the other float value from this value.
 *
 * @param other the [Float] value to be subtracted from this value.
 * @return a new [ComplexDouble] representing the result of the subtraction operation.
 */


public operator fun minus ( other : Double ) : ComplexDouble

= ComplexDouble ( re - other , im )

/**
 * Subtracts the other double value from this value.
 *
 * @param other the [Double] value to be subtracted from this value.
 * @return a new [ComplexDouble] representing the result of the subtraction operation.
 */


public operator fun minus ( other : ComplexFloat ) : ComplexDouble

= ComplexDouble ( re - other . re , im - other . im )

/**
 * Subtracts the other ComplexFloat value from this value.
 *
 * @param other the [ComplexFloat] value to be subtracted from this value.
 * @return a new [ComplexDouble] representing the result of the subtraction operation.
 */


public operator fun minus ( other : ComplexDouble ) : ComplexDouble

/**
 * Subtracts the other ComplexDouble value from this value.
 *
 * @param other the [ComplexDouble] value to be subtracted from this value.
 * @return a new [ComplexDouble] representing the result of the subtraction operation.
 */


public operator fun times ( other : Byte ) : ComplexDouble

= ComplexDouble ( re * other , im * other )

/**
 * Multiplies this complex number by the given byte value.
 *
 * @param other the [Byte] value to multiply this complex number by
 * @return a new [ComplexDouble] representing the result of the multiplication
 */


public operator fun times ( other : Short ) : ComplexDouble

/**
 * Multiplies this complex number by the given short value.
 *
 * @param other the [Short] value to multiply this complex number by
 * @return a new [ComplexDouble] representing the result of the multiplication
 */


public operator fun times ( other : Int ) : ComplexDouble

/**
 * Multiplies this complex number by the given integer value.
 *
 * @param other the [Int] value to multiply this complex number by
 * @return a new [ComplexDouble] representing the result of the multiplication
 */


public operator fun times ( other : Long ) : ComplexDouble

/**
 * Multiplies this complex number by the given long value.
 *
 * @param other the [Long] value to multiply this complex number by
 * @return a new [ComplexDouble] representing the result of the multiplication
 */


public operator fun times ( other : Float ) : ComplexDouble

/**
 * Multiplies this complex number by the given float value.
 *
 * @param other the [Float] value to multiply this complex number by
 * @return a new [ComplexDouble] representing the result of the multiplication
 */


public operator fun times ( other : Double ) : ComplexDouble

/**
 * Multiplies this complex number by the given double value.
 *
 * @param other the [Double] value to multiply this complex number by
 * @return a new [ComplexDouble] representing the result of the multiplication
 */


public operator fun times ( other : ComplexFloat ) : ComplexDouble

= <EOL> ComplexDouble ( re * other . re - im * other . im , re * other . im + other . re * im )

/**
 * Multiplies this complex number by the given ComplexFloat value.
 *
 * @param other the [ComplexFloat] value to multiply this complex number by
 * @return a new [ComplexDouble] representing the result of the multiplication
 */


public operator fun times ( other : ComplexDouble ) : ComplexDouble

/**
 * Multiplies this complex number by the given ComplexDouble value.
 *
 * @param other the [ComplexDouble] value to multiply this complex number by
 * @return a new [ComplexDouble] representing the result of the multiplication
 */


public operator fun div ( other : Byte ) : ComplexDouble

= ComplexDouble ( re / other , im / other )

/**
 * Divides this value by the given byte value.
 *
 * @param other the [Byte] value to divide this ComplexFloat by.
 * @return a new [ComplexDouble] value after division.
 */


public operator fun div ( other : Short ) : ComplexDouble

/**
 * Divides this value by the given short value.
 *
 * @param other the [Short] value to divide this ComplexFloat by.
 * @return a new [ComplexDouble] value after division.
 */


public operator fun div ( other : Int ) : ComplexDouble

/**
 * Divides this value by the given integer value.
 *
 * @param other the [Int] value to divide this ComplexFloat by.
 * @return a new [ComplexDouble] value after division.
 */


public operator fun div ( other : Long ) : ComplexDouble

/**
 * Divides this value by the given long value.
 *
 * @param other the [Long] value to divide this ComplexFloat by.
 * @return a new [ComplexDouble] value after division.
 */


public operator fun div ( other : Float ) : ComplexDouble

/**
 * Divides this value by the given float value.
 *
 * @param other the [Float] value to divide this ComplexFloat by.
 * @return a new [ComplexDouble] value after division.
 */


public operator fun div ( other : Double ) : ComplexDouble

/**
 * Divides this value by the given double value.
 *
 * @param other the [Double] value to divide this ComplexFloat by.
 * @return a new [ComplexDouble] value after division.
 */


public operator fun div ( other : ComplexFloat ) : ComplexDouble

= when { <EOL> kotlin . math . abs ( other . re ) > kotlin . math . abs ( other . im ) -> { <EOL> val dr = other . im / other . re <EOL> val dd = other . re + dr * other . im <EOL> if ( dd . isNaN ( ) || dd == <NUM_LIT> ) throw ArithmeticException ( "<STR_LIT>" ) <EOL> ComplexDouble ( ( re + im * dr ) / dd , ( im - re * dr ) / dd ) <EOL> } <EOL> other . im == <NUM_LIT> -> throw ArithmeticException ( "<STR_LIT>" ) <EOL> else -> { <EOL> val dr = other . re / other . im <EOL> val dd = other . im + dr * other . re <EOL> if ( dd . isNaN ( ) || dd == <NUM_LIT> ) throw ArithmeticException ( "<STR_LIT>" ) <EOL> ComplexDouble ( ( re * dr + im ) / dd , ( im * dr - re ) / dd ) <EOL> } <EOL> }

/**
 * Divides this value by the given ComplexFloat value.
 *
 * @param other the [ComplexFloat] value to divide this ComplexFloat by.
 * @return a new [ComplexDouble] value after division.
 */


public operator fun div ( other : ComplexDouble ) : ComplexDouble

= when { <EOL> kotlin . math . abs ( other . re ) > kotlin . math . abs ( other . im ) -> { <EOL> val dr = other . im / other . re <EOL> val dd = other . re + dr * other . im <EOL> if ( dd . isNaN ( ) || dd == <NUM_LIT:0.0> ) throw ArithmeticException ( "<STR_LIT>" ) <EOL> ComplexDouble ( ( re + im * dr ) / dd , ( im - re * dr ) / dd ) <EOL> } <EOL> other . im == <NUM_LIT:0.0> -> throw ArithmeticException ( "<STR_LIT>" ) <EOL> else -> { <EOL> val dr = other . re / other . im <EOL> val dd = other . im + dr * other . re <EOL> if ( dd . isNaN ( ) || dd == <NUM_LIT:0.0> ) throw ArithmeticException ( "<STR_LIT>" ) <EOL> ComplexDouble ( ( re * dr + im ) / dd , ( im * dr - re ) / dd ) <EOL> } <EOL> }

/**
 * Divides this value by the given ComplexDouble value.
 *
 * @param other the [ComplexDouble] value to divide this ComplexFloat by.
 * @return a new [ComplexDouble] value after division.
 */


public operator fun unaryPlus ( ) : ComplexDouble

= this


public operator fun unaryMinus ( ) : ComplexDouble

= ComplexDouble ( - re , - im )

/** Returns the negative of this value. */


public operator fun component1 ( ) : Double

= re

/**
 * Returns the real component of a complex number.
 *
 * @return the real part of the complex number as a Double value.
 */


public operator fun component2 ( ) : Double

= im

/**
 * Returns the imaginary component of a complex number.
 *
 * @return the imaginary part of the complex number as a Double value.
 */


fun < R , D > accept ( visitor : FirVisitor < R , D > , data : D ) : R

= <EOL> visitor . visitElement ( this , data )

/**
 * Runs the provided [visitor] on the FIR subtree with the root at this node.
 *
 * @param visitor The visitor to accept.
 * @param data An arbitrary context to pass to each invocation of [visitor]'s methods.
 * @return The value returned by the topmost `visit*` invocation.
 */


@ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> fun < E : FirElement , D > transform ( transformer : FirTransformer < D > , data : D ) : E

= <EOL> transformer . transformElement ( this , data ) as E

/**
 * Runs the provided [transformer] on the FIR subtree with the root at this node.
 *
 * @param transformer The transformer to use.
 * @param data An arbitrary context to pass to each invocation of [transformer]'s methods.
 * @return The transformed node.
 */


= accept ( visitor , null )

/**
 * Runs the provided [visitor] on the FIR subtree with the root at this node.
 *
 * @param visitor The visitor to accept.
 */


fun < R , D > acceptChildren ( visitor : FirVisitor < R , D > , data : D )

/**
 * Runs the provided [visitor] on subtrees with roots in this node's children.
 *
 * Basically, calls `accept(visitor, data)` on each child of this node.
 *
 * Does **not** run [visitor] on this node itself.
 *
 * @param visitor The visitor for children to accept.
 * @param data An arbitrary context to pass to each invocation of [visitor]'s methods.
 */


fun acceptChildren ( visitor : FirVisitorVoid )

= acceptChildren ( visitor , null )

/**
 * Runs the provided [visitor] on subtrees with roots in this node's children.
 *
 * Basically, calls `accept(visitor)` on each child of this node.
 *
 * Does **not** run [visitor] on this node itself.
 *
 * @param visitor The visitor for children to accept.
 */


fun < D > transformChildren ( transformer : FirTransformer < D > , data : D ) : FirElement

/**
 * Recursively transforms this node's children *in place* using [transformer].
 *
 * Basically, executes `this.child = this.child.transform(transformer, data)` for each child of this node.
 *
 * Does **not** run [transformer] on this node itself.
 *
 * @param transformer The transformer to use for transforming the children.
 * @param data An arbitrary context to pass to each invocation of [transformer]'s methods.
 * @return `this`
 */


fun process ( file : FirFile , holder : SessionHolder , targetElement : PsiElement , bodyElement : PsiElement ? = targetElement ) : Context ?

{ <EOL> val isBodyContextCollected = bodyElement != null <EOL> val acceptedElements = targetElement . parentsWithSelf . toSet ( ) <EOL> val contextProvider = process ( file , holder , computeDesignation ( file , targetElement ) , isBodyContextCollected ) { candidate -> <EOL> when ( candidate ) { <EOL> targetElement -> FilterResponse . STOP <EOL> in acceptedElements -> FilterResponse . CONTINUE <EOL> else -> FilterResponse . SKIP <EOL> } <EOL> } <EOL> for ( acceptedElement in acceptedElements ) { <EOL> if ( acceptedElement === bodyElement ) { <EOL> val bodyContext = contextProvider [ acceptedElement , ContextKind . BODY ] <EOL> if ( bodyContext != null ) { <EOL> return bodyContext <EOL> } <EOL> } <EOL> val elementContext = contextProvider [ acceptedElement , ContextKind . SELF ] <EOL> if ( elementContext != null ) { <EOL> return elementContext <EOL> } <EOL> } <EOL> return null <EOL> }

/**
 * Get the most precise context available for the [targetElement] in the [file].
 *
 * @param file The file to process.
 * @param holder The [SessionHolder] for the session that owns a [file].
 * @param targetElement The most precise element for which the context is required.
 * @param bodyElement An element for which the [ContextKind.BODY] context is preferred.
 *
 * Returns the context of the [targetElement] if available, or of one of its tree parents.
 * Returns `null` if the context was not collected.
 */


fun process ( file : FirFile , holder : SessionHolder , designation : FirDesignation ? , shouldCollectBodyContext : Boolean , filter : ( PsiElement ) -> FilterResponse , ) : ContextProvider

{ <EOL> val interceptor = designation ? . let ( :: DesignationInterceptor ) <EOL> val visitor = ContextCollectorVisitor ( holder , shouldCollectBodyContext , filter , interceptor ) <EOL> visitor . collect ( file ) <EOL> return ContextProvider { element , kind -> visitor [ element , kind ] } <EOL> }

/**
 * Processes the [FirFile], collecting contexts for elements matching the [filter].
 *
 * @param file The file to process.
 * @param holder The [SessionHolder] for the session that owns a [file].
 * @param designation The declaration to process. If `null`, all declarations in the [file] are processed.
 * @param shouldCollectBodyContext If `true`, [ContextKind.BODY] is collected where available.
 * @param filter The filter predicate. Context is collected only for [PsiElement]s for which the [filter] returns `true`.
 */


@ OptIn ( PrivateForInline :: class ) <EOL> private fun Processor . processClassHeader ( regularClass : FirRegularClass )

{ <EOL> context . withTypeParametersOf ( regularClass ) { <EOL> processList ( regularClass . contextReceivers ) <EOL> processList ( regularClass . typeParameters ) <EOL> processList ( regularClass . superTypeRefs ) <EOL> } <EOL> }

/**
 * Process the parts of the class declaration which resolution is not affected
 * by the class own supertypes.
 *
 * Processing those parts before adding the implicit receiver of the class
 * to the [context] allows to not collect incorrect contexts for them later on.
 */


private fun Processor . processAnonymousObjectHeader ( anonymousObject : FirAnonymousObject )

{ <EOL> processList ( anonymousObject . superTypeRefs ) <EOL> }

/**
 * Same as [processClassHeader], but for anonymous objects.
 *
 * N.B. Anonymous classes cannot have its own explicit type parameters, so we do not process them.
 */


override fun visitField ( field : FirField )

= withProcessor ( field ) { <EOL> dumpContext ( field , ContextKind . SELF ) <EOL> processSignatureAnnotations ( field ) <EOL> onActiveBody { <EOL> field . lazyResolveToPhase ( FirResolvePhase . BODY_RESOLVE ) <EOL> context . withField ( field ) { <EOL> dumpContext ( field , ContextKind . BODY ) <EOL> onActive { <EOL> process ( field . initializer ) <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * We visit fields to properly handle supertypes delegation:
 *
 * ```kt
 * class Foo : Bar by baz
 * ```
 *
 * In the code above, `baz` expression is saved into a separate synthetic field.
 * It's not accessible from the delegated constructor, it's just added to the
 * `Foo` class body.
 */


private fun withInterceptor ( block : ( ) -> Unit )

{ <EOL> val target = designationPathInterceptor ? . invoke ( ) <EOL> if ( target != null ) { <EOL> target . accept ( this ) <EOL> } else { <EOL> block ( ) <EOL> } <EOL> }

/**
 * Ensures that the visitor is going through the path specified by the initial [FirDesignation].
 *
 * If the designation is over, then allows the [block] code to take control.
 */


{ <EOL> assertLongDecimalString ( "<STR_LIT:0>" , <NUM_LIT:0> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , Long . MIN_VALUE ) <EOL> assertLongDecimalString ( "<STR_LIT>" , Long . MAX_VALUE ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT:10>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assertLongDecimalString ( "<STR_LIT>" , <NUM_LIT> ) <EOL> }

/**
 * This test hard codes the results of Long.toString() because that function rounds large values
 * when using Kotlin/JS IR. https://youtrack.jetbrains.com/issue/KT-39891
 */


private fun copyXToBatch ( src : Array < FloatArray > , start : Int , length : Int ) : Array < FloatArray >

{ <EOL> val dataForBatch = Array ( length ) { <EOL> src [ it + start ] . copyOf ( ) <EOL> } <EOL> return dataForBatch <EOL> }

/** Converts [src] to [FloatBuffer] from [start] position for the next [length] positions. */


private fun copyLabelsToBatch ( src : FloatArray , start : Int , length : Int ) : FloatArray

{ <EOL> val dataForBatch = FloatArray ( length ) { <NUM_LIT:0.0f> } <EOL> for ( i in start until start + length ) { <EOL> dataForBatch [ i - start ] = src [ i ] <EOL> } <EOL> return dataForBatch <EOL> }


override fun split ( splitRatio : Double ) : Pair < OnHeapDataset , OnHeapDataset >

{ <EOL> require ( splitRatio in <NUM_LIT:0.0> .. <NUM_LIT:1.0> ) { "<STR_LIT>" } <EOL> val trainDatasetLastIndex = truncate ( x . size * splitRatio ) . toInt ( ) <EOL> return Pair ( OnHeapDataset ( x . copyOfRange ( <NUM_LIT:0> , trainDatasetLastIndex ) , y . copyOfRange ( <NUM_LIT:0> , trainDatasetLastIndex ) , elementShape ) , OnHeapDataset ( x . copyOfRange ( trainDatasetLastIndex , x . size ) , y . copyOfRange ( trainDatasetLastIndex , y . size ) , elementShape ) ) <EOL> }

/** Splits datasets on two sub-datasets according [splitRatio].*/


{ <EOL> return x . size <EOL> }


override fun getX ( idx : Int ) : FloatData

{ <EOL> return x [ idx ] to elementShape <EOL> }


{ <EOL> return y [ idx ] <EOL> }

/** Returns label as [FloatArray] by index [idx]. */


@ JvmStatic <EOL> public fun toOneHotVector ( numClasses : Int , label : Byte ) : FloatArray

{ <EOL> val ret = FloatArray ( numClasses ) <EOL> ret [ label . toInt ( ) and SHIFT_NUMBER ] = <NUM_LIT> <EOL> return ret <EOL> }

/** Creates binary vector with size [numClasses] from [label]. */


@ JvmStatic <EOL> public fun convertByteToFloat ( label : Byte ) : Float

{ <EOL> return ( label . toInt ( ) and SHIFT_NUMBER ) . toFloat ( ) <EOL> }


@ JvmStatic <EOL> public fun create ( features : Array < FloatArray > , labels : FloatArray , shape : TensorShape = TensorShape ( features . first ( ) . size . toLong ( ) ) ) : OnHeapDataset

{ <EOL> return OnHeapDataset ( features , labels , shape ) <EOL> }

/**
 * Creates an [OnHeapDataset] from [features] and [labels].
 */


@ JvmStatic <EOL> @ Throws ( IOException :: class ) <EOL> public fun create ( pathToData : File , labels : FloatArray , preprocessing : Operation < BufferedImage , FloatData > ) : OnHeapDataset

{ <EOL> val xFiles = prepareFileNames ( pathToData ) <EOL> val ( x , shape ) = preprocessing . fileLoader ( ) . prepareX ( xFiles ) <EOL> return OnHeapDataset ( x , labels , shape ) <EOL> }

/**
 * Creates an [OnHeapDataset] from [pathToData] and [labels] using [preprocessing] to prepare images.
 */


@ JvmStatic <EOL> @ Throws ( IOException :: class ) <EOL> public fun create ( pathToData : File , labelGenerator : LabelGenerator < File > , preprocessing : Operation < BufferedImage , FloatData > = ConvertToFloatArray ( ) ) : OnHeapDataset

{ <EOL> val xFiles = prepareFileNames ( pathToData ) <EOL> val ( x , shape ) = preprocessing . fileLoader ( ) . prepareX ( xFiles ) <EOL> val y = labelGenerator . prepareY ( xFiles ) <EOL> return OnHeapDataset ( x , y , shape ) <EOL> }

/**
 * Creates an [OnHeapDataset] from [pathToData] and [labelGenerator] with [preprocessing] to prepare images.
 */


internal fun addBuildEventsListenerRegistryMock ( project : Project )

{ <EOL> try { <EOL> val projectScopeServices = ( project as DefaultProject ) . services as ProjectScopeServices <EOL> val state : Field = ProjectScopeServices :: class . java . superclass . getDeclaredField ( "<STR_LIT>" ) <EOL> state . isAccessible = true <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> val stateValue : AtomicReference < Any > = state . get ( projectScopeServices ) as AtomicReference < Any > <EOL> val enumClass = Class . forName ( DefaultServiceRegistry :: class . java . name + "<STR_LIT>" ) <EOL> stateValue . set ( enumClass . enumConstants [ <NUM_LIT:0> ] ) <EOL> projectScopeServices . add ( BuildEventsListenerRegistry :: class . java , BuildEventsListenerRegistryMock ) <EOL> stateValue . set ( enumClass . enumConstants [ <NUM_LIT:1> ] ) <EOL> } catch ( e : Throwable ) { <EOL> throw RuntimeException ( e ) <EOL> } <EOL> }

/**
 * In Gradle 6.7-rc-1 BuildEventsListenerRegistry service is not created in we need it in order
 * to instantiate AGP. This creates a fake one and injects it - http://b/168630734.
 */


internal fun loadMainDispatcherFactory ( ) : List < MainDispatcherFactory >

{ <EOL> val clz = MainDispatcherFactory :: class . java <EOL> if ( ! ANDROID_DETECTED ) { <EOL> return load ( clz , clz . classLoader ) <EOL> } <EOL> return try { <EOL> val result = ArrayList < MainDispatcherFactory > ( <NUM_LIT:2> ) <EOL> createInstanceOf ( clz , "<STR_LIT>" ) ? . apply { result . add ( this ) } <EOL> createInstanceOf ( clz , "<STR_LIT>" ) ? . apply { result . add ( this ) } <EOL> result <EOL> } catch ( e : Throwable ) { <EOL> load ( clz , clz . classLoader ) <EOL> } <EOL> }

/**
 * This method attempts to load [MainDispatcherFactory] in Android-friendly way.
 *
 * If we are not on Android, this method fallbacks to a regular service loading,
 * else we attempt to do `Class.forName` lookup for
 * `AndroidDispatcherFactory` and `TestMainDispatcherFactory`.
 * If lookups are successful, we return resultinAg instances because we know that
 * `MainDispatcherFactory` API is internal and this is the only possible classes of `MainDispatcherFactory` Service on Android.
 *
 * Such intricate dance is required to avoid calls to `ServiceLoader.load` for multiple reasons:
 * 1) It eliminates disk lookup on potentially slow devices on the Main thread.
 * 2) Various Android toolchain versions by various vendors don't tend to handle ServiceLoader calls properly.
 * Sometimes META-INF is removed from the resulting APK, sometimes class names are mangled, etc.
 * While it is not the problem of `kotlinx.coroutines`, it significantly worsens user experience, thus we are workarounding it.
 * Examples of such issues are #932, #1072, #1557, #1567
 *
 * We also use SL for [CoroutineExceptionHandler], but we do not experience the same problems and CEH is a public API
 * that may already be injected vis SL, so we are not using the same technique for it.
 */


protected fun doTestByKtFile ( ktFile : KtFile , testServices : TestServices )

{ <EOL> analyseForTest ( ktFile ) { <EOL> val actualText = with ( SymbolByFqName . getSymbolDataFromFile ( testDataPath ) ) { <EOL> val classSymbol = toSymbols ( ktFile ) . singleOrNull ( ) as? KtNamedClassOrObjectSymbol <EOL> ? : error ( "<STR_LIT>" ) <EOL> classSymbol . getSealedClassInheritors ( ) . joinToString ( "<STR_LIT>" ) { inheritor -> <EOL> val declarationRenderer = KtDeclarationRendererForSource . WITH_QUALIFIED_NAMES . with { <EOL> typeRenderer = KtTypeRendererForSource . WITH_QUALIFIED_NAMES . with { <EOL> usualClassTypeRenderer = KtUsualClassTypeRenderer . AS_FULLY_EXPANDED_CLASS_TYPE_WITH_TYPE_ARGUMENTS <EOL> } <EOL> } <EOL> "<STR_LIT>" <EOL> } <EOL> } <EOL> testServices . assertions . assertEqualsToTestDataFileSibling ( actualText ) <EOL> } <EOL> }

/**
 * [ktFile] may be a fake file for dangling module tests.
 */


public actual fun < T > Array < out T > . elementAt ( index : Int ) : T

{ <EOL> return elementAtOrElse ( index ) { throw IndexOutOfBoundsException ( "<STR_LIT>" ) } <EOL> }

/**
 * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.
 *
 * @sample samples.collections.Collections.Elements.elementAt
 */


public actual fun ByteArray . elementAt ( index : Int ) : Byte


public actual fun ShortArray . elementAt ( index : Int ) : Short


public actual fun IntArray . elementAt ( index : Int ) : Int


public actual fun LongArray . elementAt ( index : Int ) : Long


public actual fun FloatArray . elementAt ( index : Int ) : Float


public actual fun DoubleArray . elementAt ( index : Int ) : Double


public actual fun BooleanArray . elementAt ( index : Int ) : Boolean


public actual fun CharArray . elementAt ( index : Int ) : Char


public actual fun < T > Array < out T > . asList ( ) : List < T >

{ <EOL> return ArrayList < T > ( this . unsafeCast < Array < Any ? > > ( ) ) <EOL> }

/**
 * Returns a [List] that wraps the original array.
 */


@ kotlin . internal . InlineOnly <EOL> public actual inline fun ByteArray . asList ( ) : List < Byte >

{ <EOL> return this . unsafeCast < Array < Byte > > ( ) . asList ( ) <EOL> }