Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to compute min and max of two mpf numbers?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Allen Rabinovich  
View profile  
 More options Nov 1 2012, 11:39 pm
From: Allen Rabinovich <allen...@gmail.com>
Date: Thu, 1 Nov 2012 20:39:23 -0700 (PDT)
Local: Thurs, Nov 1 2012 11:39 pm
Subject: How to compute min and max of two mpf numbers?

A beginner mpmath question here: how do I compute a min (or a max) of two
mpf numbers? Is just the regular python min(a,b) the answer? Why does that
work properly, given that mpf's are their own datatypes, and min relies on
standard comparison operators?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Fredrik Johansson  
View profile  
 More options Nov 2 2012, 3:09 am
From: Fredrik Johansson <fredrik.johans...@gmail.com>
Date: Fri, 2 Nov 2012 08:09:14 +0100
Local: Fri, Nov 2 2012 3:09 am
Subject: Re: How to compute min and max of two mpf numbers?

On Fri, Nov 2, 2012 at 4:39 AM, Allen Rabinovich <allen...@gmail.com> wrote:
> A beginner mpmath question here: how do I compute a min (or a max) of two
> mpf numbers? Is just the regular python min(a,b) the answer? Why does that
> work properly, given that mpf's are their own datatypes, and min relies on
> standard comparison operators?

Yes, min(a,b) works fine. It works because mpmath classes provide
comparison methods (__ge__, __gt__, etc.) so that the standard
comparison operators (>=, >, etc.) can be used. This is standard for
custom numeric types in Python.

Fredrik


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »