in reply to Re: [OT: JavaScript] JS remainder operation ('%')
in thread [OT: JavaScript] JS remainder operation ('%')

https://t.ly/EHF3Z

Thank You !!!
From that link: this may be compared with the C library function fmod.
They're just using the fmod() function from the standard C math.h:
## try.pl ## use strict; use warnings; use Inline C => <<'EOC'; double foo(double x, double y) { return fmod(x, y); } EOC print foo(900719925474099.7, 2147483647.83); __END__ Outputs: 859064762.882
How is it possible that the XP of Anonymous Monk is less than that of Vroom ???
(Defies all logic ;-)

Cheers,
Rob

Replies are listed 'Best First'.
Re^3: [OT: JavaScript] JS remainder operation ('%')
by choroba (Cardinal) on Jan 17, 2024 at 14:20 UTC
    Alternatively
    #! /usr/bin/perl use warnings; use strict; use feature qw{ say }; use POSIX qw{ fmod }; say fmod(900719925474099.7, 2147483647.83);

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]