Skip to content

ZeroDivisionError('float division by zero') on variable declaration in scientific notation #152

@Cjkjvfnby

Description

@Cjkjvfnby

Hello,

I'm doing a script that validates HScript compilation.

This code reports ZeroDivisionError('float division by zero')

function Test() {
    var test = 1e10;
}

This is a valid Haxe code, and I expect that script should support it.

Code of the checker

import sys.io.File;
import sys.FileSystem;
import hscript.Parser;
import hscript.Interp;
import hscript.Checker;
import StringTools;
import Sys;

class HscriptChecker {
    static function main() {
        var args = Sys.args();

        var filePath = args[0];

        try {
            var code = File.getContent(filePath);
            var parser = new Parser();
            parser.allowTypes = true;
            parser.allowMetadata = true;
            parser.parseString(code);

        } catch (e:Dynamic) {
            var msg = Std.string(e);

            var fileName = FileSystem.fullPath(filePath);
            msg = StringTools.replace(msg, "hscript", filePath);
            Sys.println(msg);
            Sys.exit(1);
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions