toExternal

Summary

Converts the IEEE-754 double-precision floating-point value to its equivalent external value.

Usage

public override external toExternal()

Returns

The IEEE-754 double-precision floating-point value held by the System.Double object.

Description

Converts the IEEE-754 double-precision floating-point value to its equivalent external value.

Examples

Basic Usage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import System;
 
external mysql = { query: function(q, a) { Console.log(q, a); } };
 
// Constrain type arguments to only classes that can convert to 'external'
interface ICommand<T: IExportable>
{
    void execute(...T args);
}
 
class UpdateXYCoordinate : ICommand<Double>
{
    final void execute(...Double args) {
        double x = args[0] ?? 0;
        double y = args[1] ?? 0;
        mysql.query(
            "UPDATE `player` SET `x_coordinate` = ?, `y_coordinate` = ? WHERE `id` = 1;",
            x.toExternal(),
            y.toExternal()
        );
    }
}
 
auto updateXYCoordinateCommand = new UpdateXYCoordinate();
updateXYCoordinateCommand.execute(1.1d, 1.0d);

Share

HTML | BBCode | Direct Link