Post

Float Lang Library

ballerina\lang.float Lang Library provides utility functions for float type.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
import ballerina/io;

public function main() {

    float x = 5.5;
    float y = -10.0;

    float maxVal = float:max(x, y);
    float minVal = float:min(x, y);
    float absY = y.abs();
    float roundVal = x.round();

    string output = string `ballerina/lang.float Functions:
    x: ${x}
    y: ${y}
    max(x, y): ${maxVal}
    min(x, y): ${minVal}
    abs(y): ${absY}
    round(x): ${roundVal}
    `;
    io:println(output);
}
ballerina/lang.float Functions:
    x: 5.5
    y: -10.0
    max(x, y): 5.5
    min(x, y): -10.0
    abs(y): 10.0
    round(x): 6.0
    
 bal version
Ballerina 2201.6.0 (Swan Lake Update 6)
// Partial Code. Change View  to see full code.
public function main() {
    float x = 5.5;
    float y = -10.0;

    float maxVal = float:max(x, y);
    float minVal = float:min(x, y);
    float absY = y.abs();
    float roundVal = x.round();

}
// Highlights Only. Change View  to see full code.
float x = 5.5;
float y = -10.0;

float maxVal = float:max(x, y);
float minVal = float:min(x, y);
float absY = y.abs();
float roundVal = x.round();

Float Lang Library

 June 1, 2023

Table of Content

Key Words

Float Lang Library
 June 1, 2023

Table of Content

Key Words


Navigation

Site Settings

Site Theme

Source Code Density