Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Operator MOD
#71
(12-03-2022, 05:57 PM)DSMan195276 Wrote:
(12-03-2022, 05:20 PM)Kernelpanic Wrote: In Octave too! Is this a bug in two math programs?  Huh
Code: (Select All)
octave:1> 1.5 \ 1
ans = 0.6667
octave:2> 1.4 \ 1
ans = 0.7143
octave:3> mod(1.4, 1)
ans = 0.4000
octave:4> 1.4 / 1
ans = 1.4000
octave:5>

In Octave the `\` operators does left division, basically dividing the thing on the right by the thing on the left. So `1.4 \ 1` is the same as `1 / 1.4`.

This is the explanation for the result. In Julia too. Thanks!
Reply
#72
Code: (Select All)

fmod = x - Int(x / y) * y

This is how I had to do it in C64 basic, because there is no MOD. Be grateful you have a MOD Smile

Sorry for the undead thread poke.
grymmjack (gj!)
GitHubYouTube | Soundcloud | 16colo.rs
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with "MOD" Kernelpanic 5 1,011 01-06-2025, 02:37 AM
Last Post: Pete
  Ternary operator Kernelpanic 8 1,787 10-31-2023, 03:36 PM
Last Post: Kernelpanic
  DAY 023: MOD Pete 0 415 12-03-2022, 06:08 PM
Last Post: Pete
  qbs_str my mod Jack 9 1,937 04-20-2022, 03:22 PM
Last Post: admin

Forum Jump:


Users browsing this thread: 1 Guest(s)